summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-05-12 13:12:33 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-05-12 13:12:33 (GMT)
commitb62e7979600feee23dc7cdb61042a8fc7673122b (patch)
treef7351372f37979dd2d048e0b68a16a4cd3b2aadb /src/uscxml
parent1b11b310be61e51b3ac5ebb83f7c8a33aef3d6e8 (diff)
downloaduscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.zip
uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.gz
uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.bz2
Major Refactoring v2.0
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/CMakeLists.txt134
-rw-r--r--src/uscxml/Common.h55
-rw-r--r--src/uscxml/Convenience.h230
-rw-r--r--src/uscxml/Interpreter.cpp3673
-rw-r--r--src/uscxml/Interpreter.h877
-rw-r--r--src/uscxml/InterpreterInfo.h103
-rw-r--r--src/uscxml/Message.h30
-rw-r--r--src/uscxml/URL.h336
-rw-r--r--src/uscxml/URL.mm49
-rw-r--r--src/uscxml/concurrency/BlockingQueue.h79
-rw-r--r--src/uscxml/concurrency/DelayedEventQueue.cpp166
-rw-r--r--src/uscxml/concurrency/DelayedEventQueue.h86
-rw-r--r--src/uscxml/concurrency/EventBase.cpp74
-rw-r--r--src/uscxml/concurrency/EventBase.h61
-rw-r--r--src/uscxml/concurrency/Timer.cpp115
-rw-r--r--src/uscxml/concurrency/Timer.h74
-rw-r--r--src/uscxml/concurrency/tinythread.cpp335
-rw-r--r--src/uscxml/concurrency/tinythread.h726
-rw-r--r--src/uscxml/debug/Breakpoint.cpp266
-rw-r--r--src/uscxml/debug/Breakpoint.h95
-rw-r--r--src/uscxml/debug/Complexity.cpp206
-rw-r--r--src/uscxml/debug/Complexity.h78
-rw-r--r--src/uscxml/debug/DebugSession.cpp378
-rw-r--r--src/uscxml/debug/DebugSession.h99
-rw-r--r--src/uscxml/debug/Debugger.cpp256
-rw-r--r--src/uscxml/debug/Debugger.h105
-rw-r--r--src/uscxml/debug/DebuggerServlet.cpp262
-rw-r--r--src/uscxml/debug/DebuggerServlet.h106
-rw-r--r--src/uscxml/debug/InterpreterIssue.cpp601
-rw-r--r--src/uscxml/debug/InterpreterIssue.h8
-rw-r--r--src/uscxml/debug/SCXMLDotWriter.cpp888
-rw-r--r--src/uscxml/debug/SCXMLDotWriter.h201
-rw-r--r--src/uscxml/dom/DOMUtils.cpp288
-rw-r--r--src/uscxml/dom/DOMUtils.h111
-rw-r--r--src/uscxml/dom/NameSpacingParser.cpp71
-rw-r--r--src/uscxml/dom/NameSpacingParser.h67
-rw-r--r--src/uscxml/interpreter/ContentExecutorImpl.cpp649
-rw-r--r--src/uscxml/interpreter/ContentExecutorImpl.h143
-rw-r--r--src/uscxml/interpreter/EventQueueImpl.cpp189
-rw-r--r--src/uscxml/interpreter/EventQueueImpl.h125
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp573
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.h56
-rw-r--r--src/uscxml/interpreter/InterpreterFast.cpp42
-rw-r--r--src/uscxml/interpreter/InterpreterFast.h47
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.cpp361
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.h290
-rw-r--r--src/uscxml/interpreter/InterpreterMonitor.h95
-rw-r--r--src/uscxml/interpreter/InterpreterRC.cpp661
-rw-r--r--src/uscxml/interpreter/InterpreterRC.h68
-rw-r--r--src/uscxml/interpreter/MicroStepFast.cpp1149
-rw-r--r--src/uscxml/interpreter/MicroStepFast.h127
-rw-r--r--src/uscxml/interpreter/MicroStepImpl.h127
-rw-r--r--src/uscxml/messages/Blob.h33
-rw-r--r--src/uscxml/messages/Data.cpp115
-rw-r--r--src/uscxml/messages/Data.h88
-rw-r--r--src/uscxml/messages/Event.cpp107
-rw-r--r--src/uscxml/messages/Event.h145
-rw-r--r--src/uscxml/messages/InvokeRequest.cpp93
-rw-r--r--src/uscxml/messages/InvokeRequest.h73
-rw-r--r--src/uscxml/messages/MMIMessages.cpp549
-rw-r--r--src/uscxml/messages/MMIMessages.h414
-rw-r--r--src/uscxml/messages/SendRequest.cpp135
-rw-r--r--src/uscxml/messages/SendRequest.h73
-rw-r--r--src/uscxml/pch.h33
-rw-r--r--src/uscxml/plugins/DataModel.h107
-rw-r--r--src/uscxml/plugins/EventHandler.h76
-rw-r--r--src/uscxml/plugins/ExecutableContent.h18
-rw-r--r--src/uscxml/plugins/Factory.cpp (renamed from src/uscxml/Factory.cpp)418
-rw-r--r--src/uscxml/plugins/Factory.h (renamed from src/uscxml/Factory.h)12
-rw-r--r--src/uscxml/plugins/IOProcessor.h39
-rw-r--r--src/uscxml/plugins/Invoker.h67
-rw-r--r--src/uscxml/plugins/Plugins.cpp31
-rw-r--r--src/uscxml/plugins/Plugins.h37
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Config.hpp141
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Connector.hpp86
-rw-r--r--src/uscxml/plugins/Pluma/DLibrary.cpp105
-rwxr-xr-xsrc/uscxml/plugins/Pluma/DLibrary.hpp123
-rw-r--r--src/uscxml/plugins/Pluma/Dir.cpp103
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Dir.hpp64
-rw-r--r--src/uscxml/plugins/Pluma/Host.cpp179
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Host.hpp212
-rw-r--r--src/uscxml/plugins/Pluma/PluginManager.cpp201
-rwxr-xr-xsrc/uscxml/plugins/Pluma/PluginManager.hpp245
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Pluma.hpp171
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Pluma.inl52
-rw-r--r--src/uscxml/plugins/Pluma/Provider.cpp52
-rwxr-xr-xsrc/uscxml/plugins/Pluma/Provider.hpp204
-rw-r--r--src/uscxml/plugins/Pluma/uce-dirent.h671
-rw-r--r--src/uscxml/plugins/datamodel/CMakeLists.txt274
-rw-r--r--src/uscxml/plugins/datamodel/common/bindings/dom/defines.i247
-rw-r--r--src/uscxml/plugins/datamodel/common/bindings/dom/dom.i125
-rw-r--r--src/uscxml/plugins/datamodel/common/bindings/dom/ignore.i392
-rw-r--r--src/uscxml/plugins/datamodel/common/bindings/dom/typemaps-general.i169
-rw-r--r--src/uscxml/plugins/datamodel/common/bindings/event.i22
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp42
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp.inc9576
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp477
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h30
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/bindings.i46
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp209
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h77
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp71
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h71
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp101
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp37
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h69
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp214
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h77
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp37
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h69
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp177
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp583
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h88
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp542
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h88
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp248
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp37
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h69
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp118
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h75
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp589
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h85
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h72
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp37
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h69
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp294
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h75
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp565
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h104
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp48
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h73
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp99
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp72
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp100
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp59
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h71
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h72
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp135
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h78
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp64
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.cpp186
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.h73
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp66
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCTypedArrayCustom.cpp250
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp275
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp154
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h75
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp46
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.cpp227
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.h105
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/Storage.cpp95
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/Storage.h47
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp283
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/TypedArray.h463
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp41
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp.inc9365
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h106
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp797
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h95
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/bindings.i45
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp176
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp66
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h82
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp81
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h87
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp148
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h96
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp114
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h81
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp490
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h133
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp431
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h131
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp152
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp101
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h92
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp382
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h122
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp53
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp232
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h96
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp432
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h167
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp50
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp66
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h80
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeListCustom.cpp71
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp71
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp46
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h80
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp53
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h81
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp95
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp55
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.cpp123
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.h90
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp59
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h77
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8TypedArrayCustom.cpp145
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp233
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp123
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h96
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp46
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDOM.cpp.inc8969
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp441
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.h47
-rw-r--r--src/uscxml/plugins/datamodel/lua/bindings.i38
-rw-r--r--src/uscxml/plugins/datamodel/null/NULLDataModel.cpp60
-rw-r--r--src/uscxml/plugins/datamodel/null/NULLDataModel.h65
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIConfig.h.in4
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp891
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h137
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.new962
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp814
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaDataModel.h119
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaParser.cpp298
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaParser.h104
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.l117
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp2598
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp2634
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp180
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.ypp254
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp876
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.h185
-rw-r--r--src/uscxml/plugins/element/CMakeLists.txt114
-rw-r--r--src/uscxml/plugins/element/fetch/FetchElement.cpp130
-rw-r--r--src/uscxml/plugins/element/fetch/FetchElement.h67
-rw-r--r--src/uscxml/plugins/element/file/FileElement.cpp259
-rw-r--r--src/uscxml/plugins/element/file/FileElement.h84
-rw-r--r--src/uscxml/plugins/element/mmi/MMIEvents.cpp61
-rw-r--r--src/uscxml/plugins/element/mmi/MMIEvents.h77
-rw-r--r--src/uscxml/plugins/element/postpone/PostponeElement.cpp169
-rw-r--r--src/uscxml/plugins/element/postpone/PostponeElement.h90
-rw-r--r--src/uscxml/plugins/element/respond/RespondElement.cpp202
-rw-r--r--src/uscxml/plugins/element/respond/RespondElement.h61
-rw-r--r--src/uscxml/plugins/invoker/CMakeLists.txt565
-rw-r--r--src/uscxml/plugins/invoker/audio/AudioToolbox.h51
-rw-r--r--src/uscxml/plugins/invoker/audio/AudioToolbox.mm185
-rw-r--r--src/uscxml/plugins/invoker/audio/LibSoundFile.cpp69
-rw-r--r--src/uscxml/plugins/invoker/audio/LibSoundFile.h46
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp421
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALInvoker.h111
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp541
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALPlayer.h125
-rw-r--r--src/uscxml/plugins/invoker/audio/PCMConverter.h49
-rw-r--r--src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp651
-rw-r--r--src/uscxml/plugins/invoker/calendar/CalendarInvoker.h99
-rw-r--r--src/uscxml/plugins/invoker/expect/ExpectInvoker.cpp360
-rw-r--r--src/uscxml/plugins/invoker/expect/ExpectInvoker.h79
-rw-r--r--src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp463
-rw-r--r--src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h115
-rw-r--r--src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp443
-rw-r--r--src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h139
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp147
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h70
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp722
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h148
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp611
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h89
-rw-r--r--src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp115
-rw-r--r--src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h72
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp137
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.h74
-rw-r--r--src/uscxml/plugins/invoker/im/IMConfig.h.in4
-rw-r--r--src/uscxml/plugins/invoker/im/IMInvoker.cpp1409
-rw-r--r--src/uscxml/plugins/invoker/im/IMInvoker.h377
-rw-r--r--src/uscxml/plugins/invoker/imap/IMAPInvoker.cpp495
-rw-r--r--src/uscxml/plugins/invoker/imap/IMAPInvoker.h171
-rw-r--r--src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp1097
-rw-r--r--src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h174
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.cpp62
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.h59
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp180
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h41
-rw-r--r--src/uscxml/plugins/invoker/smtp/SMTPInvoker.cpp362
-rw-r--r--src/uscxml/plugins/invoker/smtp/SMTPInvoker.h78
-rw-r--r--src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp63
-rw-r--r--src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h59
-rw-r--r--src/uscxml/plugins/invoker/system/SystemInvoker.cpp63
-rw-r--r--src/uscxml/plugins/invoker/system/SystemInvoker.h59
-rw-r--r--src/uscxml/plugins/invoker/umundo/JSON.pb.cc462
-rw-r--r--src/uscxml/plugins/invoker/umundo/JSON.pb.h361
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp655
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h94
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp269
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h94
-rw-r--r--src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp64
-rw-r--r--src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h59
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp290
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h75
-rw-r--r--src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html246
-rw-r--r--src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.inc.h691
-rw-r--r--src/uscxml/plugins/ioprocessor/CMakeLists.txt126
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp142
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h16
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp115
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h72
-rw-r--r--src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp19
-rw-r--r--src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h19
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp210
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h72
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp132
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h53
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp59
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h66
-rw-r--r--src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp155
-rw-r--r--src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h15
-rw-r--r--src/uscxml/server/HTTPServer.cpp67
-rw-r--r--src/uscxml/server/HTTPServer.h35
-rw-r--r--src/uscxml/server/InterpreterServlet.cpp215
-rw-r--r--src/uscxml/server/InterpreterServlet.h135
-rw-r--r--src/uscxml/server/Socket.cpp389
-rw-r--r--src/uscxml/server/Socket.h139
-rw-r--r--src/uscxml/transform/ChartAnnotator.cpp24
-rw-r--r--src/uscxml/transform/ChartAnnotator.h27
-rw-r--r--src/uscxml/transform/ChartToC.cpp712
-rw-r--r--src/uscxml/transform/ChartToC.h21
-rw-r--r--src/uscxml/transform/ChartToFSM.cpp2035
-rw-r--r--src/uscxml/transform/ChartToFSM.cpp.new1482
-rw-r--r--src/uscxml/transform/ChartToFSM.h350
-rw-r--r--src/uscxml/transform/ChartToFSM.h.new303
-rw-r--r--src/uscxml/transform/ChartToFlatSCXML.cpp440
-rw-r--r--src/uscxml/transform/ChartToFlatSCXML.h56
-rw-r--r--src/uscxml/transform/ChartToMinimalSCXML.cpp284
-rw-r--r--src/uscxml/transform/ChartToMinimalSCXML.h88
-rw-r--r--src/uscxml/transform/ChartToPromela.cpp3578
-rw-r--r--src/uscxml/transform/ChartToPromela.h447
-rw-r--r--src/uscxml/transform/ChartToTex.cpp291
-rw-r--r--src/uscxml/transform/ChartToTex.h61
-rw-r--r--src/uscxml/transform/ChartToVHDL.cpp13
-rw-r--r--src/uscxml/transform/ChartToVHDL.h15
-rw-r--r--src/uscxml/transform/FlatStateIdentifier.h287
-rw-r--r--src/uscxml/transform/Transformer.h20
-rw-r--r--src/uscxml/transform/Trie.cpp (renamed from src/uscxml/util/Trie.cpp)0
-rw-r--r--src/uscxml/transform/Trie.h (renamed from src/uscxml/util/Trie.h)0
-rw-r--r--src/uscxml/util/Convenience.cpp (renamed from src/uscxml/Convenience.cpp)4
-rw-r--r--src/uscxml/util/Convenience.h83
-rw-r--r--src/uscxml/util/DOM.cpp402
-rw-r--r--src/uscxml/util/DOM.h224
-rw-r--r--src/uscxml/util/Predicates.cpp468
-rw-r--r--src/uscxml/util/Predicates.h61
-rw-r--r--src/uscxml/util/URL.cpp (renamed from src/uscxml/URL.cpp)666
-rw-r--r--src/uscxml/util/URL.h333
-rw-r--r--src/uscxml/util/UUID.cpp (renamed from src/uscxml/UUID.cpp)0
-rw-r--r--src/uscxml/util/UUID.h (renamed from src/uscxml/UUID.h)0
400 files changed, 36817 insertions, 78235 deletions
diff --git a/src/uscxml/CMakeLists.txt b/src/uscxml/CMakeLists.txt
index e98aed6..5549b84 100644
--- a/src/uscxml/CMakeLists.txt
+++ b/src/uscxml/CMakeLists.txt
@@ -2,37 +2,13 @@
# Actual files of core library
############################################################
-file(GLOB_RECURSE USCXML_SERVER
- server/*.cpp
- server/*.h
-)
-source_group("Interpreter" FILES ${USCXML_SERVER})
-list (APPEND USCXML_FILES ${USCXML_SERVER})
-
-file(GLOB_RECURSE USCXML_UTIL
- util/*.cpp
- util/*.hpp
- util/*.c
- util/*.h
-)
-source_group("Interpreter" FILES ${USCXML_UTIL})
-list (APPEND USCXML_FILES ${USCXML_UTIL})
-
-file(GLOB_RECURSE USCXML_DOM
- dom/*.cpp
- dom/*.hpp
- dom/*.c
- dom/*.h
+file(GLOB_RECURSE USCXML_INTERPRETERS
+ interpreter/*.cpp
+ interpreter/*.h
)
-source_group("Interpreter" FILES ${USCXML_DOM})
-list (APPEND USCXML_FILES ${USCXML_DOM})
+source_group("Interpreter" FILES ${USCXML_INTERPRETERS})
+list (APPEND USCXML_FILES ${USCXML_INTERPRETERS})
-file(GLOB_RECURSE USCXML_CONCURRENCY
- concurrency/*.cpp
- concurrency/*.h
-)
-source_group("Interpreter" FILES ${USCXML_CONCURRENCY})
-list (APPEND USCXML_FILES ${USCXML_CONCURRENCY})
file(GLOB_RECURSE USCXML_MESSAGES
messages/*.cpp
@@ -41,36 +17,32 @@ file(GLOB_RECURSE USCXML_MESSAGES
source_group("Interpreter" FILES ${USCXML_MESSAGES})
list (APPEND USCXML_FILES ${USCXML_MESSAGES})
-if (NOT BUILD_MINIMAL)
- file(GLOB_RECURSE USCXML_DEBUG
- debug/*.cpp
- debug/*.h
- )
- source_group("Interpreter" FILES ${USCXML_DEBUG})
- list (APPEND USCXML_FILES ${USCXML_DEBUG})
-
- file(GLOB_RECURSE USCXML_TRANSFORM
- transform/*.cpp
- transform/*.h
- )
- source_group("Interpreter" FILES ${USCXML_TRANSFORM})
- list (APPEND USCXML_TRANSFORM_FILES ${USCXML_TRANSFORM})
-endif()
-file(GLOB_RECURSE USCXML_INTERPRETERS
- interpreter/*.cpp
- interpreter/*.h
+file(GLOB_RECURSE USCXML_DEBUG
+ debug/*.cpp
+ debug/*.h
)
-source_group("Interpreter" FILES ${USCXML_INTERPRETERS})
-list (APPEND USCXML_FILES ${USCXML_INTERPRETERS})
+source_group("Interpreter" FILES ${USCXML_DEBUG})
+list (APPEND USCXML_FILES ${USCXML_DEBUG})
+
+
+file(GLOB_RECURSE USCXML_MISC
+ util/*.cpp
+ util/*.hpp
+ util/*.c
+ util/*.h
+)
+source_group("Interpreter" FILES ${USCXML_MISC})
+list (APPEND USCXML_FILES ${USCXML_MISC})
+
+
+file(GLOB USCXML_SERVER
+ server/*.cpp
+ server/*.h
+)
+source_group("Interpreter" FILES ${USCXML_SERVER})
+list (APPEND USCXML_FILES ${USCXML_SERVER})
-if(APPLE OR IOS)
- file(GLOB USCXML_APPLE
- *.mm
- )
- source_group("Interpreter" FILES ${USCXML_APPLE})
- list (APPEND USCXML_FILES ${USCXML_APPLE})
-endif()
file(GLOB USCXML_CORE
${CMAKE_SOURCE_DIR}/contrib/src/jsmn/jsmn.c
@@ -78,46 +50,38 @@ file(GLOB USCXML_CORE
*.cpp
*.h
)
-
source_group("Interpreter" FILES ${USCXML_CORE})
list (APPEND USCXML_FILES ${USCXML_CORE})
+
file(GLOB USCXML_PLUGINS
- plugins/DataModel.h
- plugins/EventHandler.h
- plugins/ExecutableContent.h
- plugins/Invoker.h
- plugins/IOProcessor.h
+ plugins/*.cpp
+ plugins/*.h
)
+
source_group("Interpreter" FILES ${USCXML_PLUGINS})
list (APPEND USCXML_FILES ${USCXML_PLUGINS})
-if (BUILD_AS_PLUGINS)
- list (APPEND USCXML_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/plugins)
- file(GLOB PLUMA
- plugins/Pluma/*.cpp
- plugins/Pluma/*.h
- plugins/*.cpp
- plugins/*.h
- )
- source_group("Interpreter" FILES ${PLUMA})
- list (APPEND USCXML_FILES ${PLUMA})
- add_definitions("-DBUILD_AS_PLUGINS")
-endif()
+file(GLOB_RECURSE USCXML_TRANSFORM
+ transform/*.cpp
+ transform/*.h
+)
+source_group("Interpreter" FILES ${USCXML_TRANSFORM})
+list (APPEND USCXML_TRANSFORM_FILES ${USCXML_TRANSFORM})
add_subdirectory(plugins/datamodel)
-add_subdirectory(plugins/element)
-add_subdirectory(plugins/ioprocessor)
+# add_subdirectory(plugins/element)
add_subdirectory(plugins/invoker)
+add_subdirectory(plugins/ioprocessor)
-SET(USCXML_INVOKERS ${USCXML_INVOKERS} PARENT_SCOPE)
-SET(USCXML_IOPROCESSORS ${USCXML_IOPROCESSORS} PARENT_SCOPE)
-SET(USCXML_ELEMENTS ${USCXML_ELEMENTS} PARENT_SCOPE)
-SET(USCXML_DATAMODELS ${USCXML_DATAMODELS} PARENT_SCOPE)
-SET(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE)
-
-set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE)
-set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE)
+# SET(USCXML_INVOKERS ${USCXML_INVOKERS} PARENT_SCOPE)
+# SET(USCXML_IOPROCESSORS ${USCXML_IOPROCESSORS} PARENT_SCOPE)
+# SET(USCXML_ELEMENTS ${USCXML_ELEMENTS} PARENT_SCOPE)
+# SET(USCXML_DATAMODELS ${USCXML_DATAMODELS} PARENT_SCOPE)
+# SET(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE)
+#
+# set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE)
+# set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE)
set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
set(USCXML_TRANSFORM_FILES ${USCXML_TRANSFORM_FILES} PARENT_SCOPE)
-SET(PLUMA ${PLUMA} PARENT_SCOPE) \ No newline at end of file
+# SET(PLUMA ${PLUMA} PARENT_SCOPE) \ No newline at end of file
diff --git a/src/uscxml/Common.h b/src/uscxml/Common.h
index 9d35222..5b29427 100644
--- a/src/uscxml/Common.h
+++ b/src/uscxml/Common.h
@@ -42,9 +42,11 @@
#endif
#ifdef _WIN32
-#include <winsock2.h>
+typedef unsigned __int32 uint32_t;
+
// see http://stackoverflow.com/questions/1372480/c-redefinition-header-files
#define _WINSOCKAPI_ // stops windows.h including winsock.h
+#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
@@ -52,6 +54,57 @@
#include <sys/socket.h>
#endif
+#define PIMPL_OPERATORS(type) \
+\
+type() : _impl() { }\
+type(const std::shared_ptr<type##Impl> impl) : _impl(impl) { }\
+type(const type& other) : _impl(other._impl) { }\
+virtual ~type() { };\
+\
+operator bool() const {\
+ return !!_impl;\
+}\
+bool operator< (const type& other) const {\
+ return _impl < other._impl;\
+}\
+bool operator==(const type& other) const {\
+ return _impl == other._impl;\
+}\
+bool operator!=(const type& other) const {\
+ return _impl != other._impl;\
+}\
+type& operator= (const type& other) {\
+ _impl = other._impl;\
+ return *this;\
+}
+
+#define PIMPL_OPERATORS2(type, base) \
+\
+type() : _impl() {}\
+type(std::shared_ptr<type##Impl> const impl) : base(impl), _impl(impl) { }\
+type(const type& other) : base(other._impl), _impl(other._impl) { }\
+virtual ~type() {};\
+\
+operator bool() const {\
+ return !!_impl;\
+}\
+bool operator< (const type& other) const {\
+ return _impl < other._impl;\
+}\
+bool operator==(const type& other) const {\
+ return _impl == other._impl;\
+}\
+bool operator!=(const type& other) const {\
+ return _impl != other._impl;\
+}\
+type& operator= (const type& other) {\
+ _impl = other._impl;\
+ base::_impl = _impl;\
+ return *this;\
+}
+
+
+
#if defined(_WIN32)
inline int setenv(const char *name, const char *value, int overwrite) {
int errcode = 0;
diff --git a/src/uscxml/Convenience.h b/src/uscxml/Convenience.h
deleted file mode 100644
index d715d3e..0000000
--- a/src/uscxml/Convenience.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CONVENIENCE_H_LU7GZ6CB
-#define CONVENIENCE_H_LU7GZ6CB
-
-#include "uscxml/Common.h"
-#include <inttypes.h>
-#include <stdlib.h>
-#include <boost/detail/endian.hpp>
-#include <boost/lexical_cast.hpp>
-
-namespace uscxml {
-inline bool isnan(double x);
-
-// see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c
-template <typename T> std::string toStr(T tmp) {
- std::ostringstream out;
- out.precision(std::numeric_limits<double>::digits10 + 1);
- out << tmp;
- return out.str();
-}
-
-template <typename T> T strTo(std::string tmp) {
- T output;
- std::istringstream in(tmp);
- in >> output;
- return output;
-}
-
-class USCXML_API NumAttr {
-public:
- NumAttr(const std::string& str) {
- size_t valueStart = str.find_first_of("0123456789.");
- if (valueStart != std::string::npos) {
- size_t valueEnd = str.find_last_of("0123456789.");
- if (valueEnd != std::string::npos) {
- value = str.substr(valueStart, (valueEnd - valueStart) + 1);
- size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1);
- if (unitStart != std::string::npos) {
- size_t unitEnd = str.find_last_of(" \t");
- if (unitEnd != std::string::npos && unitEnd > unitStart) {
- unit = str.substr(unitStart, unitEnd - unitStart);
- } else {
- unit = str.substr(unitStart, str.length() - unitStart);
- }
- }
- }
- }
- }
-
- std::string value;
- std::string unit;
-};
-
-bool isNumeric(const char* pszInput, int nNumberBase);
-bool isInteger( const char* pszInput, int nNumberBase);
-bool iequals(const std::string& a, const std::string& b);
-bool equals(const std::string& a, const std::string& b);
-bool stringIsTrue(const std::string& value);
-bool envVarIsTrue(const char* name);
-bool envVarIEquals(const char* name, const char* value);
-
-std::string escape(const std::string& a);
-std::string unescape(const std::string& a);
-
-// see http://www.cplusplus.com/forum/general/27544/
-
-// Little-endian operating systems:
-//---------------------------------
-// Linux on x86, x64, Alpha and Itanium
-// Mac OS on x86, x64
-// Solaris on x86, x64, PowerPC
-// Tru64 on Alpha
-// Windows on x86, x64 and Itanium
-
-// Big-endian operating systems:
-//------------------------------
-// AIX on POWER
-// AmigaOS on PowerPC and 680x0
-// HP-UX on Itanium and PA-RISC
-// Linux on MIPS, SPARC, PA-RISC, POWER, PowerPC, and 680x0
-// Mac OS on PowerPC and 680x0
-// Solaris on SPARC
-
-/**
-Detect endianness, see http://stackoverflow.com/questions/809902/64-bit-ntohl-in-c
-union {
- unsigned long long ull;
- char c[8];
-} x;
-x.ull = 0x0123456789abcdef; // may need special suffix for ULL.
-*/
-
-enum endianness {
- little_endian,
- big_endian,
- network_endian = big_endian,
-
-#if defined(BOOST_LITTLE_ENDIAN)
- host_endian = little_endian
-#elif defined(BOOST_BIG_ENDIAN)
- host_endian = big_endian
-#else
-#error "unable to determine system endianness"
-#endif
-};
-
-namespace detail {
-
-template<typename T, size_t sz>
-struct swap_bytes {
- inline T operator()(T val) {
- throw std::out_of_range("data size");
- }
-};
-
-template<typename T>
-struct swap_bytes<T, 1> {
- inline T operator()(T val) {
- return val;
- }
-};
-
-template<typename T>
-struct swap_bytes<T, 2> { // for 16 bit
- inline T operator()(T val) {
- return ((((val) >> 8) & 0xff) | (((val) & 0xff) << 8));
- }
-};
-
-template<typename T>
-struct swap_bytes<T, 4> { // for 32 bit
- inline T operator()(T val) {
-#if defined(_USE_BUILTIN_BSWAPS) && defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4)
- return __builtin_bswap32(val);
-#else
- return ((((val) & 0xff000000) >> 24) |
- (((val) & 0x00ff0000) >> 8) |
- (((val) & 0x0000ff00) << 8) |
- (((val) & 0x000000ff) << 24));
-#endif
- }
-};
-
-template<>
-struct swap_bytes<float, 4> {
- inline float operator()(float val) {
- uint32_t mem = swap_bytes<uint32_t, sizeof(uint32_t)>()(*(uint32_t*)&val);
- return *(float*)&mem;
- }
-};
-
-template<typename T>
-struct swap_bytes<T, 8> { // for 64 bit
- inline T operator()(T val) {
-#if defined(_USE_BUILTIN_BSWAPS) && defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4)
- return __builtin_bswap64(val);
-#else
- return ((((val) & 0xff00000000000000ull) >> 56) |
- (((val) & 0x00ff000000000000ull) >> 40) |
- (((val) & 0x0000ff0000000000ull) >> 24) |
- (((val) & 0x000000ff00000000ull) >> 8 ) |
- (((val) & 0x00000000ff000000ull) << 8 ) |
- (((val) & 0x0000000000ff0000ull) << 24) |
- (((val) & 0x000000000000ff00ull) << 40) |
- (((val) & 0x00000000000000ffull) << 56));
-#endif
- }
-};
-
-template<>
-struct swap_bytes<double, 8> {
- inline double operator()(double val) {
- uint64_t mem = swap_bytes<uint64_t, sizeof(uint64_t)>()(*(uint64_t*)&val);
- return *(double*)&mem;
- }
-};
-
-template<endianness from, endianness to, class T>
-struct do_byte_swap {
- inline T operator()(T value) {
- return swap_bytes<T, sizeof(T)>()(value);
- }
-};
-// specialisations when attempting to swap to the same endianess
-template<class T> struct do_byte_swap<little_endian, little_endian, T> {
- inline T operator()(T value) {
- return value;
- }
-};
-template<class T> struct do_byte_swap<big_endian, big_endian, T> {
- inline T operator()(T value) {
- return value;
- }
-};
-
-} // namespace detail
-
-template<endianness from, endianness to, class T>
-inline T byte_swap(T value) {
- // ensure the data is only 1, 2, 4 or 8 bytes
- BOOST_STATIC_ASSERT(sizeof(T) == 1 || sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8);
- // ensure we're only swapping arithmetic types
- BOOST_STATIC_ASSERT(boost::is_arithmetic<T>::value);
-
- return detail::do_byte_swap<from, to, T>()(value);
-}
-
-
-}
-
-
-#endif /* end of include guard: CONVENIENCE_H_LU7GZ6CB */
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 0fa366b..d6f61a2 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -20,126 +20,232 @@
#include "uscxml/config.h"
#include "uscxml/Common.h"
#include "uscxml/Interpreter.h"
-#include "uscxml/URL.h"
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/dom/NameSpacingParser.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-#include "uscxml/transform/ChartToFSM.h" // only for testing
+#include "uscxml/util/DOM.h"
+#include "uscxml/util/URL.h"
-#include "getopt.h"
-
-#include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
-#include "uscxml/server/InterpreterServlet.h"
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#include <DOM/Simple/DOMImplementation.hpp>
-#include <SAX/helpers/InputSourceResolver.hpp>
-#include <DOM/io/Stream.hpp>
-
-#include <boost/lexical_cast.hpp>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
+#include <xercesc/parsers/XercesDOMParser.hpp>
+#include <xercesc/framework/MemBufInputSource.hpp>
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/sax/HandlerBase.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include "easylogging++.h"
-#include <glog/logging.h>
#include <iostream>
-#include <io/uri.hpp>
+#include <boost/algorithm/string.hpp>
#include <assert.h>
#include <algorithm>
+#include <memory>
+#include <mutex>
-#include "uscxml/Factory.h"
-
-#if 0
-# define INTERPRETER_IMPL InterpreterDraft6
-# include "uscxml/interpreter/InterpreterDraft6.h"
-#elif 1
-# define INTERPRETER_IMPL InterpreterRC
-# include "uscxml/interpreter/InterpreterRC.h"
-#else
-# define INTERPRETER_IMPL InterpreterFast
-# include "uscxml/interpreter/InterpreterFast.h"
-#endif
+#include "getopt.h"
+
+#include "easylogging++.h"
+INITIALIZE_EASYLOGGINGPP
#define VERBOSE 0
-/// valid interpreter state transitions
-#define VALID_FROM_INSTANTIATED(newState) ( \
- newState == USCXML_MICROSTEPPED || \
- newState == USCXML_INITIALIZED || \
- newState == USCXML_DESTROYED\
-)
-
-#define VALID_FROM_FAULTED(newState) ( \
- newState == USCXML_DESTROYED\
-)
-
-#define VALID_FROM_INITIALIZED(newState) ( \
- newState == USCXML_MICROSTEPPED || \
- newState == USCXML_FINISHED || \
- newState == USCXML_DESTROYED \
-)
-
-#define VALID_FROM_MICROSTEPPED(newState) ( \
- newState == USCXML_DESTROYED || \
- newState == USCXML_MACROSTEPPED || \
- newState == USCXML_MICROSTEPPED || \
- newState == USCXML_FINISHED \
-)
-
-#define VALID_FROM_MACROSTEPPED(newState) ( \
- newState == USCXML_DESTROYED || \
- newState == USCXML_MICROSTEPPED || \
- newState == USCXML_MACROSTEPPED || \
- newState == USCXML_IDLE || \
- newState == USCXML_FINISHED \
-)
-
-#define VALID_FROM_IDLE(newState) ( \
- newState == USCXML_DESTROYED || \
- newState == USCXML_MICROSTEPPED || \
- newState == USCXML_MACROSTEPPED \
-)
-
-#define VALID_FROM_FINISHED(newState) ( \
- newState == USCXML_DESTROYED || \
- newState == USCXML_INSTANTIATED \
-)
-
-/// macro to catch exceptions in executeContent
-#define CATCH_AND_DISTRIBUTE(msg) \
-catch (Event e) {\
- if (rethrow) {\
- throw(e);\
- } else {\
- LOG(ERROR) << msg << std::endl << e << std::endl;\
- e.name = "error.execution";\
- e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
- e.eventType = Event::PLATFORM;\
- receiveInternal(e);\
- }\
+namespace uscxml {
+
+// msxml.h defines all the DOM types as well
+//using namespace xercesc;
+
+static URL normalizeURL(const std::string url) {
+ URL absUrl(url);
+
+ // this is required for _baseURL to be considered absolute!
+ if (absUrl.scheme() == "" || !absUrl.isAbsolute()) {
+ absUrl = URL::resolveWithCWD(absUrl);
+ }
+ if (absUrl.scheme() == "") {
+ absUrl = URL("file://" + url);
+ }
+ return absUrl;
}
-#define CATCH_AND_DISTRIBUTE2(msg, node) \
-catch (Event e) {\
- std::string xpathPos = DOMUtils::xPathForNode(node); \
- if (rethrow) {\
- throw(e);\
- } else {\
- LOG(ERROR) << msg << " " << xpathPos << ":" << std::endl << e << std::endl;\
- e.name = "error.execution";\
- e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
- e.data.compound["xpath"] = uscxml::Data(xpathPos, uscxml::Data::VERBATIM); \
- e.eventType = Event::PLATFORM;\
- e.dom = node;\
- receiveInternal(e);\
- }\
+Interpreter Interpreter::fromXML(const std::string& xml, const std::string& baseURL) {
+ URL absUrl = normalizeURL(baseURL);
+
+ std::shared_ptr<InterpreterImpl> interpreterImpl(new InterpreterImpl());
+ Interpreter interpreter(interpreterImpl);
+
+ std::unique_ptr<xercesc::XercesDOMParser> parser(new xercesc::XercesDOMParser());
+ std::unique_ptr<xercesc::ErrorHandler> errHandler(new xercesc::HandlerBase());
+
+ try {
+ parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
+ parser->setDoNamespaces(true);
+ parser->useScanner(xercesc::XMLUni::fgWFXMLScanner);
+
+ parser->setErrorHandler(errHandler.get());
+
+ xercesc::MemBufInputSource is((XMLByte*)xml.c_str(), xml.size(), X("fake"));
+ parser->parse(is);
+
+ interpreterImpl->_document = parser->adoptDocument();
+ interpreterImpl->_baseURL = absUrl;
+ InterpreterImpl::addInstance(interpreterImpl);
+
+ } catch (const xercesc::SAXParseException& toCatch) {
+ ERROR_PLATFORM_THROW(X(toCatch.getMessage()).str());
+ } catch (const xercesc::RuntimeException& toCatch) {
+ ERROR_PLATFORM_THROW(X(toCatch.getMessage()).str());
+ } catch (const xercesc::XMLException& toCatch) {
+ ERROR_PLATFORM_THROW(X(toCatch.getMessage()).str());
+ } catch (const xercesc::DOMException& toCatch) {
+ ERROR_PLATFORM_THROW(X(toCatch.getMessage()).str());
+ }
+
+ return interpreter;
}
-namespace uscxml {
+Interpreter Interpreter::fromElement(xercesc::DOMElement* scxml, const std::string& baseURL) {
+ URL absUrl = normalizeURL(baseURL);
+
+ std::shared_ptr<InterpreterImpl> interpreterImpl(new InterpreterImpl());
+ Interpreter interpreter(interpreterImpl);
+
+ // *copy* the given xercesc::DOM to get rid of event listeners
+ xercesc::DOMImplementation* implementation = xercesc::DOMImplementationRegistry::getDOMImplementation(X("core"));
+ interpreterImpl->_document = implementation->createDocument();
+
+ // we need to import the parent - to support xpath test150
+ xercesc::DOMNode* newNode = interpreterImpl->_document->importNode(scxml, true);
+// interpreterImpl->_document->adoptNode(newNode);
+ interpreterImpl->_document->appendChild(newNode);
+
+// std::cerr << *(interpreterImpl->_document);
+
+ interpreterImpl->_baseURL = absUrl;
+
+ InterpreterImpl::addInstance(interpreterImpl);
+ return interpreter;
+}
+
+Interpreter Interpreter::fromDocument(xercesc::DOMDocument* dom, const std::string& baseURL, bool copy) {
+ URL absUrl = normalizeURL(baseURL);
+
+ std::shared_ptr<InterpreterImpl> interpreterImpl(new InterpreterImpl());
+ Interpreter interpreter(interpreterImpl);
+
+ if (copy) {
+ // *copy* the given xercesc::DOM to get rid of event listeners
+ xercesc::DOMImplementation* implementation = xercesc::DOMImplementationRegistry::getDOMImplementation(X("core"));
+ interpreterImpl->_document = implementation->createDocument();
+
+ // we need to import the parent - to support xpath test150
+ xercesc::DOMNode* newNode = interpreterImpl->_document->importNode(dom->getDocumentElement(), true);
+ interpreterImpl->_document->appendChild(newNode);
+
+ } else {
+ interpreterImpl->_document = dom;
+ }
+
+ interpreterImpl->_baseURL = absUrl;
+
+ InterpreterImpl::addInstance(interpreterImpl);
+ return interpreter;
+}
+
+Interpreter Interpreter::fromURL(const std::string& url) {
+ URL absUrl = normalizeURL(url);
+
+ std::shared_ptr<InterpreterImpl> interpreterImpl(new InterpreterImpl());
+ Interpreter interpreter(interpreterImpl);
+
+ std::unique_ptr<xercesc::XercesDOMParser> parser(new xercesc::XercesDOMParser());
+ parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
+ parser->setDoNamespaces(true);
+
+ // we do not have a real schema anyway
+ parser->useScanner(xercesc::XMLUni::fgWFXMLScanner);
+
+ std::unique_ptr<xercesc::ErrorHandler> errHandler(new xercesc::HandlerBase());
+ parser->setErrorHandler(errHandler.get());
+
+
+ try {
+ std::string tmp = absUrl;
+ parser->parse(tmp.c_str());
+ interpreterImpl->_document = parser->adoptDocument();
+ interpreterImpl->_baseURL = absUrl;
+ InterpreterImpl::addInstance(interpreterImpl);
+ }
+
+ catch (const xercesc::SAXParseException& toCatch) {
+ LOG(ERROR) << X(toCatch.getMessage());
+ } catch (const xercesc::RuntimeException& toCatch) {
+ LOG(ERROR) << X(toCatch.getMessage());
+ } catch (const xercesc::XMLException& toCatch) {
+ LOG(ERROR) << X(toCatch.getMessage());
+ } catch (const xercesc::DOMException& toCatch) {
+ LOG(ERROR) << X(toCatch.getMessage());
+ }
+
+ return interpreter;
+
+}
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
+std::recursive_mutex StateTransitionMonitor::_mutex;
+
+static void printNodeSet(const std::list<xercesc::DOMElement*> nodes) {
+ std::string seperator;
+ for (auto nIter = nodes.begin(); nIter != nodes.end(); nIter++) {
+ std::cerr << seperator << (HAS_ATTR(*nIter, "id") ? ATTR(*nIter, "id") : DOMUtils::xPathForNode(*nIter));
+ seperator = ", ";
+ }
+}
+
+void StateTransitionMonitor::beforeTakingTransition(const xercesc::DOMElement* transition) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ std::cerr << "Transition: " << uscxml::DOMUtils::xPathForNode(transition) << std::endl;
+}
+
+void StateTransitionMonitor::onStableConfiguration() {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ std::cerr << "Stable Config: { ";
+ printNodeSet(_interpreter.getConfiguration());
+ std::cerr << " }" << std::endl;
+}
+
+void StateTransitionMonitor::beforeProcessingEvent(const uscxml::Event& event) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ switch (event.eventType) {
+ case uscxml::Event::INTERNAL:
+ std::cerr << "Internal Event: " << event.name << std::endl;
+ break;
+ case uscxml::Event::EXTERNAL:
+ std::cerr << "External Event: " << event.name << std::endl;
+ break;
+ case uscxml::Event::PLATFORM:
+ std::cerr << "Platform Event: " << event.name << std::endl;
+ break;
+ }
+}
+
+void StateTransitionMonitor::beforeExecutingContent(const xercesc::DOMElement* element) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ std::cerr << "Executable Content: " << DOMUtils::xPathForNode(element) << std::endl;
+}
+
+void StateTransitionMonitor::beforeExitingState(const xercesc::DOMElement* state) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ std::cerr << "Exiting: " << (HAS_ATTR(state, "id") ? ATTR(state, "id") : DOMUtils::xPathForNode(state)) << std::endl;
+}
+
+void StateTransitionMonitor::beforeEnteringState(const xercesc::DOMElement* state) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ std::cerr << "Entering: " << (HAS_ATTR(state, "id") ? ATTR(state, "id") : DOMUtils::xPathForNode(state)) << std::endl;
+
+}
+
+void StateTransitionMonitor::beforeMicroStep() {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ std::cerr << "Config: {";
+ printNodeSet(_interpreter.getConfiguration());
+ std::cerr << "}" << std::endl;
+}
void InterpreterOptions::printUsageAndExit(const char* progName) {
// remove path from program name
@@ -169,7 +275,6 @@ void InterpreterOptions::printUsageAndExit(const char* progName) {
#endif
printf("\t-v : be verbose\n");
printf("\t-c : perform some sanity checks on the state-chart\n");
- printf("\t-d : enable debugging via HTTP\n");
printf("\t-lN : set loglevel to N\n");
printf("\t-tN : port for HTTP server\n");
printf("\t-sN : port for HTTPS server\n");
@@ -178,14 +283,6 @@ void InterpreterOptions::printUsageAndExit(const char* progName) {
exit(1);
}
-unsigned int InterpreterOptions::getCapabilities() {
- unsigned int capabilities = CAN_NOTHING;
- if (withHTTP)
- capabilities = capabilities | CAN_GENERIC_HTTP | CAN_BASIC_HTTP;
-
- return capabilities;
-}
-
InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) {
InterpreterOptions options;
optind = 0;
@@ -201,7 +298,6 @@ InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) {
{"public-key", required_argument, 0, 0},
{"plugin-path", required_argument, 0, 'p'},
{"loglevel", required_argument, 0, 'l'},
- {"disable-http", no_argument, 0, 0},
{0, 0, 0, 0}
};
@@ -234,13 +330,13 @@ InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) {
switch(option) {
// cases without short option
case 0: {
- if (boost::equals(longOptions[optionInd].name, "disable-http")) {
+ if (iequals(longOptions[optionInd].name, "disable-http")) {
currOptions->withHTTP = false;
- } else if (boost::equals(longOptions[optionInd].name, "private-key")) {
+ } else if (iequals(longOptions[optionInd].name, "private-key")) {
currOptions->privateKey = optarg;
- } else if (boost::equals(longOptions[optionInd].name, "certificate")) {
+ } else if (iequals(longOptions[optionInd].name, "certificate")) {
currOptions->certificate = optarg;
- } else if (boost::equals(longOptions[optionInd].name, "public-key")) {
+ } else if (iequals(longOptions[optionInd].name, "public-key")) {
currOptions->publicKey = optarg;
}
break;
@@ -252,11 +348,8 @@ InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) {
case 'p':
currOptions->pluginPath = optarg;
break;
- case 'd':
- currOptions->withDebugger = true;
- break;
case 'c':
- currOptions->checking = true;
+ currOptions->validate = true;
break;
case 't':
currOptions->httpPort = strTo<unsigned short>(optarg);
@@ -298,3343 +391,11 @@ InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) {
DONE_PARSING_CMD:
- if (options.interpreters.size() == 0 && !options.withDebugger)
+ if (options.interpreters.size() == 0)
options.error = "No SCXML document to evaluate";
return options;
}
-void NameSpaceInfo::init(const std::map<std::string, std::string>& namespaceInfo) {
- nsInfo = namespaceInfo;
- nsURL = "";
- if (nsContext)
- delete nsContext;
- nsContext = new Arabica::XPath::StandardNamespaceContext<std::string>();
-
- std::map<std::string, std::string>::const_iterator nsIter = namespaceInfo.begin();
- while(nsIter != namespaceInfo.end()) {
- std::string url = nsIter->first;
- std::string prefix = nsIter->second;
- if (iequals(url, "http://www.w3.org/2005/07/scxml")) {
- nsURL = url;
- if (prefix.size() == 0) {
- xpathPrefix = "scxml:";
- nsContext->addNamespaceDeclaration(url, "scxml");
- } else {
- xpathPrefix = prefix + ":";
- xmlNSPrefix = xpathPrefix;
- nsContext->addNamespaceDeclaration(url, prefix);
- nsToPrefix[url] = prefix;
- }
- } else {
- nsContext->addNamespaceDeclaration(url, prefix);
- nsToPrefix[url] = prefix;
- }
- nsIter++;
- }
-}
-
-void StateTransitionMonitor::beforeTakingTransition(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::cerr << "Transition: " << uscxml::DOMUtils::xPathForNode(transition) << std::endl;
-}
-
-void StateTransitionMonitor::onStableConfiguration(uscxml::Interpreter interpreter) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::cerr << "Config: {";
- printNodeSet(interpreter.getConfiguration());
- std::cerr << "}" << std::endl;
-}
-
-void StateTransitionMonitor::beforeProcessingEvent(uscxml::Interpreter interpreter, const uscxml::Event& event) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- switch (event.eventType) {
- case uscxml::Event::INTERNAL:
- std::cerr << "Internal Event: " << event.name << std::endl;
- break;
- case uscxml::Event::EXTERNAL:
- std::cerr << "External Event: " << event.name << std::endl;
- break;
- case uscxml::Event::PLATFORM:
- std::cerr << "Platform Event: " << event.name << std::endl;
- break;
- }
-}
-
-void StateTransitionMonitor::beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::cerr << "Executable Content: " << DOMUtils::xPathForNode(element) << std::endl;
-}
-
-void StateTransitionMonitor::beforeExitingState(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- exitingStates.push_back(state);
- if (!moreComing) {
- std::cerr << "Exiting: {";
- printNodeSet(exitingStates);
- std::cerr << "}" << std::endl;
- exitingStates = Arabica::XPath::NodeSet<std::string>();
- }
-}
-
-void StateTransitionMonitor::beforeEnteringState(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- enteringStates.push_back(state);
- if (!moreComing) {
- std::cerr << "Entering: {";
- printNodeSet(enteringStates);
- std::cerr << "}" << std::endl;
- enteringStates = Arabica::XPath::NodeSet<std::string>();
- }
-
-}
-
-void StateTransitionMonitor::beforeMicroStep(uscxml::Interpreter interpreter) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::cerr << "Config: {";
- printNodeSet(interpreter.getConfiguration());
- std::cerr << "}" << std::endl;
-}
-
-void StateTransitionMonitor::printNodeSet(const Arabica::XPath::NodeSet<std::string>& config) {
- std::string seperator;
- for (size_t i = 0; i < config.size(); i++) {
- std::cerr << seperator << ATTR_CAST(config[i], "id");
- seperator = ", ";
- }
-}
-tthread::recursive_mutex StateTransitionMonitor::_mutex;
-
-std::map<std::string, boost::weak_ptr<InterpreterImpl> > Interpreter::_instances;
-tthread::recursive_mutex Interpreter::_instanceMutex;
-
-std::map<std::string, boost::weak_ptr<InterpreterImpl> > Interpreter::getInstances() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
- std::map<std::string, boost::weak_ptr<InterpreterImpl> >::iterator instIter = _instances.begin();
- while(instIter != _instances.end()) {
- if (!instIter->second.lock()) {
- _instances.erase(instIter++);
- } else {
- instIter++;
- }
- }
- return _instances;
-}
-
-void Interpreter::addInstance(boost::shared_ptr<InterpreterImpl> interpreterImpl) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
- assert(_instances.find(interpreterImpl->getSessionId()) == _instances.end());
- _instances[interpreterImpl->getSessionId()] = interpreterImpl;
-}
-
-InterpreterImpl::InterpreterImpl() {
- _state = USCXML_INSTANTIATED;
-
- _lastRunOnMainThread = 0;
- _thread = NULL;
- _isStarted = false;
- _isRunning = false;
- _sendQueue = NULL;
- _parentQueue = NULL;
- _topLevelFinalReached = false;
- _stable = false;
- _isInitialized = false;
- _userSuppliedDataModel = false;
- _domIsSetup = false;
- _httpServlet = NULL;
- _factory = NULL;
- _sessionId = UUID::getUUID();
- _capabilities = CAN_BASIC_HTTP | CAN_GENERIC_HTTP;
- _domEventListener._interpreter = this;
-
-#ifdef _WIN32
- WSADATA wsaData;
- WSAStartup(MAKEWORD(2, 2), &wsaData);
-#endif
-}
-
-Interpreter Interpreter::fromDOM(const Arabica::DOM::Document<std::string>& dom, const NameSpaceInfo& nameSpaceInfo, const std::string& sourceURL) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
- boost::shared_ptr<INTERPRETER_IMPL> interpreterImpl = boost::shared_ptr<INTERPRETER_IMPL>(new INTERPRETER_IMPL);
- Interpreter interpreter(interpreterImpl);
-
- // *copy* the given DOM to get rid of event listeners
-
- DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- interpreterImpl->_document = domFactory.createDocument(dom.getNamespaceURI(), "", 0);
-
- Node<std::string> child = dom.getFirstChild();
- while (child) {
- Node<std::string> newNode = interpreterImpl->_document.importNode(child, true);
- interpreterImpl->_document.appendChild(newNode);
- child = child.getNextSibling();
- }
-
- interpreterImpl->setNameSpaceInfo(nameSpaceInfo);
- interpreterImpl->setupDOM();
-
-// interpreterImpl->init();
- _instances[interpreterImpl->getSessionId()] = interpreterImpl;
- return interpreter;
-}
-
-Interpreter Interpreter::fromXML(const std::string& xml, const std::string& sourceURL) {
- std::stringstream* ss = new std::stringstream();
- (*ss) << xml;
- // we need an auto_ptr for arabica to assume ownership
- std::auto_ptr<std::istream> ssPtr(ss);
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setByteStream(ssPtr);
- return fromInputSource(&inputSource, sourceURL);
-}
-
-
-Interpreter Interpreter::fromURL(const std::string& url) {
- URL absUrl(url);
- if (!absUrl.isAbsolute()) {
- if (!absUrl.toAbsoluteCwd()) {
- ERROR_COMMUNICATION_THROW("URL is not absolute or does not have file schema");
- }
- }
-
- Interpreter interpreter;
-
- if (iequals(absUrl.scheme(), "file")) {
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setSystemId(absUrl.asString());
- interpreter = fromInputSource(&inputSource, absUrl);
- } else {
- // use curl for everything !file - even for http as arabica won't follow redirects
- std::stringstream ss;
- ss << absUrl;
- if (absUrl.downloadFailed()) {
- ERROR_COMMUNICATION_THROW("Downloading SCXML document from '" + absUrl.asString() + "' failed");
- }
- interpreter = fromXML(ss.str(), absUrl);
- }
-
- // try to establish URL root for relative src attributes in document
- if (!interpreter) {
- ERROR_PLATFORM_THROW("Cannot create interpreter from URL '" + absUrl.asString() + "'");
- }
- return interpreter;
-}
-
-Interpreter Interpreter::fromInputSource(void* source, const std::string& sourceURL) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
-
- Arabica::SAX::InputSource<std::string> sourceRef = *(Arabica::SAX::InputSource<std::string>*)source;
- // remove old instances
- std::map<std::string, boost::weak_ptr<InterpreterImpl> >::iterator instIter = _instances.begin();
- while(instIter != _instances.end()) {
- if (!instIter->second.lock()) {
- _instances.erase(instIter++);
- } else {
- instIter++;
- }
- }
-
- boost::shared_ptr<INTERPRETER_IMPL> interpreterImpl = boost::shared_ptr<INTERPRETER_IMPL>(new INTERPRETER_IMPL);
- Interpreter interpreter(interpreterImpl);
- _instances[interpreterImpl->getSessionId()] = interpreterImpl;
-
- NameSpacingParser parser;
- if (parser.parse(sourceRef) && parser.getDocument() && parser.getDocument().hasChildNodes()) {
- interpreterImpl->setNameSpaceInfo(parser.nameSpace);
- interpreterImpl->_document = parser.getDocument();
- interpreterImpl->_sourceURL = sourceURL;
-
- interpreterImpl->setupDOM();
- } else {
- if (parser.errorsReported()) {
- ERROR_PLATFORM_THROW(parser.errors())
- } else {
- ERROR_PLATFORM_THROW("Failed to create interpreter from " + sourceURL);
-// interpreterImpl->setInterpreterState(USCXML_FAULTED, parser.errors());
- }
- }
- return interpreter;
-}
-
-Interpreter Interpreter::fromClone(const Interpreter& other) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
-
- boost::shared_ptr<INTERPRETER_IMPL> interpreterImpl = boost::shared_ptr<INTERPRETER_IMPL>(new INTERPRETER_IMPL);
- interpreterImpl->cloneFrom(other.getImpl());
- Interpreter interpreter(interpreterImpl);
-
- addInstance(interpreterImpl);
- return interpreter;
-}
-
-void InterpreterImpl::writeTo(std::ostream& stream) {
- stream << getDocument();
-}
-
-void InterpreterImpl::cloneFrom(InterpreterImpl* other) {
- if (other->getDocument()) {
- const Arabica::DOM::Document<std::string>& otherDoc = other->_document;
- DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- _document = domFactory.createDocument(otherDoc.getNamespaceURI(), "", 0);
-
- Node<std::string> child = otherDoc.getFirstChild();
- while (child) {
- Node<std::string> newNode = _document.importNode(child, true);
- _document.appendChild(newNode);
- child = child.getNextSibling();
- }
-
- setNameSpaceInfo(other->_nsInfo);
-
- _baseURL = other->_baseURL;
- _sourceURL = other->_sourceURL;
-
- setupDOM();
- }
-}
-
-void InterpreterImpl::cloneFrom(boost::shared_ptr<InterpreterImpl> other) {
- cloneFrom(other.get());
-}
-
-void InterpreterImpl::setName(const std::string& name) {
- _name = name;
-}
-
-InterpreterImpl::~InterpreterImpl() {
- {
- // make sure we are done with setting up with early abort
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- stop(); // unset started bit
-
- setInterpreterState(USCXML_DESTROYED);
-
- // unblock event queue
- Event event;
- event.name = "unblock.and.die";
- receive(event);
-
- }
-// std::cerr << "stopped " << this << std::endl;
-// tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- if (_thread) {
- _thread->join();
- delete(_thread);
- }
-
- if (_sendQueue)
- delete _sendQueue;
-
-}
-
-void InterpreterImpl::start() {
- _isStarted = true;
- _thread = new tthread::thread(InterpreterImpl::run, this);
-}
-
-void InterpreterImpl::stop() {
- _isStarted = false;
-}
-
-void InterpreterImpl::join() {
- stop();
- if (_thread != NULL) _thread->join();
-};
-
-bool InterpreterImpl::isRunning() {
- return _isRunning && !_topLevelFinalReached;
-}
-
-void InterpreterImpl::run(void* instance) {
- InterpreterImpl* interpreter = ((InterpreterImpl*)instance);
- interpreter->_isRunning = true;
-
- try {
- InterpreterState state;
- while(interpreter->_isStarted) {
- state = interpreter->step(-1);
-
- switch (state) {
- case uscxml::USCXML_FINISHED:
- case uscxml::USCXML_DESTROYED:
- // return as we finished
- goto DONE_THREAD;
- default:
- break;
- }
- }
- } catch (Event e) {
- LOG(ERROR) << e;
- } catch(std::exception e) {
- LOG(ERROR) << "InterpreterImpl::run catched an exception: " << e.what() << std::endl << "Unclean shutdown";
- } catch (...) {
- LOG(ERROR) << "InterpreterImpl::run catched unknown exception";
- }
-DONE_THREAD:
- ((InterpreterImpl*)instance)->_isRunning = false;
- ((InterpreterImpl*)instance)->_isStarted = false;
-}
-
-void InterpreterImpl::exitInterpreter() {
- NodeSet<std::string> statesToExit = _configuration;
- statesToExit.forward(false);
- statesToExit.sort();
-
- for (size_t i = 0; i < statesToExit.size(); i++) {
- Arabica::XPath::NodeSet<std::string> onExitElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onexit", statesToExit[i]);
- for (size_t j = 0; j < onExitElems.size(); j++) {
- executeContent(Element<std::string>(onExitElems[j]));
- }
- Arabica::XPath::NodeSet<std::string> invokeElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", statesToExit[i]);
- // TODO: we ought to cancel all remaining invokers just to be sure with the persist extension
- for (size_t j = 0; j < invokeElems.size(); j++) {
- cancelInvoke(Element<std::string>(invokeElems[j]));
- }
- Element<std::string> stateElem(statesToExit[i]);
- if (isFinal(stateElem) && parentIsScxmlState(stateElem)) {
- returnDoneEvent(statesToExit[i]);
- }
- }
- _configuration = NodeSet<std::string>();
-}
-
-
-InterpreterState InterpreterImpl::interpret() {
- InterpreterState state;
- while(true) {
- state = step(-1);
-
- switch (state) {
- case uscxml::USCXML_FINISHED:
- case uscxml::USCXML_DESTROYED:
- // return as we finished
- return state;
- default:
-
- // process invokers on main thread
- if(_thread == NULL) {
- runOnMainThread(200);
- }
-
- // process next step
- break;
- }
- }
- return state;
-}
-
-// setup / fetch the documents initial transitions
-NodeSet<std::string> InterpreterImpl::getDocumentInitialTransitions() {
- NodeSet<std::string> initialTransitions;
-
- if (_startConfiguration.size() > 0) {
- // we emulate entering a given configuration by creating a pseudo deep history
- Element<std::string> initHistory = _document.createElementNS(_nsInfo.nsURL, "history");
- _nsInfo.setPrefix(initHistory);
-
- initHistory.setAttribute("id", UUID::getUUID());
- initHistory.setAttribute("type", "deep");
- _scxml.insertBefore(initHistory, _scxml.getFirstChild());
-
- std::string histId = ATTR(initHistory, "id");
- NodeSet<std::string> histStates;
- for (std::list<std::string>::const_iterator stateIter = _startConfiguration.begin(); stateIter != _startConfiguration.end(); stateIter++) {
- histStates.push_back(getState(*stateIter));
- }
- _historyValue[histId] = histStates;
-
- Element<std::string> initialElem = _document.createElementNS(_nsInfo.nsURL, "initial");
- _nsInfo.setPrefix(initialElem);
-
- initialElem.setAttribute("generated", "true");
- Element<std::string> transitionElem = _document.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(transitionElem);
-
- transitionElem.setAttribute("target", histId);
- initialElem.appendChild(transitionElem);
- _scxml.appendChild(initialElem);
- initialTransitions.push_back(transitionElem);
-
- } else {
- // try to get initial transition from initial element
- initialTransitions = _xpath.evaluate("/" + _nsInfo.xpathPrefix + "scxml/"+ _nsInfo.xpathPrefix + "initial/" + _nsInfo.xpathPrefix + "transition", _scxml).asNodeSet();
- if (initialTransitions.size() == 0) {
- Arabica::XPath::NodeSet<std::string> initialStates;
- // fetch per draft
- initialStates = getInitialStates();
- assert(initialStates.size() > 0);
- for (size_t i = 0; i < initialStates.size(); i++) {
- Element<std::string> initialElem = _document.createElementNS(_nsInfo.nsURL, "initial");
- _nsInfo.setPrefix(initialElem);
-
- initialElem.setAttribute("generated", "true");
- Element<std::string> transitionElem = _document.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(transitionElem);
-
- transitionElem.setAttribute("target", ATTR_CAST(initialStates[i], "id"));
- initialElem.appendChild(transitionElem);
- _scxml.appendChild(initialElem);
- initialTransitions.push_back(transitionElem);
- }
- }
- }
- return initialTransitions;
-}
-
-InterpreterState InterpreterImpl::step(int waitForMS) {
- try {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- if (_state == USCXML_FINISHED || _state == USCXML_DESTROYED) {
- return _state;
- }
-
- NodeSet<std::string> enabledTransitions;
-
- // setup document and interpreter
- if (!_isInitialized) {
- init(); // will throw
- return _state;
- }
-
- if (_configuration.size() == 0) {
- // goto initial configuration
- NodeSet<std::string> initialTransitions = getDocumentInitialTransitions();
- assert(initialTransitions.size() > 0);
-#if VERBOSE
- std::cerr << _name << ": initialTransitions: " << std::endl;
- for (size_t i = 0; i < initialTransitions.size(); i++) {
- std::cerr << initialTransitions[i] << std::endl;
- }
- std::cerr << std::endl;
-#endif
-
- // this is not mentionend in the standard, though it makes sense
- for (size_t i = 0; i < initialTransitions.size(); i++) {
- Element<std::string> transition(initialTransitions[i]);
- USCXML_MONITOR_CALLBACK3(beforeTakingTransition, transition, (i + 1 < enabledTransitions.size()))
- executeContent(transition);
- USCXML_MONITOR_CALLBACK3(afterTakingTransition, transition, (i + 1 < enabledTransitions.size()))
- }
-
- enterStates(initialTransitions);
- setInterpreterState(USCXML_MICROSTEPPED);
- }
-
- assert(isLegalConfiguration(_configuration));
-
- // are there spontaneous transitions?
- if (!_stable) {
- enabledTransitions = selectEventlessTransitions();
- if (!enabledTransitions.empty()) {
- // test 403b
- enabledTransitions.to_document_order();
- microstep(enabledTransitions);
-
- setInterpreterState(USCXML_MICROSTEPPED);
-
- // check whether we run in cycles
- FlatStateIdentifier flat(_configuration, _alreadyEntered, _historyValue);
- if (_microstepConfigurations.find(flat.getStateId()) != _microstepConfigurations.end()) {
- USCXML_MONITOR_CALLBACK2(reportIssue,
- InterpreterIssue("Reentering during microstep " + flat.getFlatActive() + " - possible endless loop",
- Arabica::DOM::Node<std::string>(),
- InterpreterIssue::USCXML_ISSUE_WARNING));
- }
- _microstepConfigurations.insert(flat.getStateId());
-
- return _state;
- }
- _stable = true;
- }
-
- // test415
- if (_topLevelFinalReached)
- goto EXIT_INTERPRETER;
-
- // process internal event
- if (!_internalQueue.empty()) {
- _currEvent = _internalQueue.front();
- _internalQueue.pop_front();
- _stable = false;
-
- USCXML_MONITOR_CALLBACK2(beforeProcessingEvent, _currEvent)
-
- _dataModel.setEvent(_currEvent);
- enabledTransitions = selectTransitions(_currEvent.name);
-
- if (!enabledTransitions.empty()) {
- // test 403b
- enabledTransitions.to_document_order();
- microstep(enabledTransitions);
- }
-
- // test 319 - even if we do not enable transitions, consider it a microstep
- setInterpreterState(USCXML_MICROSTEPPED);
- return _state;
-
- } else {
- _stable = true;
- _microstepConfigurations.clear();
- }
-
- if (_state != USCXML_MACROSTEPPED && _state != USCXML_IDLE)
- USCXML_MONITOR_CALLBACK(onStableConfiguration)
-
- setInterpreterState(USCXML_MACROSTEPPED);
-
- if (_topLevelFinalReached)
- goto EXIT_INTERPRETER;
-
-
- // when we reach a stable configuration, invoke
- for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- Element<std::string> invokeElem = Element<std::string>(invokes[j]);
- if (!HAS_ATTR(invokeElem, "persist") || !stringIsTrue(ATTR(invokeElem, "persist"))) {
- invoke(invokeElem);
- }
- }
- }
- _statesToInvoke = NodeSet<std::string>();
-
- if (_externalQueue.isEmpty()) {
- setInterpreterState(USCXML_IDLE);
-
- if (waitForMS < 0) {
- // wait blockingly for an event forever
- while(_externalQueue.isEmpty()) {
- _condVar.wait(_mutex);
- }
- }
-
- if (waitForMS > 0) {
- // wait given number of milliseconds max
- uint64_t now = tthread::chrono::system_clock::now();
- uint64_t then = now + waitForMS;
- while(_externalQueue.isEmpty() && now < then) {
- _condVar.wait_for(_mutex, then - now);
- now = tthread::chrono::system_clock::now();
- }
- }
-
- if (_externalQueue.isEmpty()) {
- return _state;
- }
-
- if (_state == USCXML_FINISHED || _state == USCXML_DESTROYED) {
- return _state;
- }
-
- setInterpreterState(USCXML_MACROSTEPPED);
- }
-
- _currEvent = _externalQueue.pop();
- _currEvent.eventType = Event::EXTERNAL; // make sure it is set to external
- _stable = false;
-
- if (_topLevelFinalReached)
- goto EXIT_INTERPRETER;
-
- USCXML_MONITOR_CALLBACK2(beforeProcessingEvent, _currEvent)
-
- if (iequals(_currEvent.name, "cancel.invoke." + _sessionId)) {
- goto EXIT_INTERPRETER;
- }
-
- try {
- _dataModel.setEvent(_currEvent);
- } catch (Event e) {
- LOG(ERROR) << "Syntax error while setting external event:" << std::endl << e << std::endl << _currEvent;
- }
-
- finalizeAndAutoForwardCurrentEvent();
-
- // run internal processing until we reach a stable configuration again
- enabledTransitions = selectTransitions(_currEvent.name);
- if (!enabledTransitions.empty()) {
- // test 403b
- enabledTransitions.to_document_order();
- microstep(enabledTransitions);
- }
-
- if (_topLevelFinalReached)
- goto EXIT_INTERPRETER;
-
- return _state;
-
-EXIT_INTERPRETER:
- USCXML_MONITOR_CALLBACK(beforeCompletion)
-
- exitInterpreter();
- if (_sendQueue) {
- _sendQueue->stop();
- std::map<std::string, std::pair<InterpreterImpl*, SendRequest> >::iterator sendIter = _sendIds.begin();
- while(sendIter != _sendIds.end()) {
- _sendQueue->cancelEvent(sendIter->first);
- sendIter++;
- }
- _sendQueue->start();
- }
-
- USCXML_MONITOR_CALLBACK(afterCompletion)
-
- // assert(hasLegalConfiguration());
- setInterpreterState(USCXML_FINISHED);
- _mutex.unlock();
-
- // remove datamodel
-// if(!_userSuppliedDataModel)
-// _dataModel = DataModel();
-
- return _state;
- } catch (boost::bad_weak_ptr e) {
- LOG(ERROR) << "Unclean shutdown " << std::endl << std::endl;
- setInterpreterState(USCXML_DESTROYED);
- return _state;
- }
-
- // set datamodel to null from this thread
- if(_dataModel)
- _dataModel = DataModel();
-
-}
-
-void InterpreterImpl::microstep(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
-
- USCXML_MONITOR_CALLBACK(beforeMicroStep)
-
- exitStates(enabledTransitions);
-
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- Element<std::string> transition(enabledTransitions[i]);
-
- USCXML_MONITOR_CALLBACK3(beforeTakingTransition, transition, (i + 1 < enabledTransitions.size()))
-
- executeContent(transition);
-
- USCXML_MONITOR_CALLBACK3(afterTakingTransition, transition, (i + 1 < enabledTransitions.size()))
- }
-
- enterStates(enabledTransitions);
-
- USCXML_MONITOR_CALLBACK(afterMicroStep)
-
-}
-
-// process transitions until we are in a stable configuration again
-void InterpreterImpl::stabilize() {
-
- NodeSet<std::string> enabledTransitions;
- _stable = false;
-
- if (_configuration.size() == 0) {
- // goto initial configuration
- NodeSet<std::string> initialTransitions = getDocumentInitialTransitions();
- assert(initialTransitions.size() > 0);
- enterStates(initialTransitions);
- }
-
- std::set<std::string> configurationsSeen;
-
- do { // process microsteps for enabled transitions until there are no more left
-
- enabledTransitions = selectEventlessTransitions();
-
- if (enabledTransitions.size() == 0) {
- if (_internalQueue.size() == 0) {
- _stable = true;
- } else {
- _currEvent = _internalQueue.front();
- _internalQueue.pop_front();
-#if VERBOSE
- std::cerr << "Received internal event " << _currEvent.name << std::endl;
-#endif
-
- USCXML_MONITOR_CALLBACK2(beforeProcessingEvent, _currEvent)
-
- if (_dataModel)
- _dataModel.setEvent(_currEvent);
- enabledTransitions = selectTransitions(_currEvent.name);
- }
- }
-
- if (!enabledTransitions.empty()) {
- // test 403b
- enabledTransitions.to_document_order();
- microstep(enabledTransitions);
- }
- } while(!_internalQueue.empty() || !_stable);
-
- USCXML_MONITOR_CALLBACK(onStableConfiguration)
-
- // when we reach a stable configuration, invoke
- for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- Element<std::string> invokeElem = Element<std::string>(invokes[j]);
- if (!HAS_ATTR(invokeElem, "persist") || !stringIsTrue(ATTR(invokeElem, "persist"))) {
- invoke(invokeElem);
- }
- }
- }
- _statesToInvoke = NodeSet<std::string>();
-}
-
-#if 0
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::selectTransitions(const std::string& event) {
- Arabica::XPath::NodeSet<std::string> enabledTransitions;
-
- NodeSet<std::string> states;
- for (unsigned int i = 0; i < _configuration.size(); i++) {
- if (isAtomic(Element<std::string>(_configuration[i])))
- states.push_back(_configuration[i]);
- }
- states.to_document_order();
-
- unsigned int index = 0;
- while(states.size() > index) {
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", states[index]);
- for (unsigned int k = 0; k < transitions.size(); k++) {
- if (isEnabledTransition(Element<std::string>(transitions[k]), event)) {
- enabledTransitions.push_back(transitions[k]);
- goto LOOP;
- }
- }
- {
- Node<std::string> parent = states[index].getParentNode();
- if (parent) {
- states.push_back(parent);
- }
- }
-LOOP:
- index++;
- }
-
- enabledTransitions = removeConflictingTransitions(enabledTransitions);
- return enabledTransitions;
-}
-
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::selectEventlessTransitions() {
- Arabica::XPath::NodeSet<std::string> enabledTransitions;
-
- NodeSet<std::string> states;
- for (unsigned int i = 0; i < _configuration.size(); i++) {
- if (isAtomic(Element<std::string>(_configuration[i])))
- states.push_back(_configuration[i]);
- }
- states.to_document_order();
-
- unsigned int index = 0;
- while(states.size() > index) {
- bool foundTransition = false;
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", states[index]);
- for (unsigned int k = 0; k < transitions.size(); k++) {
- Element<std::string> transElem(transitions[k]);
- if (!HAS_ATTR(transElem, "event") && hasConditionMatch(transElem)) {
- enabledTransitions.push_back(transitions[k]);
- foundTransition = true;
- goto LOOP;
- }
- }
- if (!foundTransition) {
- Node<std::string> parent = states[index].getParentNode();
- if (parent) {
- states.push_back(parent);
- }
- }
-LOOP:
- index++;
- }
-
-#if VERBOSE
- std::cerr << "Enabled eventless transitions: " << std::endl;
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- std::cerr << enabledTransitions[i] << std::endl << "----" << std::endl;
- }
- std::cerr << std::endl;
-#endif
-
- enabledTransitions = removeConflictingTransitions(enabledTransitions);
- return enabledTransitions;
-}
-
-#else
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::selectTransitions(const std::string& event) {
- Arabica::XPath::NodeSet<std::string> enabledTransitions;
-
- NodeSet<std::string> atomicStates;
- for (unsigned int i = 0; i < _configuration.size(); i++) {
- if (isAtomic(Element<std::string>(_configuration[i])))
- atomicStates.push_back(_configuration[i]);
- }
- atomicStates.to_document_order();
-
- for (unsigned int i = 0; i < atomicStates.size(); i++) {
- Element<std::string> state(atomicStates[i]);
- while(true) {
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state);
- for (unsigned int k = 0; k < transitions.size(); k++) {
- if (isEnabledTransition(Element<std::string>(transitions[k]), event)) {
- enabledTransitions.push_back(transitions[k]);
- goto NEXT_ATOMIC;
- }
- }
- if (state.getParentNode() && state.getParentNode().getNodeType() == Node_base::ELEMENT_NODE) {
- state = Element<std::string>(state.getParentNode());
- } else {
- goto NEXT_ATOMIC;
- }
- }
-NEXT_ATOMIC:
- ;
- }
-
-#if 0
- std::cerr << "Enabled transitions for '" << event << "': " << std::endl;
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- std::cerr << enabledTransitions[i] << std::endl << "----" << std::endl;
- }
- std::cerr << std::endl;
-#endif
-
- enabledTransitions = removeConflictingTransitions(enabledTransitions);
-
-#if 0
- std::cerr << "Non-conflicting transitions for '" << event << "': " << std::endl;
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- std::cerr << enabledTransitions[i] << std::endl << "----" << std::endl;
- }
- std::cerr << std::endl;
-#endif
-
- return enabledTransitions;
-}
-
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::selectEventlessTransitions() {
-
- Arabica::XPath::NodeSet<std::string> enabledTransitions;
-
- NodeSet<std::string> atomicStates;
- for (unsigned int i = 0; i < _configuration.size(); i++) {
- if (isAtomic(Element<std::string>(_configuration[i])))
- atomicStates.push_back(_configuration[i]);
- }
- atomicStates.to_document_order();
-
- for (unsigned int i = 0; i < atomicStates.size(); i++) {
- Element<std::string> state(atomicStates[i]);
- while(true) {
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state);
- for (unsigned int k = 0; k < transitions.size(); k++) {
- Element<std::string> transElem(transitions[k]);
- if (!HAS_ATTR(transElem, "event") && hasConditionMatch(transElem)) {
- enabledTransitions.push_back(transitions[k]);
- goto NEXT_ATOMIC;
- }
- }
- if (state.getParentNode() && state.getParentNode().getNodeType() == Node_base::ELEMENT_NODE) {
- state = Element<std::string>(state.getParentNode());
- } else {
- goto NEXT_ATOMIC;
- }
- }
-NEXT_ATOMIC:
- ;
- }
-
-#if 0
- std::cerr << "Enabled eventless transitions: " << std::endl;
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- std::cerr << enabledTransitions[i] << std::endl << "----" << std::endl;
- }
- std::cerr << std::endl;
-#endif
-
- enabledTransitions = removeConflictingTransitions(enabledTransitions);
- return enabledTransitions;
-}
-
-
-#endif
-
-bool InterpreterImpl::isEnabledTransition(const Element<std::string>& transition, const std::string& event) {
- std::string eventName;
- if (HAS_ATTR(transition, "event")) {
- eventName = ATTR(transition, "event");
- } else if(HAS_ATTR(transition, "eventexpr")) {
- if (_dataModel) {
- eventName = _dataModel.evalAsString(ATTR(transition, "eventexpr"));
- } else {
- LOG(ERROR) << "Transition has eventexpr attribute with no datamodel defined";
- return false;
- }
- } else {
- return false;
- }
-
- std::list<std::string> eventNames = tokenize(eventName);
- std::list<std::string>::iterator eventIter = eventNames.begin();
- while(eventIter != eventNames.end()) {
- if(nameMatch(*eventIter, event) && hasConditionMatch(transition)) {
- return true;
- }
- eventIter++;
- }
- return false;
-}
-
-
-InterpreterState InterpreterImpl::getInterpreterState() {
- return _state;
-}
-
-void InterpreterImpl::setInterpreterState(InterpreterState newState) {
- switch (_state) {
- case USCXML_INSTANTIATED:
- if (VALID_FROM_INSTANTIATED(newState))
- break;
- assert(false);
- break;
- case USCXML_INITIALIZED:
- if (VALID_FROM_INITIALIZED(newState))
- break;
- assert(false);
- break;
- case USCXML_MICROSTEPPED:
- if (VALID_FROM_MICROSTEPPED(newState))
- break;
- assert(false);
- break;
- case USCXML_MACROSTEPPED:
- if (VALID_FROM_MACROSTEPPED(newState))
- break;
- assert(false);
- break;
- case USCXML_IDLE:
- if (VALID_FROM_IDLE(newState))
- break;
- assert(false);
- break;
- case USCXML_FINISHED:
- if (VALID_FROM_FINISHED(newState))
- break;
- assert(false);
- break;
- default:
- assert(false);
- break;
- }
-
- _state = newState;
-}
-
-bool InterpreterImpl::runOnMainThread(int fps, bool blocking) {
- if (_state == USCXML_FINISHED || _state == USCXML_DESTROYED || !_isStarted)
- return false;
-
- if (fps > 0) {
- if (blocking && _lastRunOnMainThread > 0) {
- uint64_t nextRun = _lastRunOnMainThread + (1000 / fps);
- while(nextRun > tthread::timeStamp()) {
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(nextRun - tthread::timeStamp()));
- }
- } else {
- _lastRunOnMainThread = tthread::timeStamp();
- return true;
- }
- }
-
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- _lastRunOnMainThread = tthread::timeStamp();
-
- {
- tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
- std::map<std::string, IOProcessor>::iterator ioProcessorIter = _ioProcessors.begin();
- while(ioProcessorIter != _ioProcessors.end()) {
- ioProcessorIter->second.runOnMainThread();
- ioProcessorIter++;
- }
- std::map<std::string, Invoker>::iterator invokerIter = _invokers.begin();
- while(invokerIter != _invokers.end()) {
- invokerIter->second.runOnMainThread();
- invokerIter++;
- }
- }
- return (_thread != NULL);
-}
-
-void InterpreterImpl::reset() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- if (_sendQueue) {
- _sendQueue->stop();
- std::map<std::string, std::pair<InterpreterImpl*, SendRequest> >::iterator sendIter = _sendIds.begin();
- while(sendIter != _sendIds.end()) {
- _sendQueue->cancelEvent(sendIter->first);
- _sendIds.erase(sendIter++);
- }
- _sendQueue->start();
- }
- std::map<std::string, Invoker>::iterator invokeIter = _invokers.begin();
- while(invokeIter != _invokers.end()) {
- invokeIter->second.uninvoke();
- _invokers.erase(invokeIter++);
- }
-
- _externalQueue.clear();
- _internalQueue.clear();
- _historyValue.clear();
-
- _currEvent = Event();
- _alreadyEntered = NodeSet<std::string>();
- _configuration = NodeSet<std::string>();
- _topLevelFinalReached = false;
- _isInitialized = false;
- _stable = false;
-
- _dataModel = DataModel();
- setInterpreterState(USCXML_INSTANTIATED);
-}
-
-std::list<InterpreterIssue> InterpreterImpl::validate() {
- return InterpreterIssue::forInterpreter(this);
-}
-
-std::ostream& operator<< (std::ostream& os, const InterpreterIssue& issue) {
- switch (issue.severity) {
- case InterpreterIssue::USCXML_ISSUE_FATAL:
- os << "Issue (FATAL) ";
- break;
- case InterpreterIssue::USCXML_ISSUE_WARNING:
- os << "Issue (WARNING) ";
- break;
- case InterpreterIssue::USCXML_ISSUE_INFO:
- os << "Issue (INFO) ";
- break;
- default:
- break;
- }
-
- if (issue.xPath.size() > 0) {
- os << "at " << issue.xPath << ": ";
- } else {
- os << ": ";
- }
- os << issue.message;
- return os;
-}
-
-void InterpreterImpl::setupDOM() {
- if (_domIsSetup)
- return;
-
- if (!_document) {
- ERROR_PLATFORM_THROW("Interpreter has no DOM");
- }
-
- resolveXIncludes();
-
- // find scxml element
- if (!_scxml) {
- NodeList<std::string> scxmls;
- if (_nsInfo.nsURL.size() == 0) {
- scxmls = _document.getElementsByTagName("scxml");
- } else {
- scxmls = _document.getElementsByTagNameNS(_nsInfo.nsURL, "scxml");
- }
-
- if (scxmls.getLength() == 0) {
- ERROR_PLATFORM_THROW("Cannot find SCXML element in DOM");
- }
-
- _scxml = (Arabica::DOM::Element<std::string>)scxmls.item(0);
- _baseURL[_scxml] = URL::asBaseURL(_sourceURL);
- }
-
- _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
-
- if (_nsInfo.getNSContext() != NULL)
- _xpath.setNamespaceContext(*_nsInfo.getNSContext());
-
- // normalize document
-
- // make sure every state has an id - not required per spec, but needed for us
- Arabica::XPath::NodeSet<std::string> states = getAllStates();
- for (size_t i = 0; i < states.size(); i++) {
- Arabica::DOM::Element<std::string> stateElem = Arabica::DOM::Element<std::string>(states[i]);
- if (!stateElem.hasAttribute("id")) {
- stateElem.setAttribute("id", UUID::getUUID());
- }
- // Issue 64 - we may not cache them as they may be in an embedded document
- if (!isInEmbeddedDocument(stateElem))
- _cachedStates[ATTR(stateElem, "id")] = stateElem;
- }
-
- // make sure every invoke has an idlocation or id - actually required!
- Arabica::XPath::NodeSet<std::string> invokes = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "invoke", _scxml).asNodeSet();
- for (size_t i = 0; i < invokes.size(); i++) {
- Arabica::DOM::Element<std::string> invokeElem = Arabica::DOM::Element<std::string>(invokes[i]);
- if (!invokeElem.hasAttribute("id") && !invokeElem.hasAttribute("idlocation")) {
- invokeElem.setAttribute("id", UUID::getUUID());
- }
- }
-
-#if 0
- // add an id to the scxml element
- if (!_scxml.hasAttribute("id")) {
- _scxml.setAttribute("id", UUID::getUUID());
- }
-#endif
-
- // register for dom events to manage cached states
- Arabica::DOM::Events::EventTarget<std::string> eventTarget(_scxml);
- eventTarget.addEventListener("DOMNodeInserted", _domEventListener, true);
- eventTarget.addEventListener("DOMNodeRemoved", _domEventListener, true);
- eventTarget.addEventListener("DOMSubtreeModified", _domEventListener, true);
- _domIsSetup = true;
-}
-
-void InterpreterImpl::resolveXIncludes() {
- std::string xIncludeNS = _nsInfo.getXMLPrefixForNS("http://www.w3.org/2001/XInclude");
-
- // no element in namespace for xinclude, don't bother searching
- if (xIncludeNS.size() == 0)
- return;
-
- std::map<std::string, std::string> mergedNs = _nsInfo.nsInfo;
-
- std::list<std::string> includeChain;
- includeChain.push_back(_sourceURL);
-
- Arabica::XPath::NodeSet<std::string> xincludes = _xpath.evaluate("//" + xIncludeNS + "include", _document.getDocumentElement()).asNodeSet();
- for (size_t i = 0; i < xincludes.size(); i++) {
- // recursively resolve includes
- resolveXIncludes(includeChain, mergedNs, xIncludeNS, URL::asBaseURL(_sourceURL), Element<std::string>(xincludes[i]));
- }
-
- // update NameSpaceInfo and reinit xpath resolver
- _nsInfo = NameSpaceInfo(mergedNs);
- _xpath.setNamespaceContext(*_nsInfo.getNSContext());
-
-}
-
-void InterpreterImpl::resolveXIncludes(std::list<std::string> includeChain,
- std::map<std::string, std::string>& mergedNS,
- const std::string& xIncludeNS,
- const URL& baseURL,
- const Arabica::DOM::Element<std::string>& xinclude) {
- URL src = baseURL;
- NodeSet<std::string> newNodes;
-
- if (HAS_ATTR(xinclude, "href")) {
- src = URL(ATTR(xinclude, "href"));
- if (!src.isAbsolute()) {
- if (!src.toAbsolute(baseURL)) {
- LOG(ERROR) << "Cannot resolve relative URL '" << ATTR(xinclude, "href") << "' to absolute URL via base URL '" << baseURL << "', trying xi:fallback";
- goto TRY_WITH_FALLBACK;
- }
- }
-
- if (std::find(includeChain.begin(), includeChain.end(), src.asString()) != includeChain.end()) {
- std::stringstream incErr;
- incErr << ("Ignoring recursive inclusion of '" + src.asString() + " via:") << std::endl;
- for (std::list<std::string>::iterator incIter = includeChain.begin(); incIter != includeChain.end(); incIter++) {
- incErr << " " << *incIter << std::endl;
- }
- LOG(ERROR) << incErr.str();
- return;
- }
- includeChain.push_back(src.asString());
-
- if (HAS_ATTR(xinclude, "accept")) {
- src.addOutHeader("Accept", ATTR_CAST(xinclude, "accept"));
- }
-
- if (HAS_ATTR(xinclude, "accept-language")) {
- src.addOutHeader("Accept-Language", ATTR_CAST(xinclude, "accept-language"));
- }
-
- std::string includedContent;
- try {
- includedContent = src.getInContent();
- } catch (Event e) {
- goto TRY_WITH_FALLBACK;
- }
-
- if (HAS_ATTR(xinclude, "parse") && iequals(ATTR(xinclude, "parse"), "text")) {
- // parse as text
- Text<std::string> textNode = _document.createTextNode(includedContent);
- xinclude.getParentNode().insertBefore(textNode, xinclude);
- goto REMOVE_AND_RECURSE;
- } else {
- // parse as XML
- NameSpacingParser xiParser = NameSpacingParser::fromXML(includedContent);
- if (xiParser.errorsReported()) {
- ERROR_PLATFORM_THROW(xiParser.errors());
- } else {
- // scxml namespace prefixed and non-profixed
- if (mergedNS.find("http://www.w3.org/2005/07/scxml") != mergedNS.end() && xiParser.nameSpace.find("http://www.w3.org/2005/07/scxml") == xiParser.nameSpace.end()) {
- LOG(WARNING) << ("Warning for '" + DOMUtils::xPathForNode(xinclude) + "': root document maps SCXML namespace to prefix '" + mergedNS["http://www.w3.org/2005/07/scxml"] + "', included document does not specify SCXML namespace at all");
- }
- if (mergedNS.find("http://www.w3.org/2005/07/scxml") == mergedNS.end() && xiParser.nameSpace.find("http://www.w3.org/2005/07/scxml") != xiParser.nameSpace.end()) {
- LOG(ERROR) << ("Error for '" + DOMUtils::xPathForNode(xinclude) + "': root document uses implicit SCXML namespace without prefix, included document does map it to prefix '" + xiParser.nameSpace["http://www.w3.org/2005/07/scxml"] + "', trying xi:fallback");
- goto TRY_WITH_FALLBACK;
-
- }
-
- // merge namespaces to prefix mappings
- for (std::map<std::string, std::string>::iterator nsIter = xiParser.nameSpace.begin(); nsIter != xiParser.nameSpace.end(); nsIter++) {
-
- // same nsURL but different prefix
- if (mergedNS.find(nsIter->first) != mergedNS.end() && mergedNS[nsIter->first] != nsIter->second) {
- LOG(ERROR) << ("Error for '" + DOMUtils::xPathForNode(xinclude) + "': Cannot map namespace '" + nsIter->first + "' to prefix '" + nsIter->second + "', it is already mapped to prefix '" + mergedNS[nsIter->first] + "', trying xi:fallback");
- goto TRY_WITH_FALLBACK;
- }
-
- // same prefix but different nsURL
- for (std::map<std::string, std::string>::iterator currIter = mergedNS.begin(); currIter != mergedNS.end(); currIter++) {
- if (currIter->second == nsIter->second && currIter->first != nsIter->first) {
- LOG(ERROR) << ("Error for '" + DOMUtils::xPathForNode(xinclude) + "': Cannot assign prefix '" + nsIter->second + "' to namespace '" + nsIter->first + "' it is already a prefix for '" + currIter->first + "', trying xi:fallback");
- goto TRY_WITH_FALLBACK;
- }
- }
- mergedNS[nsIter->first] = nsIter->second;
- }
-
- // import DOM
- Node<std::string> imported = _document.importNode(xiParser.getDocument().getDocumentElement(), true);
- newNodes.push_back(imported);
- xinclude.getParentNode().insertBefore(imported, xinclude);
- goto REMOVE_AND_RECURSE;
- }
- }
- } else {
- LOG(ERROR) << "No href attribute for xi:xinclude at '" << DOMUtils::xPathForNode(xinclude) << "', trying xi:fallback";
- goto TRY_WITH_FALLBACK;
- }
-TRY_WITH_FALLBACK: {
- NodeSet<std::string> fallbacks = DOMUtils::filterChildElements(xIncludeNS + "fallback", xinclude);
- if (fallbacks.size() > 0) {
- LOG(WARNING) << "Using xi:fallback for '" << DOMUtils::xPathForNode(xinclude) << "'";
- // move the fallbacks children in place
- NodeList<std::string> fallbackChildren = fallbacks[0].getChildNodes();
- while (fallbacks[0].getChildNodes().getLength() > 0) {
- newNodes.push_back(fallbackChildren.item(0));
- xinclude.getParentNode().insertBefore(fallbackChildren.item(0), xinclude);
- }
- } else {
- LOG(WARNING) << "No xi:fallback found for '" << DOMUtils::xPathForNode(xinclude) << "', document most likely incomplete";
- }
- }
-REMOVE_AND_RECURSE:
- xinclude.getParentNode().removeChild(xinclude);
- for (size_t i = 0; i < newNodes.size(); i++) {
- _baseURL[newNodes[i]] = URL::asBaseURL(src);
- Arabica::XPath::NodeSet<std::string> xincludes = DOMUtils::filterChildElements(xIncludeNS + "include", newNodes[i], true);
- for (size_t j = 0; j < xincludes.size(); j++) {
- resolveXIncludes(includeChain, mergedNS, xIncludeNS, URL::asBaseURL(src), Element<std::string>(xincludes[j]));
- }
- }
-}
-
-void InterpreterImpl::init() {
- // make sure we have a factory if none was set before
- if (_factory == NULL)
- _factory = Factory::getInstance();
-
- // setup and normalize DOM
- setupDOM();
-
- // get our name or generate as UUID
- if (_name.length() == 0)
- _name = (HAS_ATTR(_scxml, "name") ? ATTR(_scxml, "name") : UUID::getUUID());
-
- // setup event queue for delayed send
- if (!_sendQueue) {
- _sendQueue = new DelayedEventQueue();
- _sendQueue->start();
- }
-
- // start io processoes
- setupIOProcessors();
-
- // instantiate datamodel if not explicitly set
- if (!_dataModel) {
- if (HAS_ATTR(_scxml, "datamodel")) {
- // might throw
- _dataModel = _factory->createDataModel(ATTR(_scxml, "datamodel"), this);
- for (std::set<DataModelExtension*>::iterator extIter = _dataModelExtensions.begin(); extIter != _dataModelExtensions.end(); extIter++) {
- _dataModel.addExtension(*extIter);
- }
- } else {
- _dataModel = _factory->createDataModel("null", this);
- }
- }
-
- _dataModel.assign("_x.args", _cmdLineOptions);
-
-// _running = true;
-#if VERBOSE
- std::cerr << "running " << this << std::endl;
-#endif
-
- if (_binding == EARLY) {
- // initialize all data elements
- NodeSet<std::string> dataElems = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "data", _scxml).asNodeSet();
- for (unsigned int i = 0; i < dataElems.size(); i++) {
- // do not process data elements of nested documents from invokers
- if (!getAncestorElement(dataElems[i], _nsInfo.xmlNSPrefix + "invoke"))
- if (dataElems[i].getNodeType() == Node_base::ELEMENT_NODE) {
- initializeData(Element<std::string>(dataElems[i]));
- }
- }
- } else {
- // initialize current data elements
- NodeSet<std::string> topDataElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", _scxml));
- for (unsigned int i = 0; i < topDataElems.size(); i++) {
- if (topDataElems[i].getNodeType() == Node_base::ELEMENT_NODE)
- initializeData(Element<std::string>(topDataElems[i]));
- }
- }
-
- // executeGlobalScriptElements
- NodeSet<std::string> globalScriptElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", _scxml);
- for (unsigned int i = 0; i < globalScriptElems.size(); i++) {
- executeContent(Element<std::string>(globalScriptElems[i]));
- }
-
- _isInitialized = true;
- _stable = false;
- setInterpreterState(USCXML_INITIALIZED);
-}
-
-/**
- * Called with a single data element from the topmost datamodel element.
- */
-void InterpreterImpl::initializeData(const Element<std::string>& data) {
-
- /// test 226/240 - initialize from invoke request
- if (_invokeReq.params.find(ATTR(data, "id")) != _invokeReq.params.end()) {
- try {
- _dataModel.init(ATTR(data, "id"), _invokeReq.params.find(ATTR(data, "id"))->second);
- } catch (Event e) {
- LOG(ERROR) << "Syntax error when initializing data " << DOMUtils::xPathForNode(data) << " from parameters:" << std::endl << e << std::endl;
- receiveInternal(e);
- }
- return;
- }
- if (_invokeReq.namelist.find(ATTR(data, "id")) != _invokeReq.namelist.end()) {
- try {
- _dataModel.init(ATTR(data, "id"), _invokeReq.namelist.find(ATTR(data, "id"))->second);
- } catch (Event e) {
- LOG(ERROR) << "Syntax error when initializing data " << DOMUtils::xPathForNode(data) << " from namelist:" << std::endl << e << std::endl;
- receiveInternal(e);
- }
- return;
- }
-
- try {
- Arabica::DOM::Node<std::string> dom;
- std::string text;
- processDOMorText(data, dom, text);
- _dataModel.init(data, dom, text);
- } catch (Event e) {
- LOG(ERROR) << "Syntax error when initializing data " << DOMUtils::xPathForNode(data) << ":" << std::endl << e << std::endl;
- receiveInternal(e);
- }
-}
-
-void InterpreterImpl::receiveInternal(const Event& event) {
-#if VERBOSE
- std::cerr << _name << " receiveInternal: " << event.name << std::endl;
-#endif
- _internalQueue.push_back(event);
-// _condVar.notify_all();
-}
-
-void InterpreterImpl::receive(const Event& event, bool toFront) {
-#if VERBOSE
- std::cerr << _name << " receive: " << event.name << std::endl;
-#endif
- if (toFront) {
- _externalQueue.push_front(event);
- } else {
- _externalQueue.push(event);
- }
- _condVar.notify_all();
-}
-
-void InterpreterImpl::internalDoneSend(const Arabica::DOM::Element<std::string>& state, const Arabica::DOM::Element<std::string>& doneData) {
- if (!isState(state))
- return;
-
-// if (parentIsScxmlState(state))
-// return;
-
- Event event;
-
- if (doneData) {
- processParamChilds(doneData, event.params);
- Arabica::XPath::NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", doneData);
- if (contents.size() > 1)
- LOG(ERROR) << "Only a single content element is allowed for send elements - using first one";
- if (contents.size() > 0) {
- std::string expr;
- processContentElement(Element<std::string>(contents[0]), event.dom, event.content, expr);
- if (expr.length() > 0) {
- try {
- event.content =_dataModel.evalAsString(expr);
- } catch (Event e) {
- e.name = "error.execution";
- e.dom = contents[0];
- receiveInternal(e);
- }
- }
- }
- }
-
- event.name = "done.state." + ATTR_CAST(state, "id"); // parent?!
- receiveInternal(event);
-
-}
-
-void InterpreterImpl::processContentElement(const Arabica::DOM::Element<std::string>& content,
- Arabica::DOM::Node<std::string>& dom,
- std::string& text,
- std::string& expr) {
- if (HAS_ATTR(content, "expr")) {
- expr = ATTR(content, "expr");
- } else if (content.hasChildNodes() || HAS_ATTR(content, "src") || HAS_ATTR(content, "srcexpr")) {
- processDOMorText(content, dom, text);
- } else {
- LOG(ERROR) << "content element does not specify any content.";
- }
-}
-
-void InterpreterImpl::processDOMorText(const Arabica::DOM::Element<std::string>& element,
- Arabica::DOM::Node<std::string>& dom,
- std::string& text) {
- // do we need to download?
- if (HAS_ATTR(element, "src") ||
- (HAS_ATTR(element, "srcexpr"))) {
- std::stringstream srcContent;
- URL sourceURL(HAS_ATTR(element, "srcexpr") ? _dataModel.evalAsString(ATTR(element, "srcexpr")) : ATTR(element, "src"));
- if (!sourceURL.toAbsolute(getBaseURLForNode(element))) {
- LOG(ERROR) << LOCALNAME(element) << " element has relative src or srcexpr URL with no baseURL set.";
- return;
- }
- if (_cachedURLs.find(sourceURL.asString()) != _cachedURLs.end() && false) {
- srcContent << _cachedURLs[sourceURL.asString()];
- } else {
- srcContent << sourceURL;
- if (sourceURL.downloadFailed()) {
- LOG(ERROR) << LOCALNAME(element) << " source cannot be downloaded";
- return;
- }
- _cachedURLs[sourceURL.asString()] = sourceURL;
- }
- if (srcContent.str().length() > 0) {
- // try to parse as XML
- NameSpacingParser parser;
- std::stringstream* ss = new std::stringstream();
- (*ss) << srcContent.str();
- std::auto_ptr<std::istream> ssPtr(ss);
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setByteStream(ssPtr);
-
- if (parser.parse(inputSource) && parser.getDocument()) {
- Document<std::string> doc = parser.getDocument();
- dom = doc.getDocumentElement();
- return;
- } else {
- text = srcContent.str();
- return;
- }
- }
- }
-
- if (!element.hasChildNodes())
- return;
-
- /**
- * Figure out whether the given element contains text, has one child or many childs
- */
- bool hasTextContent = false;
- bool hasOneChild = false;
- Node<std::string> theOneChild;
- bool hasManyChilds = false;
-
- Node<std::string> child = element.getFirstChild();
- while (child) {
-// std::cerr << child.getNodeType() << std::endl;
- if (child.getNodeType() == Node_base::TEXT_NODE ||
- child.getNodeType() == Node_base::CDATA_SECTION_NODE) {
- std::string trimmed = child.getNodeValue();
- boost::trim(trimmed);
- if (trimmed.length() > 0) {
- hasTextContent = true;
- }
- } else {
- if (hasOneChild) {
- hasManyChilds = true;
- hasOneChild = false;
- break;
- }
- hasOneChild = true;
- theOneChild = child;
- }
- child = child.getNextSibling();
- }
-
- if (hasOneChild) {
- // if we have a single child, it will be the content of the dom
- dom = theOneChild;
- } else if (hasManyChilds) {
- // if we have multiple childs
- dom = element;
- } else if(hasTextContent) {
- child = element.getFirstChild();
- while(child) {
- if ((child.getNodeType() == Node_base::TEXT_NODE || child.getNodeType() == Node_base::CDATA_SECTION_NODE)) {
- text += child.getNodeValue();
- }
- child = child.getNextSibling();
- }
- // updated test 179 - conflicts with test 562
-// text = _dataModel.evalAsString(text);
- } else {
- LOG(ERROR) << LOCALNAME(element) << " has neither text nor element children.";
- }
-}
-
-void InterpreterImpl::processParamChilds(const Arabica::DOM::Element<std::string>& element, std::multimap<std::string, Data>& params) {
- NodeSet<std::string> paramElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", element);
- for (size_t i = 0; i < paramElems.size(); i++) {
- try {
- Element<std::string> paramElem = Element<std::string>(paramElems[i]);
- if (!HAS_ATTR(paramElem, "name")) {
- LOG(ERROR) << "param element is missing name attribute";
- continue;
- }
- Data paramValue;
- if (HAS_ATTR(paramElem, "expr")) {
- paramValue = _dataModel.getStringAsData(ATTR(paramElem, "expr"));
- } else if(HAS_ATTR(paramElem, "location")) {
- paramValue = _dataModel.getStringAsData(ATTR(paramElem, "location"));
- } else {
- LOG(ERROR) << "param element is missing expr or location or no datamodel is specified";
- continue;
- }
- std::string paramKey = ATTR(paramElem, "name");
- params.insert(std::make_pair(paramKey, paramValue));
- } catch(Event e) {
- LOG(ERROR) << "Syntax error while processing params " << DOMUtils::xPathForNode(paramElems[i]) << ":" << std::endl << e << std::endl;
- // test 343
- std::multimap<std::string, Data>::iterator paramIter = params.begin();
- while(paramIter != params.end()) {
- params.erase(paramIter++);
- }
- e.name = "error.execution";
- receiveInternal(e);
- break;
- }
- }
-}
-
-void InterpreterImpl::send(const Arabica::DOM::Element<std::string>& element) {
- SendRequest sendReq;
- // test 331
- sendReq.Event::eventType = Event::EXTERNAL;
- sendReq.elem = element;
- try {
- // event
- if (HAS_ATTR(element, "eventexpr")) {
- sendReq.name = _dataModel.evalAsString(ATTR(element, "eventexpr"));
- } else if (HAS_ATTR(element, "event")) {
- sendReq.name = ATTR(element, "event");
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element eventexpr " << DOMUtils::xPathForNode(element) << ":" << std::endl << e << std::endl;
- return;
- }
- try {
- // target
- if (HAS_ATTR(element, "targetexpr")) {
- sendReq.target = _dataModel.evalAsString(ATTR(element, "targetexpr"));
- } else if (HAS_ATTR(element, "target")) {
- sendReq.target = ATTR(element, "target");
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " targetexpr:" << std::endl << e << std::endl;
- return;
- }
- try {
- // type
- if (HAS_ATTR(element, "typeexpr")) {
- sendReq.type = _dataModel.evalAsString(ATTR(element, "typeexpr"));
- } else if (HAS_ATTR(element, "type")) {
- sendReq.type = ATTR(element, "type");
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " typeexpr:" << std::endl << e << std::endl;
- return;
- }
- try {
- // id
- if (HAS_ATTR(element, "id")) {
- sendReq.sendid = ATTR(element, "id");
- } else {
- /*
- * The ids for <send> and <invoke> are subtly different. In a conformant
- * SCXML document, they must be unique within the session, but in the case
- * where the author does not provide them, the processor must generate a
- * new unique ID not at load time but each time the element is executed.
- * Furthermore the attribute 'idlocation' can be used to capture this
- * automatically generated id. Finally note that the automatically generated
- * id for <invoke> has a special format. See 6.4.1 Attribute Details for
- * details. The SCXML processor may generate all other ids in any format,
- * as long as they are unique.
- */
-
- /**
- *
- * If 'idlocation' is present, the SCXML Processor must generate an id when
- * the parent <send> element is evaluated and store it in this location.
- * See 3.14 IDs for details.
- *
- */
- sendReq.sendid = ATTR(getParentState(element), "id") + "." + UUID::getUUID();
- if (HAS_ATTR(element, "idlocation")) {
- _dataModel.assign(ATTR(element, "idlocation"), Data(sendReq.sendid, Data::VERBATIM));
- } else {
- sendReq.hideSendId = true;
- }
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " idlocation:" << std::endl << e << std::endl;
- return;
- }
-
- try {
- // delay
- std::string delay;
- sendReq.delayMs = 0;
- if (HAS_ATTR(element, "delayexpr")) {
- delay = _dataModel.evalAsString(ATTR(element, "delayexpr"));
- } else if (HAS_ATTR(element, "delay")) {
- delay = ATTR(element, "delay");
- }
- if (delay.size() > 0) {
- boost::trim(delay);
-
- NumAttr delayAttr(delay);
- if (iequals(delayAttr.unit, "ms")) {
- sendReq.delayMs = strTo<uint32_t>(delayAttr.value);
- } else if (iequals(delayAttr.unit, "s")) {
- sendReq.delayMs = strTo<double>(delayAttr.value) * 1000;
- } else if (delayAttr.unit.length() == 0) { // unit less delay is interpreted as milliseconds
- sendReq.delayMs = strTo<uint32_t>(delayAttr.value);
- } else {
- LOG(ERROR) << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'";
- }
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " delayexpr:" << std::endl << e << std::endl;
- return;
- }
-
- try {
- // namelist
- if (HAS_ATTR(element, "namelist")) {
- std::list<std::string> names = tokenize(ATTR(element, "namelist"));
- for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
- if (!_dataModel.isLocation(*nameIter)) {
- LOG(ERROR) << "Error in send element " << DOMUtils::xPathForNode(element) << " namelist:" << std::endl << "'" << *nameIter << "' is not a location expression" << std::endl;
- ERROR_EXECUTION2(err, "Location expression '" + *nameIter + "' in namelist is invalid", element);
- receiveInternal(err);
- return;
- }
- Data namelistValue = _dataModel.getStringAsData(*nameIter);
- sendReq.namelist[*nameIter] = namelistValue;
- sendReq.data.compound[*nameIter] = namelistValue; // this is questionable
- }
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " namelist:" << std::endl << e << std::endl;
- return;
- }
-
- try {
- // params
- processParamChilds(element, sendReq.params);
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " param expr:" << std::endl << e << std::endl;
- return;
- }
- try {
- // content
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", element);
- if (contents.size() > 1)
- LOG(ERROR) << "Only a single content element is allowed for send elements " << DOMUtils::xPathForNode(element) << " - using first one";
- if (contents.size() > 0) {
- std::string expr;
- processContentElement(Element<std::string>(contents[0]), sendReq.dom, sendReq.content, expr);
- if (expr.length() > 0) {
- try {
- sendReq.data = _dataModel.getStringAsData(expr);
- } catch (Event e) {
- e.name = "error.execution";
- receiveInternal(e);
- return;
- }
- // set as content if it's only an atom
- if (sendReq.data.atom.length() > 0) {
- sendReq.content = sendReq.data.atom;
- }
- } else if (sendReq.content.length() > 0) {
- sendReq.data = Data::fromJSON(sendReq.content);
- }
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " content:" << std::endl << e << std::endl;
- return;
- }
-
- if (sendReq.dom) {
- std::stringstream ss;
- ss << sendReq.dom;
- sendReq.xml = ss.str();
- _dataModel.replaceExpressions(sendReq.xml);
- }
-
- assert(_sendIds.find(sendReq.sendid) == _sendIds.end());
- _sendIds[sendReq.sendid] = std::make_pair(this, sendReq);
- if (sendReq.delayMs > 0) {
- _sendQueue->addEvent(sendReq.sendid, InterpreterImpl::delayedSend, sendReq.delayMs, &_sendIds[sendReq.sendid]);
- } else {
- delayedSend(&_sendIds[sendReq.sendid], sendReq.name);
- }
-}
-
-void InterpreterImpl::delayedSend(void* userdata, std::string eventName) {
- std::pair<InterpreterImpl*, SendRequest>* data = (std::pair<InterpreterImpl*, SendRequest>*)(userdata);
-
- InterpreterImpl* INSTANCE = data->first;
- SendRequest sendReq = data->second;
-
- /**
- * If neither the 'type' nor the 'typeexpr' is defined, the SCXML Processor
- * must assume the default value of http://www.w3.org/TR/scxml/#SCXMLEventProcessor
- */
- if (sendReq.type.length() == 0)
- sendReq.type = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor";
-
- IOProcessor ioProc = INSTANCE->getIOProcessor(sendReq.type);
- if (ioProc) {
- try {
- ioProc.send(sendReq);
- } catch(Event e) {
- throw e;
- } catch (const std::exception &e) {
- LOG(ERROR) << "Exception caught while sending event to ioprocessor " << sendReq.type << ": '" << e.what() << "'";
- } catch(...) {
- LOG(ERROR) << "Exception caught while sending event to ioprocessor " << sendReq.type;
- }
- } else {
- /**
- * If the SCXML Processor does not support the type that is specified, it
- * must place the event error.execution on the internal event queue.
- */
- ERROR_EXECUTION(exc, "Unsupported type '" + sendReq.type + "' with send element");
- INSTANCE->receiveInternal(exc);
- }
-
- assert(INSTANCE->_sendIds.find(sendReq.sendid) != INSTANCE->_sendIds.end());
- INSTANCE->_sendIds.erase(sendReq.sendid);
-}
-
-void InterpreterImpl::invoke(const Arabica::DOM::Element<std::string>& element) {
- InvokeRequest invokeReq;
- invokeReq.elem = element;
- invokeReq.Event::eventType = Event::EXTERNAL;
- try {
- // type
- if (HAS_ATTR(element, "typeexpr")) {
- invokeReq.type = _dataModel.evalAsString(ATTR(element, "typeexpr"));
- } else if (HAS_ATTR(element, "type")) {
- invokeReq.type = ATTR(element, "type");
- }
-
- // src
- std::string source;
- if (HAS_ATTR(element, "srcexpr")) {
- source = _dataModel.evalAsString(ATTR(element, "srcexpr"));
- } else if (HAS_ATTR(element, "src")) {
- source = ATTR(element, "src");
- }
- if (source.length() > 0) {
- URL srcURL(source);
- if (!srcURL.toAbsolute(getBaseURLForNode(element))) {
- LOG(ERROR) << "invoke element has relative src URL with no baseURL set.";
- return;
- }
- invokeReq.src = srcURL.asString();
- }
-
- // id
- try {
- if (HAS_ATTR(element, "id")) {
- invokeReq.invokeid = ATTR(element, "id");
- } else {
- if (HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat")) && HAS_ATTR(element, "parent")) {
- invokeReq.invokeid = ATTR(element, "parent") + "." + UUID::getUUID();
- } else {
- invokeReq.invokeid = ATTR(getParentState(element), "id") + "." + UUID::getUUID();
- }
- if (HAS_ATTR(element, "idlocation")) {
- _dataModel.assign(ATTR(element, "idlocation"), Data(invokeReq.invokeid, Data::VERBATIM));
- }
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in invoke element idlocation:" << std::endl << e << std::endl;
- return;
- }
-
- // namelist
- if (HAS_ATTR(element, "namelist")) {
- std::list<std::string> names = tokenize(ATTR(element, "namelist"));
- for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
- if (!_dataModel.isLocation(*nameIter)) {
- LOG(ERROR) << "Error in send element " << DOMUtils::xPathForNode(element) << " namelist:" << std::endl << "'" << *nameIter << "' is not a location expression" << std::endl;
- ERROR_EXECUTION2(err, "Location expression '" + *nameIter + "' in namelist is invalid", element);
- receiveInternal(err);
- return;
- }
- Data namelistValue = _dataModel.getStringAsData(*nameIter);
- invokeReq.namelist[*nameIter] = namelistValue;
- invokeReq.data.compound[*nameIter] = namelistValue;
- }
- }
-
- // autoforward
- if (HAS_ATTR(element, "autoforward")) {
- if (iequals(ATTR(element, "autoforward"), "true")) {
- invokeReq.autoForward = true;
- }
- } else {
- invokeReq.autoForward = false;
- }
-
- // params
- processParamChilds(element, invokeReq.params);
-
- // content
- try {
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", element);
- if (contents.size() > 1)
- LOG(ERROR) << "Only a single content element is allowed for send elements - using first one";
- if (contents.size() > 0) {
- std::string expr;
- processContentElement(Element<std::string>(contents[0]), invokeReq.dom, invokeReq.content, expr);
- if (expr.length() > 0) {
- try {
- invokeReq.data =_dataModel.getStringAsData(expr);
- } catch (Event e) {
- e.name = "error.execution";
- e.dom = contents[0];
- receiveInternal(e);
- }
- } else if (invokeReq.content.length() > 0) {
- invokeReq.data = Data::fromJSON(invokeReq.content);
- }
-
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(element) << " content:" << std::endl << e << std::endl;
- return;
- }
-
- if (invokeReq.dom) {
- std::stringstream ss;
- ss << invokeReq.dom;
- invokeReq.xml = ss.str();
- _dataModel.replaceExpressions(invokeReq.xml);
- }
-
- // test 422
- if (invokeReq.type.size() == 0)
- invokeReq.type = "http://www.w3.org/TR/scxml/";
-
- Invoker invoker;
- // is there such an invoker already?
- if (_invokers.find(invokeReq.invokeid) != _invokers.end()) {
- invoker = _invokers[invokeReq.invokeid];
- } else {
- try {
- invoker = _factory->createInvoker(invokeReq.type, this);
- invoker.setInvokeId(invokeReq.invokeid);
- invoker.setInterpreter(this);
- _invokers[invokeReq.invokeid] = invoker;
- } catch (Event e) {
- receiveInternal(e);
- }
- }
- if (invoker) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
- try {
-
- if (!invoker.getElement())
- invoker.setElement(Element<std::string>(element));
-
- if (invoker.getType().size() == 0)
- invoker.setType(invokeReq.type);
-
- try {
-
- USCXML_MONITOR_CALLBACK3(beforeInvoking, Arabica::DOM::Element<std::string>(element), invokeReq.invokeid);
-
- invoker.invoke(invokeReq);
- LOG(INFO) << "Added invoker " << invokeReq.type << " at " << invokeReq.invokeid;
-
- USCXML_MONITOR_CALLBACK3(afterInvoking, Arabica::DOM::Element<std::string>(element), invokeReq.invokeid)
-
- // this is out of draft but so useful to know when an invoker started
- if (HAS_ATTR(element, "callback")) {
- std::string callback = ATTR(element, "callback");
- if (callback.size() > 0) {
- Event invSuccess;
- invSuccess.name = callback + "." + invokeReq.invokeid;
- receive(invSuccess);
- }
- }
-
-
- } catch(boost::bad_lexical_cast e) {
- LOG(ERROR) << "Exception caught while sending invoke request to invoker " << invokeReq.invokeid << ": " << e.what();
- } catch (const std::exception &e) {
- LOG(ERROR) << "Unknown exception caught while sending invoke request to invoker " << invokeReq.invokeid << ": " << e.what();
- } catch (Event &e) {
- LOG(ERROR) << e;
- } catch(...) {
- LOG(ERROR) << "Unknown exception caught while sending invoke request to invoker " << invokeReq.invokeid;
- }
- try {
-// _dataModel.assign("_invokers['" + invokeReq.invokeid + "']", invoker.getDataModelVariables());
- } catch (const std::exception &e) {
- LOG(ERROR) << "Exception caught while assigning datamodel variables from invoker " << invokeReq.invokeid << ": " << e.what();
- } catch(...) {
- LOG(ERROR) << "Exception caught while assigning datamodel variables from invoker " << invokeReq.invokeid;
- }
- } catch (...) {
- LOG(ERROR) << "Invoker " << invokeReq.type << " threw an exception";
- }
- } else {
- LOG(ERROR) << "No invoker known for type " << invokeReq.type;
- }
-
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in invoke element " << DOMUtils::xPathForNode(element) << ":" << std::endl << e << std::endl;
- }
-}
-
-void InterpreterImpl::cancelInvoke(const Arabica::DOM::Element<std::string>& element) {
- std::string invokeId;
- if (HAS_ATTR(element, "idlocation")) {
- invokeId = _dataModel.evalAsString(ATTR(element, "idlocation"));
- } else if (HAS_ATTR(element, "id")) {
- invokeId = ATTR(element, "id");
- } else {
- assert(false);
- }
- if (_invokers.find(invokeId) != _invokers.end()) {
- LOG(INFO) << "Removed invoker at " << invokeId;
- try {
- // TODO: this is datamodel specific!
- //_dataModel.assign("_invokers['" + invokeId + "']", Data(std::string("''"), Data::INTERPRETED));
- } catch (Event e) {
- LOG(ERROR) << "Syntax when removing invoker:" << std::endl << e << std::endl;
- }
-
- USCXML_MONITOR_CALLBACK3(beforeUninvoking, Element<std::string>(element), invokeId)
- _invokers[invokeId].uninvoke();
-
- /**
- * This should not be necessary. Most invokers have their "clean-up" code in their
- * destructor and not their uninvoke method - we need to refactor them all!
- */
- if (_invokers[invokeId].deleteOnUninvoke())
- _invokers.erase(invokeId);
-
- USCXML_MONITOR_CALLBACK3(beforeUninvoking, Element<std::string>(element), invokeId)
-
- } else {
- LOG(ERROR) << "Cannot cancel invoke for id " << invokeId << ": no such invokation";
- }
- //receiveInternal(Event("done.invoke." + invokeId, Event::PLATFORM));
-}
-
-bool InterpreterImpl::hasConditionMatch(const Arabica::DOM::Element<std::string>& conditional) {
- if (HAS_ATTR(conditional, "cond") && ATTR(conditional, "cond").length() > 0) {
- try {
- return _dataModel.evalAsBool(conditional, ATTR(conditional, "cond"));
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in cond attribute of " << TAGNAME(conditional) << " element " << DOMUtils::xPathForNode(conditional) << ":" << std::endl << e << std::endl;
- e.name = "error.execution";
- receiveInternal(e);
- return false;
- }
- }
- return true; // no condition is always true
-}
-
-
-void InterpreterImpl::executeContent(const NodeList<std::string>& content, bool rethrow) {
- for (unsigned int i = 0; i < content.getLength(); i++) {
- const Arabica::DOM::Node<std::string>& node = content.item(i);
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- try {
- executeContent(Element<std::string>(node), true);
- }
- CATCH_AND_DISTRIBUTE2("Error when executing content", content.item(i));
- }
-}
-
-void InterpreterImpl::executeContent(const NodeSet<std::string>& content, bool rethrow) {
- for (unsigned int i = 0; i < content.size(); i++) {
- const Arabica::DOM::Node<std::string>& node = content[i];
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- try {
- executeContent(Element<std::string>(node), true);
- }
- CATCH_AND_DISTRIBUTE2("Error when executing content", content[i]);
- }
-}
-
-void InterpreterImpl::executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow) {
-
- if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "onentry") ||
- iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "onexit") ||
- iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "finalize") ||
- iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "transition")) {
- // --- CONVENIENCE LOOP --------------------------
- NodeList<std::string> executable = content.getChildNodes();
- for (size_t i = 0; i < executable.getLength(); i++) {
- const Arabica::DOM::Node<std::string>& childNode = executable.item(i);
- if (childNode.getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- executeContent(Element<std::string>(childNode), rethrow);
- }
- return;
- }
-
- USCXML_MONITOR_CALLBACK2(beforeExecutingContent, Element<std::string>(content))
-
- if (false) {
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "raise")) {
- // --- RAISE --------------------------
-#if 0
- if (HAS_ATTR(content, "event")) {
- receiveInternal(Event(ATTR(content, "event")));
- }
-#else
- // Extension for donedata in flat documents - we need to send them internally - use raise
- if (HAS_ATTR(content, "event")) {
- Event raised(ATTR(content, "event"));
- try {
- // content
- processParamChilds(content, raised.params);
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", content);
- if (contents.size() > 1)
- LOG(ERROR) << "Only a single content element is allowed for raise elements " << DOMUtils::xPathForNode(content) << " - using first one";
- if (contents.size() > 0) {
- std::string expr;
- processContentElement(Element<std::string>(contents[0]), raised.dom, raised.content, expr);
- if (expr.length() > 0) {
- try {
- raised.data = _dataModel.getStringAsData(expr);
- } catch (Event e) {
- e.name = "error.execution";
- receiveInternal(e);
- }
- // set as content if it's only an atom
- if (raised.data.atom.length() > 0) {
- raised.content = raised.data.atom;
- }
- } else if (raised.content.length() > 0) {
- raised.data = Data::fromJSON(raised.content);
- }
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in send element " << DOMUtils::xPathForNode(content) << " content:" << std::endl << raised << std::endl;
- return;
- }
-
- if (raised.dom) {
- std::stringstream ss;
- ss << raised.dom;
- raised.xml = ss.str();
- _dataModel.replaceExpressions(raised.xml);
- }
- receiveInternal(raised);
- }
-#endif
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "if")) {
- // --- IF / ELSEIF / ELSE --------------
- Arabica::DOM::Element<std::string> ifElem = (Arabica::DOM::Element<std::string>)content;
-#if VERBOSE
- if (HAS_ATTR(ifElem, "cond"))
- std::cerr << ATTR(ifElem, "cond") << std::endl;
-#endif
- /**
- * A block is everything up to or between elseifs and else. Those element
- * determine whether the block is true and its executable content executed.
- */
- if (ifElem.hasChildNodes()) {
- bool blockIsTrue = hasConditionMatch(ifElem);
- NodeList<std::string> childs = ifElem.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Element<std::string> childElem(childs.item(i));
- if (iequals(TAGNAME_CAST(childs.item(i)), _nsInfo.xmlNSPrefix + "elseif") ||
- iequals(TAGNAME_CAST(childs.item(i)), _nsInfo.xmlNSPrefix + "else")) {
- if (blockIsTrue) {
- // last block was true, break here
- break;
- } else {
- // is this block the one to execute?
- blockIsTrue = hasConditionMatch(childElem);
- }
- } else {
- if (blockIsTrue) {
- executeContent(childElem, rethrow);
- }
- }
- }
- }
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "elseif")) {
- LOG(ERROR) << "Found single elseif to evaluate!" << std::endl;
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "else")) {
- LOG(ERROR) << "Found single else to evaluate!" << std::endl;
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "foreach")) {
- // --- FOREACH --------------------------
- if (HAS_ATTR(content, "array") && HAS_ATTR(content, "item")) {
- std::string array = ATTR(content, "array");
- std::string item = ATTR(content, "item");
- std::string index = (HAS_ATTR(content, "index") ? ATTR(content, "index") : "");
- uint32_t iterations = 0;
- try {
- iterations = _dataModel.getLength(array);
- }
- CATCH_AND_DISTRIBUTE2("Syntax error in array attribute of foreach element", content)
- try {
- _dataModel.pushContext(); // copy old and enter new context
-// if (!_dataModel.isDeclared(item)) {
-// _dataModel.init(item, Data());
-// }
- for (uint32_t iteration = 0; iteration < iterations; iteration++) {
- _dataModel.setForeach(item, array, index, iteration);
- if (content.hasChildNodes())
- // execute content and have exception rethrown to break foreach
- executeContent(content.getChildNodes(), rethrow);
- }
- _dataModel.popContext(); // leave stacked context
- }
- CATCH_AND_DISTRIBUTE2("Syntax error in foreach element", content)
- } else {
- LOG(ERROR) << "Expected array and item attributes with foreach element!" << std::endl;
- }
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "log")) {
- // --- LOG --------------------------
- Arabica::DOM::Element<std::string> logElem = (Arabica::DOM::Element<std::string>)content;
- if (logElem.hasAttribute("label")) {
- std::cout << logElem.getAttribute("label") << ": ";
- }
- if (logElem.hasAttribute("expr")) {
- try {
- std::string msg = _dataModel.evalAsString(logElem.getAttribute("expr"));
- std::cout << msg << std::endl;
- }
- CATCH_AND_DISTRIBUTE2("Syntax error in expr attribute of log element", content)
- } else {
- if (logElem.hasAttribute("label")) {
- std::cout << std::endl;
- }
- }
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "assign")) {
- // --- ASSIGN --------------------------
- if (HAS_ATTR(content, "location")) {
- try {
- if (!_dataModel.isDeclared(ATTR(content, "location"))) {
- // test 286, 331
- ERROR_EXECUTION_THROW("Assigning to undeclared location '" + ATTR(content, "location") + "' not allowed.");
- } else {
- Node<std::string> dom;
- std::string text;
- processDOMorText(content, dom, text);
- _dataModel.assign(Element<std::string>(content), dom, text);
- }
- }
- CATCH_AND_DISTRIBUTE2("Syntax error in attributes of assign element", content)
- }
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "validate")) {
- // --- VALIDATE --------------------------
- std::string location = (HAS_ATTR(content, "location") ? ATTR(content, "location") : "");
- std::string schema = (HAS_ATTR(content, "schema") ? ATTR(content, "schema") : "");
- _dataModel.validate(location, schema);
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "script")) {
- // --- SCRIPT --------------------------
- if (HAS_ATTR(content, "src")) {
- URL scriptUrl(ATTR(content, "src"));
-
- if (!scriptUrl.toAbsolute(getBaseURLForNode(content))) {
- LOG(ERROR) << "Failed to convert relative script URL " << ATTR(content, "src") << " to absolute with base URL " << getBaseURLForNode(content);
- return;
- }
-
- std::stringstream srcContent;
- try {
- if (_cachedURLs.find(scriptUrl.asString()) != _cachedURLs.end() && false) {
- srcContent << _cachedURLs[scriptUrl.asString()];
- } else {
- srcContent << scriptUrl;
- if (scriptUrl.downloadFailed()) {
- LOG(ERROR) << "script element source cannot be downloaded";
- }
- _cachedURLs[scriptUrl.asString()] = scriptUrl;
- }
- } catch (Event exception) {
- // script failed to download
- if (exception.name == "error.communication") {
- throw exception; // terminate test329, test301
- }
- receive(exception);
- return;
- }
-
- try {
- _dataModel.eval((Element<std::string>)content, srcContent.str());
- }
- CATCH_AND_DISTRIBUTE("Syntax error while executing script element from '" + ATTR(content, "src") + "':")
- } else {
- if (content.hasChildNodes()) {
- // search for the text node with the actual script
- std::string scriptContent;
- for (Node<std::string> child = content.getFirstChild(); child; child = child.getNextSibling()) {
- if (child.getNodeType() == Node_base::TEXT_NODE || child.getNodeType() == Node_base::CDATA_SECTION_NODE)
- scriptContent += child.getNodeValue();
- }
- if (scriptContent.size() > 0) {
- try {
- _dataModel.eval((Element<std::string>)content, scriptContent);
- }
- CATCH_AND_DISTRIBUTE2("Syntax error while executing script element", content)
- }
- }
- }
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "send")) {
- // --- SEND --------------------------
- try {
- send(content);
- }
- CATCH_AND_DISTRIBUTE2("Error while sending content", content)
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "cancel")) {
- // --- CANCEL --------------------------
- std::string sendId;
- try {
- if (HAS_ATTR(content, "sendidexpr")) {
- sendId = _dataModel.evalAsString(ATTR(content, "sendidexpr"));
- } else if(HAS_ATTR(content, "sendid")) {
- sendId = ATTR(content, "sendid");
- } else {
- LOG(ERROR) << "Expected sendidexpr or sendid attribute in cancel element";
- return;
- }
- _sendQueue->cancelEvent(sendId);
- {
- tthread::lock_guard<tthread::recursive_mutex> lock(_sendQueue->_mutex);
- _sendIds.erase(sendId); // issue 68
- }
-
- }
- CATCH_AND_DISTRIBUTE2("Syntax error while executing cancel element", content)
- } else if (iequals(TAGNAME(content), _nsInfo.xmlNSPrefix + "invoke")) {
- // --- INVOKE --------------------------
- } else {
- // --- Custom Executable Content
- ExecutableContent execContent;
- if (_executableContent.find(content) == _executableContent.end()) {
- _executableContent[content] = _factory->createExecutableContent(content.getLocalName(), content.getNamespaceURI(), this);
- }
- execContent = _executableContent[content];
-
- execContent.enterElement(content);
- if (execContent.processChildren()) {
- NodeList<std::string> executable = content.getChildNodes();
- for (size_t i = 0; i < executable.getLength(); i++) {
- if (executable.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- executeContent(Element<std::string>(executable.item(i)), rethrow);
- }
- }
- execContent.exitElement(content);
- }
-
- USCXML_MONITOR_CALLBACK2(afterExecutingContent, Element<std::string>(content))
-
-}
-
-void InterpreterImpl::finalizeAndAutoForwardCurrentEvent() {
- for (std::map<std::string, Invoker>::iterator invokeIter = _invokers.begin();
- invokeIter != _invokers.end();
- invokeIter++) {
- if (iequals(invokeIter->first, _currEvent.invokeid)) {
- Arabica::XPath::NodeSet<std::string> finalizes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invokeIter->second.getElement());
- for (size_t k = 0; k < finalizes.size(); k++) {
- Element<std::string> finalizeElem = Element<std::string>(finalizes[k]);
-
- bool hasChildElems = false;
- Node<std::string> child = finalizeElem.getFirstChild();
- while(child) {
- if (child.getNodeType() == Node_base::ELEMENT_NODE) {
- hasChildElems = true;
- break;
- }
- child = child.getNextSibling();
- }
-
- if (hasChildElems) {
- executeContent(finalizeElem);
- } else {
- // Specification 6.5.2: http://www.w3.org/TR/scxml/#N110EF
- if (HAS_ATTR(invokeIter->second.getElement(), "namelist")) {
- std::list<std::string> names = tokenize(ATTR(invokeIter->second.getElement(), "namelist"));
- for (std::list<std::string>::iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
- if (_currEvent.data.compound.find(*nameIter) != _currEvent.data.compound.end()) {
- _dataModel.assign(*nameIter, _currEvent.data.compound[*nameIter]);
- }
- }
- }
-
- Arabica::XPath::NodeSet<std::string> params = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", invokeIter->second.getElement());
- for (size_t l = 0; l < params.size(); l++) {
- Element<std::string> paramElem = Element<std::string>(params[l]);
- if (HAS_ATTR(paramElem, "location") &&
- _currEvent.data.compound.find(ATTR(paramElem, "location")) != _currEvent.data.compound.end()) {
- std::string location = ATTR(paramElem, "location");
- _dataModel.assign(location, _currEvent.data.compound[location]);
- }
- }
-
-
- }
- }
- }
- if (HAS_ATTR(invokeIter->second.getElement(), "autoforward") && stringIsTrue(ATTR(invokeIter->second.getElement(), "autoforward"))) {
- try {
- // do not autoforward to invokers that send to #_parent from the SCXML IO Processor!
- // Yes do so, see test229!
- // if (!boost::equals(_currEvent.getOriginType(), "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"))
-// LOG(ERROR) << _sessionId << " auto forwards " << _currEvent.name << " to " << invokeIter->first << std::endl;
- invokeIter->second.send(_currEvent);
- } catch (const std::exception &e) {
- LOG(ERROR) << "Exception caught while sending event to invoker " << invokeIter->first << ": " << e.what();
- } catch(...) {
- LOG(ERROR) << "Exception caught while sending event to invoker " << invokeIter->first;
- }
- }
- }
-}
-
-void InterpreterImpl::returnDoneEvent(const Arabica::DOM::Node<std::string>& state) {
-// std::cerr << state << std::endl;
- if (_parentQueue != NULL) {
- Event done;
- done.name = "done.invoke." + _sessionId;
- _parentQueue->push(done);
- }
-}
-
-bool InterpreterImpl::parentIsScxmlState(const Arabica::DOM::Element<std::string>& state) {
- Arabica::DOM::Element<std::string> parentElem = (Arabica::DOM::Element<std::string>)state.getParentNode();
- if (iequals(TAGNAME(parentElem), _nsInfo.xmlNSPrefix + "scxml"))
- return true;
- return false;
-}
-
-bool InterpreterImpl::isInFinalState(const Arabica::DOM::Element<std::string>& state) {
- if (isCompound(state)) {
- Arabica::XPath::NodeSet<std::string> childs = getChildStates(state);
- for (size_t i = 0; i < childs.size(); i++) {
- if (isFinal(Element<std::string>(childs[i])) && isMember(childs[i], _configuration))
- return true;
- }
- } else if (isParallel(state)) {
- Arabica::XPath::NodeSet<std::string> childs = getChildStates(state);
- for (size_t i = 0; i < childs.size(); i++) {
- if (!isInFinalState(Element<std::string>(childs[i])))
- return false;
- }
- return true;
- }
- return false;
-}
-
-bool InterpreterImpl::isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set) {
- for (size_t i = 0; i < set.size(); i++) {
- if (set[i] == node)
- return true;
- }
- return false;
-}
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::getChildStates(const Arabica::DOM::Node<std::string>& state) {
- Arabica::XPath::NodeSet<std::string> childs;
-
- Arabica::DOM::NodeList<std::string> childElems = state.getChildNodes();
- for (size_t i = 0; i < childElems.getLength(); i++) {
- if (childElems.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- if (isState(Element<std::string>(childElems.item(i)))) {
- childs.push_back(childElems.item(i));
- }
- }
- return childs;
-}
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::getChildStates(const Arabica::XPath::NodeSet<std::string>& states) {
- Arabica::XPath::NodeSet<std::string> childs;
- for (size_t i = 0; i < states.size(); i++) {
- childs.push_back(getChildStates(states[i]));
- }
- return childs;
-}
-
-Arabica::DOM::Element<std::string> InterpreterImpl::getParentState(const Arabica::DOM::Node<std::string>& element) {
- Arabica::DOM::Node<std::string> parent = element.getParentNode();
- while(parent && !isState(Element<std::string>(parent))) {
- parent = parent.getParentNode();
- }
- return Element<std::string>(parent);
-}
-
-Arabica::DOM::Node<std::string> InterpreterImpl::getAncestorElement(const Arabica::DOM::Node<std::string>& node, const std::string tagName) {
- Arabica::DOM::Node<std::string> parent = node.getParentNode();
- while(parent) {
- if (parent.getNodeType() == Node_base::ELEMENT_NODE &&
- iequals(TAGNAME_CAST(parent), tagName)) {
- return parent;
- }
- parent = parent.getParentNode();
- }
- return Arabica::DOM::Node<std::string>();
-}
-
-/**
- See: http://www.w3.org/TR/scxml/#LCCA
- The Least Common Compound Ancestor is the <state> or <scxml> element s such that s is a proper ancestor
- of all states on stateList and no descendant of s has this property. Note that there is guaranteed to be
- such an element since the <scxml> wrapper element is a common ancestor of all states. Note also that since
- we are speaking of proper ancestor (parent or parent of a parent, etc.) the LCCA is never a member of stateList.
-*/
-
-#define VERBOSE_FIND_LCCA 0
-Arabica::DOM::Node<std::string> InterpreterImpl::findLCCA(const Arabica::XPath::NodeSet<std::string>& states) {
-#if VERBOSE_FIND_LCCA
- std::cerr << "findLCCA: ";
- for (size_t i = 0; i < states.size(); i++) {
- std::cerr << ATTR_CAST(states[i], "id") << ", ";
- }
- std::cerr << std::endl << std::flush;
-#endif
-
- Arabica::XPath::NodeSet<std::string> ancestors = getProperAncestors(states[0], Arabica::DOM::Node<std::string>());
- Arabica::DOM::Node<std::string> ancestor;
-
- for (size_t i = 0; i < ancestors.size(); i++) {
- if (!isCompound(Element<std::string>(ancestors[i])))
- continue;
- for (size_t j = 0; j < states.size(); j++) {
-
-#if VERBOSE_FIND_LCCA
- std::cerr << "Checking " << ATTR_CAST(states[j], "id") << " and " << ATTR_CAST(ancestors[i], "id") << std::endl;
-#endif
-
- if (!isDescendant(states[j], ancestors[i]))
- goto NEXT_ANCESTOR;
- }
- ancestor = ancestors[i];
- break;
-NEXT_ANCESTOR:
- ;
- }
-
- // take uppermost root as ancestor
- if (!ancestor)
- ancestor = _scxml;
-
-#if VERBOSE_FIND_LCCA
- std::cerr << " -> " << ATTR_CAST(ancestor, "id") << " " << ancestor.getLocalName() << std::endl;
-#endif
- return ancestor;
-}
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::getStates(const std::list<std::string>& stateIds) {
- Arabica::XPath::NodeSet<std::string> states;
- std::list<std::string>::const_iterator tokenIter = stateIds.begin();
- while(tokenIter != stateIds.end()) {
- states.push_back(getState(*tokenIter));
- tokenIter++;
- }
- return states;
-}
-
-Arabica::DOM::Element<std::string> InterpreterImpl::getState(const std::string& stateId) {
-
- if (_cachedStates.find(stateId) != _cachedStates.end()) {
- return _cachedStates[stateId];
- }
-
-#if 0
- std::list<Element<std::string> > stateStack;
- stateStack.push_back(_scxml);
-
-
- while(stateStack.size() > 0) {
- Element<std::string> curr = stateStack.front();
- stateStack.pop_front();
-
- if (HAS_ATTR(curr, "id") && ATTR(curr, "id") == stateId) {
- _cachedStates[stateId] = curr;
- return curr;
- }
-
- Arabica::XPath::NodeSet<std::string> children = getChildStates(curr);
- stateStack.insert(stateStack.end(), children.begin(), children.end());
- }
-
-#else
- // first try atomic and compound states
- NodeSet<std::string> target = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "state[@id='" + stateId + "']", _scxml).asNodeSet();
- if (target.size() > 0)
- goto FOUND;
-
- // now parallel states
- target = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "parallel[@id='" + stateId + "']", _scxml).asNodeSet();
- if (target.size() > 0)
- goto FOUND;
-
- // now final states
- target = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "final[@id='" + stateId + "']", _scxml).asNodeSet();
- if (target.size() > 0)
- goto FOUND;
-
- // now history states
- target = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "history[@id='" + stateId + "']", _scxml).asNodeSet();
- if (target.size() > 0)
- goto FOUND;
- {
- ERROR_EXECUTION_THROW("No state with id '" + stateId + "' found");
- }
-FOUND:
- if (target.size() > 0) {
- for (size_t i = 0; i < target.size(); i++) {
- Element<std::string> targetElem(target[i]);
- if (!isInEmbeddedDocument(targetElem)) {
- _cachedStates[stateId] = targetElem;
- return targetElem;
- }
- }
- }
-#endif
-
- // return the empty node
- return Arabica::DOM::Element<std::string>();
-}
-
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::getAllStates() {
- NodeSet<std::string> states;
- states.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "state", _scxml).asNodeSet());
- states.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "parallel", _scxml).asNodeSet());
- states.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "final", _scxml).asNodeSet());
- states.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "history", _scxml).asNodeSet());
- return states;
-}
-
-Arabica::DOM::Node<std::string> InterpreterImpl::getSourceState(const Arabica::DOM::Element<std::string>& transition) {
- if (iequals(TAGNAME_CAST(transition.getParentNode()), _nsInfo.xmlNSPrefix + "initial"))
- return transition.getParentNode().getParentNode();
- return transition.getParentNode();
-}
-
-/**
- * In a conformant SCXML document, a compound state may specify either an "initial"
- * attribute or an <initial> element, but not both. See 3.6 <initial> for a
- * discussion of the difference between the two notations. If neither the "initial"
- * attribute nor an <initial> element is specified, the SCXML Processor must use
- * the first child state in document order as the default initial state.
- */
-Arabica::XPath::NodeSet<std::string> InterpreterImpl::getInitialStates(Arabica::DOM::Element<std::string> state) {
- if (!state) {
- state = _scxml;
- }
-
-#if VERBOSE
- std::cerr << "Getting initial state of " << TAGNAME(state) << " " << ATTR(state, "id") << std::endl;
-#endif
-
- if (isAtomic(state)) {
- return Arabica::XPath::NodeSet<std::string>();
- }
-
- assert(isCompound(state) || isParallel(state));
-
- if (isParallel(state)) {
- return getChildStates(state);
- }
-
- // initial attribute at element
- Arabica::DOM::Element<std::string> stateElem = (Arabica::DOM::Element<std::string>)state;
- if (stateElem.hasAttribute("initial")) {
- return getStates(tokenize(stateElem.getAttribute("initial")));
- }
-
- // initial element as child - but not the implicit generated one
- NodeSet<std::string> initElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "initial", state);
- if(initElems.size() > 0 && !iequals(ATTR_CAST(initElems[0], "generated"), "true")) {
- NodeSet<std::string> initTrans = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", initElems[0]);
- if (initTrans.size() > 0) {
- return getTargetStates(Element<std::string>(initTrans[0]));
- }
- }
-
- // first child state
- Arabica::XPath::NodeSet<std::string> initStates;
- NodeList<std::string> childs = state.getChildNodes();
- for (size_t i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- if (isState(Element<std::string>(childs.item(i)))) {
- initStates.push_back(childs.item(i));
- return initStates;
- }
-
- }
- // nothing found
- return Arabica::XPath::NodeSet<std::string>();
-}
-
-NodeSet<std::string> InterpreterImpl::getReachableStates() {
- /** Check which states are reachable */
-
- NodeSet<std::string> reachable;
- reachable.push_back(_scxml);
-
- bool hasChanges = true;
-
- while (hasChanges) {
- // iterate initials and transitions until stable, unneccerily iterates complete reachable set everytime
-
- hasChanges = false;
- // reachable per initial attribute or document order - size will increase as we append new states
- for (size_t i = 0; i < reachable.size(); i++) {
- // get the state's initial states
- Element<std::string> state = Element<std::string>(reachable[i]);
- try {
- NodeSet<std::string> initials = getInitialStates(state);
- for (size_t j = 0; j < initials.size(); j++) {
- Element<std::string> initial = Element<std::string>(initials[j]);
- if (!InterpreterImpl::isMember(initial, reachable)) {
- reachable.push_back(initial);
- hasChanges = true;
- }
- }
- } catch (Event e) {
- }
- }
-
- // reachable per target attribute in transitions
- for (size_t i = 0; i < reachable.size(); i++) {
- Element<std::string> state = Element<std::string>(reachable[i]);
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state, false);
- for (size_t j = 0; j < transitions.size(); j++) {
- Element<std::string> transition = Element<std::string>(transitions[j]);
- try {
- NodeSet<std::string> targets = getTargetStates(transition);
- for (size_t k = 0; k < targets.size(); k++) {
- Element<std::string> target = Element<std::string>(targets[k]);
- if (!InterpreterImpl::isMember(target, reachable)) {
- reachable.push_back(target);
- hasChanges = true;
- }
- }
- } catch (Event e) {
- }
- }
- }
-
- // reachable via a reachable child state
- for (size_t i = 0; i < reachable.size(); i++) {
- Element<std::string> state = Element<std::string>(reachable[i]);
- if (InterpreterImpl::isAtomic(state)) {
- // iterate the states parents
- Node<std::string> parent = state.getParentNode();
- while(parent && parent.getNodeType() == Node_base::ELEMENT_NODE) {
- Element<std::string> parentElem = Element<std::string>(parent);
- if (!InterpreterImpl::isState(parentElem)) {
- break;
- }
- if (!InterpreterImpl::isMember(parentElem, reachable)) {
- reachable.push_back(parent);
- hasChanges = true;
- }
- parent = parent.getParentNode();
- }
- }
- }
- }
-
-
- return reachable;
-}
-
-
-NodeSet<std::string> InterpreterImpl::getTargetStates(const Arabica::DOM::Element<std::string>& transition) {
- if (_cachedTargets.find(transition) != _cachedTargets.end())
- return _cachedTargets[transition];
-
- NodeSet<std::string> targetStates;
-
- assert(boost::ends_with(TAGNAME(transition), "transition"));
-
- // if we are called with a state, process all its transitions
- if (isState(transition) || (transition.getNodeType() == Node_base::ELEMENT_NODE && iequals(_nsInfo.xmlNSPrefix + "initial", TAGNAME(transition)))) {
- NodeList<std::string> childs = transition.getChildNodes();
- for (size_t i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Element<std::string> childElem = Element<std::string>(childs.item(i));
- if (iequals(TAGNAME(childElem), _nsInfo.xmlNSPrefix + "transition")) {
- targetStates.push_back(getTargetStates(childElem));
- }
- }
- _cachedTargets[transition] = targetStates;
- return targetStates;
- }
-
- std::string targetId = ((Arabica::DOM::Element<std::string>)transition).getAttribute("target");
- std::list<std::string> targetIds = tokenize(ATTR(transition, "target"));
- for (std::list<std::string>::const_iterator targetIter = targetIds.begin(); targetIter != targetIds.end(); targetIter++) {
- Arabica::DOM::Node<std::string> state = getState(*targetIter);
- if (state) {
- assert(HAS_ATTR_CAST(state, "id"));
- targetStates.push_back(state);
- }
- }
- _cachedTargets[transition] = targetStates;
- return targetStates;
-}
-
-NodeSet<std::string> InterpreterImpl::getTargetStates(const Arabica::XPath::NodeSet<std::string>& transitions) {
- NodeSet<std::string> targets;
- for (unsigned int i = 0; i < transitions.size(); i++) {
- targets.push_back(getTargetStates(Element<std::string>(transitions[i])));
- }
- return targets;
-}
-
-
-/*
- * If state2 is null, returns the set of all ancestors of state1 in ancestry order
- * (state1's parent followed by the parent's parent, etc. up to an including the <scxml>
- * element). If state2 is non-null, returns in ancestry order the set of all ancestors
- * of state1, up to but not including state2. (A "proper ancestor" of a state is its
- * parent, or the parent's parent, or the parent's parent's parent, etc.))If state2 is
- * state1's parent, or equal to state1, or a descendant of state1, this returns the empty set.
- */
-
-NodeSet<std::string> InterpreterImpl::getProperAncestors(const Arabica::DOM::Node<std::string>& s1,
- const Arabica::DOM::Node<std::string>& s2) {
-
- std::pair<Arabica::DOM::Node<std::string>, Arabica::DOM::Node<std::string> > ancPair = std::make_pair(s1, s2);
- if (_cachedProperAncestors.find(ancPair) != _cachedProperAncestors.end())
- return _cachedProperAncestors[ancPair];
-
- NodeSet<std::string> ancestors;
- if (isState(Element<std::string>(s1))) {
- Arabica::DOM::Node<std::string> node = s1;
- while((node = node.getParentNode())) {
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
- break;
-
- Element<std::string> nodeElem(node);
- if (!isState(nodeElem))
- break;
-// if (iequals(TAGNAME(nodeElem), _nsInfo.xmlNSPrefix + "scxml")) // do not return scxml root itself - this is somewhat ill-defined
-// break;
- if (!iequals(TAGNAME(nodeElem), _nsInfo.xmlNSPrefix + "parallel") &&
- !iequals(TAGNAME(nodeElem), _nsInfo.xmlNSPrefix + "state") &&
- !iequals(TAGNAME(nodeElem), _nsInfo.xmlNSPrefix + "scxml"))
- break;
- if (node == s2)
- break;
- ancestors.push_back(node);
- }
- }
- _cachedProperAncestors[ancPair] = ancestors;
- return ancestors;
-}
-
-bool InterpreterImpl::isDescendant(const Arabica::DOM::Node<std::string>& s1,
- const Arabica::DOM::Node<std::string>& s2) {
- if (!s1 || !s2)
- return false;
-
- Arabica::DOM::Node<std::string> parent = s1.getParentNode();
- while(parent) {
- if (s2 == parent)
- return true;
- parent = parent.getParentNode();
- }
- return false;
-}
-
-bool InterpreterImpl::isTargetless(const Arabica::DOM::Element<std::string>& transition) {
- if (transition.hasAttribute("target")) {
- return false;
- }
- return true;
-}
-
-bool InterpreterImpl::isState(const Arabica::DOM::Element<std::string>& state) {
- if (!state)
- return false;
-
- std::string tagName = LOCALNAME(state);
- if (iequals("state", tagName))
- return true;
- if (iequals("scxml", tagName))
- return true;
- if (iequals("parallel", tagName))
- return true;
-// if (iequals("history", tagName)) // this is no state, see mail to W3C list
-// return true;
- if (iequals("final", tagName))
- return true;
- return false;
-}
-
-bool InterpreterImpl::isFinal(const Arabica::DOM::Element<std::string>& state) {
- std::string tagName = LOCALNAME(state);
- if (iequals("final", tagName))
- return true;
- if (HAS_ATTR(state, "final") && iequals("true", ATTR(state, "final")))
- return true;
- return false;
-}
-
-bool InterpreterImpl::isInEmbeddedDocument(const Node<std::string>& node) {
- // a node is in an embedded document if there is a content element in its parents
- Node<std::string> parent = node;
- while(parent) {
- if(iequals(parent.getLocalName(), "content")) {
- return true;
- }
- parent = parent.getParentNode();
- }
- return false;
-}
-
-bool InterpreterImpl::isInitial(const Arabica::DOM::Element<std::string>& state) {
- if (!isState(state))
- return false;
-
- Arabica::DOM::Node<std::string> parentNode = state.getParentNode();
- if (parentNode.getNodeType() != Node_base::ELEMENT_NODE)
- return false;
-
- Arabica::DOM::Element<std::string> parent = (Element<std::string>)parentNode;
- if (!isState(parent))
- return true; // scxml element
-
- if (isMember(state, getInitialStates(parent)))
- return true; // every nested node
-
-// if (isParallel(parent))
-// return true;
-
- return false;
-}
-
-bool InterpreterImpl::isPseudoState(const Arabica::DOM::Element<std::string>& state) {
- std::string tagName = LOCALNAME(state);
- if (iequals("initial", tagName))
- return true;
- if (iequals("history", tagName))
- return true;
- return false;
-}
-
-bool InterpreterImpl::isTransitionTarget(const Arabica::DOM::Element<std::string>& elem) {
- return (isState(elem) || iequals(LOCALNAME(elem), "history"));
-}
-
-bool InterpreterImpl::isAtomic(const Arabica::DOM::Element<std::string>& state) {
- if (iequals("final", LOCALNAME(state)))
- return true;
-
- if (iequals("parallel", LOCALNAME(state)))
- return false;
-
- Arabica::DOM::NodeList<std::string> childs = state.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
-
- if (isState(Element<std::string>(childs.item(i))))
- return false;
- }
- return true;
-}
-
-bool InterpreterImpl::isHistory(const Arabica::DOM::Element<std::string>& state) {
- if (iequals("history", LOCALNAME(state)))
- return true;
- return false;
-}
-
-bool InterpreterImpl::isParallel(const Arabica::DOM::Element<std::string>& state) {
- if (!isState(state))
- return false;
- if (iequals("parallel", LOCALNAME(state)))
- return true;
- return false;
-}
-
-
-bool InterpreterImpl::isCompound(const Arabica::DOM::Element<std::string>& state) {
- if (!isState(state))
- return false;
-
- if (iequals(LOCALNAME(state), "parallel")) // parallel is no compound state
- return false;
-
- Arabica::DOM::NodeList<std::string> childs = state.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- if (isState(Element<std::string>(childs.item(i))))
- return true;
- }
- return false;
-}
-
-void InterpreterImpl::setupIOProcessors() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
- std::map<std::string, IOProcessorImpl*> ioProcs = _factory->getIOProcessors();
- std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = ioProcs.begin();
- while(ioProcIter != ioProcs.end()) {
- if (iequals(ioProcIter->first, "basichttp") && !(_capabilities & CAN_BASIC_HTTP)) {
- ioProcIter++;
- continue;
- }
- if (iequals(ioProcIter->first, "http") && !(_capabilities & CAN_GENERIC_HTTP)) {
- ioProcIter++;
- continue;
- }
-
- // do not override if already set
- if (_ioProcessors.find(ioProcIter->first) != _ioProcessors.end()) {
- ioProcIter++;
- continue;
- }
-
- // this might throw error.execution
- _ioProcessors[ioProcIter->first] = _factory->createIOProcessor(ioProcIter->first, this);
- _ioProcessors[ioProcIter->first].setType(ioProcIter->first);
- _ioProcessors[ioProcIter->first].setInterpreter(this);
-
- if (iequals(ioProcIter->first, "http")) {
- // this is somewhat ugly
- _httpServlet = static_cast<InterpreterHTTPServlet*>(_ioProcessors[ioProcIter->first]._impl.get());
- }
-
- if (iequals(ioProcIter->first, "websocket")) {
- // this is somewhat ugly
- _wsServlet = static_cast<InterpreterWebSocketServlet*>(_ioProcessors[ioProcIter->first]._impl.get());
- }
-
- // register aliases
- std::list<std::string> names = _ioProcessors[ioProcIter->first].getNames();
- std::list<std::string>::iterator nameIter = names.begin();
- while(nameIter != names.end()) {
- // do not override
- if (!boost::equal(*nameIter, ioProcIter->first) && _ioProcessors.find(*nameIter) == _ioProcessors.end())
- _ioProcessors[*nameIter] = _ioProcessors[ioProcIter->first];
- nameIter++;
- }
-#if 0
- try {
- _dataModel.registerIOProcessor(ioProcIter->first, _ioProcessors[ioProcIter->first]);
- } catch (Event e) {
- LOG(ERROR) << "Syntax error when setting _ioprocessors:" << std::endl << e << std::endl;
- }
-#endif
- ioProcIter++;
- }
-}
-
-IOProcessor InterpreterImpl::getIOProcessor(const std::string& type) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
- if (_ioProcessors.find(type) == _ioProcessors.end()) {
- LOG(ERROR) << "No ioProcessor known for type " << type;
- return IOProcessor();
- }
- return _ioProcessors[type];
-}
-
-void InterpreterImpl::setCmdLineOptions(std::map<std::string, std::string> params) {
- std::map<std::string, std::string>::iterator paramIter = params.begin();
- while (paramIter != params.end()) {
- if (paramIter->second.length() > 0) {
- _cmdLineOptions.compound[paramIter->first] = Data(paramIter->second, Data::VERBATIM);
- } else {
- _cmdLineOptions.compound[paramIter->first] = Data("true");
- }
- paramIter++;
- }
-}
-
-bool InterpreterImpl::hasLegalConfiguration() {
- return isLegalConfiguration(_configuration);
-}
-
-bool InterpreterImpl::isLegalConfiguration(const std::list<std::string>& config) {
- NodeSet<std::string> states;
- for (std::list<std::string>::const_iterator confIter = config.begin(); confIter != config.end(); confIter++) {
- Element<std::string> state = getState(*confIter);
- if (!state) {
- LOG(INFO) << "No state with id '" << *confIter << "'";
- return false;
- }
- states.push_back(state);
- while((state = getParentState(state))) {
- states.push_back(state);
- };
- }
- return isLegalConfiguration(states);
-}
-
-/**
- * See: http://www.w3.org/TR/scxml/#LegalStateConfigurations
- */
-bool InterpreterImpl::isLegalConfiguration(const NodeSet<std::string>& config) {
-
- // The configuration contains exactly one child of the <scxml> element.
- NodeSet<std::string> scxmlChilds = getChildStates(_scxml);
- Node<std::string> foundScxmlChild;
- for (size_t i = 0; i < scxmlChilds.size(); i++) {
- if (isMember(scxmlChilds[i], config)) {
- if (foundScxmlChild) {
- LOG(ERROR) << "Invalid configuration: Multiple childs of scxml root are active '" << ATTR_CAST(foundScxmlChild, "id") << "' and '" << ATTR_CAST(scxmlChilds[i], "id") << "'";
- return false;
- }
- foundScxmlChild = scxmlChilds[i];
- }
- }
- if (!foundScxmlChild) {
- LOG(ERROR) << "Invalid configuration: No childs of scxml root are active";
-
- return false;
- }
-
- // The configuration contains one or more atomic states.
- bool foundAtomicState = false;
- for (size_t i = 0; i < config.size(); i++) {
- if (isAtomic(Element<std::string>(config[i]))) {
- foundAtomicState = true;
- break;
- }
- }
- if (!foundAtomicState) {
- LOG(ERROR) << "Invalid configuration: No atomic state is active";
- return false;
- }
-
- // the configuration contains no history pseudo-states
- for (size_t i = 0; i < config.size(); i++) {
- if (isHistory(Element<std::string>(config[i]))) {
- LOG(ERROR) << "Invalid configuration: history state " << ATTR_CAST(config[i], "id") << " is active";
- return false;
- }
- }
-
-
-
- // When the configuration contains an atomic state, it contains all of its <state> and <parallel> ancestors.
- for (size_t i = 0; i < config.size(); i++) {
- if (isAtomic(Element<std::string>(config[i]))) {
- Node<std::string> parent = config[i];
- while(((parent = parent.getParentNode()) && parent.getNodeType() == Node_base::ELEMENT_NODE)) {
- if (isState(Element<std::string>(parent)) &&
- (iequals(LOCALNAME(parent), "state") ||
- iequals(LOCALNAME(parent), "parallel"))) {
- if (!isMember(parent, config)) {
- LOG(ERROR) << "Invalid configuration: atomic state '" << ATTR_CAST(config[i], "id") << "' is active, but parent '" << ATTR_CAST(parent, "id") << "' is not";
- return false;
- }
- }
- }
- }
- }
-
- // When the configuration contains a non-atomic <state>, it contains one and only one of the state's children
- for (size_t i = 0; i < config.size(); i++) {
- Element<std::string> configElem(config[i]);
- if (!isAtomic(configElem) && !isParallel(configElem)) {
- Node<std::string> foundChildState;
- //std::cerr << config[i] << std::endl;
- NodeSet<std::string> childs = getChildStates(config[i]);
- for (size_t j = 0; j < childs.size(); j++) {
- //std::cerr << childs[j] << std::endl;
- if (isMember(childs[j], config)) {
- if (foundChildState) {
- LOG(ERROR) << "Invalid configuration: Multiple childs of compound '" << ATTR_CAST(config[i], "id")
- << "' are active '" << ATTR_CAST(foundChildState, "id") << "' and '" << ATTR_CAST(childs[j], "id") << "'";
- return false;
- }
- foundChildState = childs[j];
- }
- }
- if (!foundChildState) {
- LOG(ERROR) << "Invalid configuration: No childs of compound '" << ATTR_CAST(config[i], "id") << "' are active";
- return false;
- }
- }
- }
-
- // If the configuration contains a <parallel> state, it contains all of its children
- for (size_t i = 0; i < config.size(); i++) {
- if (isParallel(Element<std::string>(config[i]))) {
- NodeSet<std::string> childs = getChildStates(config[i]);
- for (size_t j = 0; j < childs.size(); j++) {
- if (!isMember(childs[j], config) && !isHistory(Element<std::string>(childs[j]))) {
- LOG(ERROR) << "Invalid configuration: Not all children of parallel '" << ATTR_CAST(config[i], "id") << "' are active i.e. '" << ATTR_CAST(childs[j], "id") << "' is not";
- return false;
- }
- }
- }
- }
-
- // everything worked out fine!
- return true;
-}
-
-bool InterpreterImpl::isInState(const std::string& stateId) {
- if (HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat"))) {
- // extension for flattened SCXML documents
- if (_configuration.size() > 0 && HAS_ATTR_CAST(_configuration[0], "id")) {
- // all states are encoded in the current statename
- FlatStateIdentifier flatId(ATTR_CAST(_configuration[0], "id"));
- for (std::list<std::string>::const_iterator iter = flatId.getActive().begin(); iter != flatId.getActive().end(); iter++) {
- if (iequals(stateId, *iter))
- return true;
- }
- }
- return false;
- } else {
-
- for (size_t i = 0; i < _configuration.size(); i++) {
- if (HAS_ATTR_CAST(_configuration[i], "id") &&
- iequals(ATTR_CAST(_configuration[i], "id"), stateId)) {
- return true;
- }
- }
- }
- return false;
-}
-
-const URL& InterpreterImpl::getBaseURLForNode(const Arabica::DOM::Node<std::string>& node) {
- Arabica::DOM::Node<std::string> currNode = node;
- while(currNode) {
- if (_baseURL.find(currNode) != _baseURL.end()) {
- // speed-up subsequent lookups
- _baseURL[node] = _baseURL[currNode];
- // return baseurl
- return _baseURL[currNode];
- }
- currNode = currNode.getParentNode();
- }
- return _baseURL[_scxml];
-}
-
-void InterpreterImpl::handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event) {
- // clear targets
- _cachedTargets.clear();
-
- if (event.getType().compare("DOMAttrModified") == 0) // we do not care about other attributes
- return;
-
- // remove modified states from cache
- Node<std::string> target = Arabica::DOM::Node<std::string>(event.getTarget());
- NodeSet<std::string> childs = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "state", target);
- for (size_t i = 0; i < childs.size(); i++) {
- if (HAS_ATTR_CAST(childs[i], "id")) {
- _cachedStates.erase(ATTR_CAST(childs[i], "id"));
- }
- }
- // it's more stress to search through all pairs, just have them recalculated
- _cachedProperAncestors.clear();
-}
-
-void InterpreterImpl::DOMEventListener::handleEvent(Arabica::DOM::Events::Event<std::string>& event) {
- if (_interpreter)
- _interpreter->handleDOMEvent(event);
-}
-
-std::ostream& operator<< (std::ostream& os, const InterpreterState& interpreterState) {
- os << "[" << InterpreterImpl::stateToString(interpreterState) << "]" << std::endl;
- return os;
-}
-
-std::string InterpreterImpl::stateToString(InterpreterState state) {
- std::stringstream ss;
-
- switch(state) {
- case USCXML_INSTANTIATED:
- ss << "INSTANTIATED";
- break;
- case USCXML_MICROSTEPPED:
- ss << "MICROSTEPPED";
- break;
- case USCXML_MACROSTEPPED:
- ss << "MACROSTEPPED";
- break;
- case USCXML_IDLE:
- ss << "IDLE";
- break;
- case USCXML_FINISHED:
- ss << "FINISHED";
- break;
- case USCXML_DESTROYED:
- ss << "DESTROYED";
- break;
- default:
- ss << "INVALID";
- break;
- }
-
- return ss.str();
-}
-
-
}
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 81d12d0..fa5ab05 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -1,6 +1,6 @@
/**
* @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
* @copyright Simplified BSD
*
* @cond
@@ -17,111 +17,28 @@
* @endcond
*/
-#ifndef RUNTIME_H_SQ1MBKGN
-#define RUNTIME_H_SQ1MBKGN
+#ifndef INTERPRETER_H_6CD5A168
+#define INTERPRETER_H_6CD5A168
-// this has to be the first include or MSVC will run amok
-#include "uscxml/config.h"
-#include "uscxml/Common.h"
-#include "uscxml/util/String.h"
-
-#include <iostream> // arabica xpath uses cerr without iostream
-#include <boost/shared_ptr.hpp>
-#include <set>
#include <map>
+#include <mutex>
+#include <string>
-#include "uscxml/InterpreterInfo.h"
-
-#include <XPath/XPath.hpp>
-#include <DOM/Document.hpp>
-
-#include "uscxml/concurrency/BlockingQueue.h"
-#include "uscxml/messages/Data.h"
-#include "uscxml/messages/SendRequest.h"
-#include "uscxml/debug/InterpreterIssue.h"
-#include "uscxml/URL.h"
-
-#include "uscxml/plugins/DataModel.h"
-#include "uscxml/plugins/IOProcessor.h"
-#include "uscxml/plugins/Invoker.h"
-#include "uscxml/plugins/ExecutableContent.h"
-
-#include "dom/DOMUtils.h"
-
-#ifndef TIME_BLOCK
-# ifdef BUILD_PROFILING
-# include "uscxml/concurrency/Timer.h"
-# define TIME_BLOCK Measurement msm(&timer);
-# else
-# define TIME_BLOCK
-# endif
-#endif
-
-#define ERROR_PLATFORM_THROW(msg) \
- Event e; \
- e.name = "error.platform"; \
- e.data.compound["cause"] = Data(msg, Data::VERBATIM); \
- throw e; \
-
-
-#define USCXML_MONITOR_CATCH(callback) \
-catch (Event e) { \
- LOG(ERROR) << "Syntax error when calling " #callback " on monitors: " << std::endl << e << std::endl; \
-} catch (boost::bad_weak_ptr e) { \
- LOG(ERROR) << "Unclean shutdown " << std::endl << std::endl; \
-} catch (...) { \
- LOG(ERROR) << "An exception occurred when calling " #callback " on monitors"; \
-} \
-if (_state == USCXML_DESTROYED) { \
- throw boost::bad_weak_ptr(); \
-} \
-
-
-#define USCXML_MONITOR_CALLBACK(callback)\
-for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) { \
- try { \
- (*monIter)->callback(shared_from_this()); \
- } \
- USCXML_MONITOR_CATCH(callback) \
-}
-
-#define USCXML_MONITOR_CALLBACK2(callback, arg1)\
-for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) { \
- try { \
- (*monIter)->callback(shared_from_this(), arg1); \
- } \
- USCXML_MONITOR_CATCH(callback) \
-}
-
-#define USCXML_MONITOR_CALLBACK3(callback, arg1, arg2)\
-for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) { \
- try { \
- (*monIter)->callback(shared_from_this(), arg1, arg2); \
- } \
- USCXML_MONITOR_CATCH(callback) \
-}
+#include "Common.h"
+#include "uscxml/interpreter/InterpreterImpl.h"
+#include "uscxml/interpreter/InterpreterMonitor.h" // beware cyclic reference!
+#include "uscxml/debug/InterpreterIssue.h" // beware cyclic reference!
+#include <xercesc/dom/DOM.hpp>
namespace uscxml {
-class HTTPServletInvoker;
-class InterpreterMonitor;
-class InterpreterHTTPServlet;
-class InterpreterWebSocketServlet;
-class Factory;
-class DelayedEventQueue;
-
-enum Capabilities {
- CAN_NOTHING = 0,
- CAN_BASIC_HTTP = 1,
- CAN_GENERIC_HTTP = 2,
-};
+class InterpreterMonitor; // forward declare
class USCXML_API InterpreterOptions {
public:
InterpreterOptions() :
- withDebugger(false),
verbose(false),
- checking(false),
+ validate(false),
withHTTP(true),
withHTTPS(true),
withWS(true),
@@ -131,9 +48,8 @@ public:
wsPort(5081) {
}
- bool withDebugger;
bool verbose;
- bool checking;
+ bool validate;
bool withHTTP;
bool withHTTPS;
bool withWS;
@@ -156,779 +72,90 @@ public:
static void printUsageAndExit(const char* progName);
static InterpreterOptions fromCmdLine(int argc, char** argv);
- unsigned int getCapabilities();
-
-};
-
-enum InterpreterState {
- USCXML_DESTROYED = -2, ///< destructor ran - users should never see this one
- USCXML_FINISHED = -1, ///< machine reached a final configuration and is done
- USCXML_IDLE = 0, ///< stable configuration and queues empty
- USCXML_INITIALIZED = 1, ///< DOM is setup and all external components instantiated
- USCXML_INSTANTIATED = 2, ///< nothing really, just instantiated
- USCXML_MICROSTEPPED = 3, ///< processed one transition set
- USCXML_MACROSTEPPED = 4, ///< processed all transition sets and reached a stable configuration
-};
-USCXML_API std::ostream& operator<< (std::ostream& os, const InterpreterState& interpreterState);
-
-class USCXML_API InterpreterImpl : public InterpreterInfo, public boost::enable_shared_from_this<InterpreterImpl> {
-public:
-
- typedef std::set<InterpreterMonitor*>::iterator monIter_t;
-
- enum Binding {
- EARLY = 0,
- LATE = 1
- };
-
- virtual ~InterpreterImpl();
-
- void cloneFrom(InterpreterImpl* other);
- void cloneFrom(boost::shared_ptr<InterpreterImpl> other);
- virtual void writeTo(std::ostream& stream);
-
- // TODO: We need to move the destructor to the implementations to make these pure virtual
- virtual InterpreterState interpret();
- virtual InterpreterState step(int waitForMS = 0);
-
- void start(); ///< Start interpretation in a thread
- void stop(); ///< Stop interpreter thread
- void reset(); ///< Reset state machine
- void join();
- bool isRunning();
-
- InterpreterState getInterpreterState();
-
- void addMonitor(InterpreterMonitor* monitor) {
- _monitors.insert(monitor);
- }
-
- void removeMonitor(InterpreterMonitor* monitor) {
- _monitors.erase(monitor);
- }
-
- void setSourceURL(std::string sourceURL) {
- _sourceURL = URL(sourceURL);
- if (_scxml) {
- URL baseURL(sourceURL);
- URL::toBaseURL(baseURL);
- _baseURL[_scxml] = baseURL;
- }
- }
-
- std::string getSourceURL() {
- return _sourceURL.asString();
- }
-
- std::string getBaseURL() {
- return getBaseURLForNode(_scxml);
- }
-
- std::string getBaseURL(const Arabica::DOM::Node<std::string>& refNode) {
- return getBaseURLForNode(refNode);
- }
-
- std::string getBaseURL(const std::string& xpathExpr) {
- Arabica::XPath::NodeSet<std::string> roots = _xpath.evaluate(xpathExpr, _scxml).asNodeSet();
- if (roots.size() > 0) {
- return getBaseURLForNode(roots[0]);
- }
- return "";
- }
-
- void setCmdLineOptions(std::map<std::string, std::string> params);
- Data getCmdLineOptions() {
- return _cmdLineOptions;
- }
-
- InterpreterHTTPServlet* getHTTPServlet() {
- return _httpServlet;
- }
-
- void setParentQueue(uscxml::concurrency::BlockingQueue<SendRequest>* parentQueue) {
- _parentQueue = parentQueue;
- }
-
- void setFactory(Factory* factory) {
- _factory = factory;
- }
- Factory* getFactory() {
- return _factory;
- }
-
- Arabica::XPath::NodeSet<std::string> getNodeSetForXPath(const std::string& xpathExpr) {
- return _xpath.evaluate(xpathExpr, _scxml).asNodeSet();
- }
-
- void setNameSpaceInfo(const NameSpaceInfo& nsInfo) {
- _nsInfo = nsInfo;
- _xpath.setNamespaceContext(*_nsInfo.getNSContext());
- }
- NameSpaceInfo getNameSpaceInfo() const {
- return _nsInfo;
- }
-
- void receiveInternal(const Event& event);
- void receive(const Event& event, bool toFront = false);
-
- Event getCurrentEvent() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- return _currEvent;
- }
-
- virtual bool isInState(const std::string& stateId);
-
- Arabica::XPath::NodeSet<std::string> getConfiguration() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- return _configuration;
- }
-
- Arabica::XPath::NodeSet<std::string> getBasicConfiguration() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- Arabica::XPath::NodeSet<std::string> basicConfig;
- for (size_t i = 0; i < _configuration.size(); i++) {
- if (isAtomic(Arabica::DOM::Element<std::string>(_configuration[i])))
- basicConfig.push_back(_configuration[i]);
- }
- return basicConfig;
- }
-
- void setInitalConfiguration(const std::list<std::string>& states) {
- _startConfiguration = states;
- }
- void setInvokeRequest(const InvokeRequest& req) {
- _invokeReq = req;
- }
-
- virtual Arabica::DOM::Document<std::string> getDocument() const {
- return _document;
- }
-
- void setCapabilities(unsigned int capabilities) {
- _capabilities = capabilities;
- }
-
- void setName(const std::string& name);
- const std::string& getName() {
- return _name;
- }
- const std::string& getSessionId() {
- return _sessionId;
- }
-
- DelayedEventQueue* getDelayQueue() {
- return _sendQueue;
- }
-
- void addIOProcessor(IOProcessor ioProc) {
- std::list<std::string> names = ioProc.getNames();
-
- std::list<std::string>::iterator nameIter = names.begin();
- while(nameIter != names.end()) {
- _ioProcessors[*nameIter] = ioProc;
- _ioProcessors[*nameIter].setType(names.front());
- _ioProcessors[*nameIter].setInterpreter(this);
-
- nameIter++;
- }
- }
-
- const std::map<std::string, IOProcessor>& getIOProcessors() {
- return _ioProcessors;
- }
-
- void setDataModel(const DataModel& dataModel) {
- _userSuppliedDataModel = true;
- _dataModel = dataModel;
- }
- DataModel getDataModel() {
- return _dataModel;
- }
-
- void addDataModelExtension(DataModelExtension* ext) {
- _dataModelExtensions.insert(ext);
- }
-
- void setInvoker(const std::string& invokeId, Invoker invoker) {
- _dontDestructOnUninvoke.insert(invokeId);
- _invokers[invokeId] = invoker;
- _invokers[invokeId].setInterpreter(this);
- _invokers[invokeId].setInvokeId(invokeId);
- }
-
- const std::map<std::string, Invoker>& getInvokers() {
- return _invokers;
- }
-
- bool runOnMainThread(int fps, bool blocking = true);
-
- static bool isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set);
-
- bool hasLegalConfiguration();
- bool isLegalConfiguration(const Arabica::XPath::NodeSet<std::string>&);
- bool isLegalConfiguration(const std::list<std::string>&);
-
- static bool isState(const Arabica::DOM::Element<std::string>& state);
- static bool isPseudoState(const Arabica::DOM::Element<std::string>& state);
- static bool isTransitionTarget(const Arabica::DOM::Element<std::string>& elem);
- static bool isTargetless(const Arabica::DOM::Element<std::string>& transition);
- static bool isAtomic(const Arabica::DOM::Element<std::string>& state);
- static bool isFinal(const Arabica::DOM::Element<std::string>& state);
- static bool isHistory(const Arabica::DOM::Element<std::string>& state);
- static bool isParallel(const Arabica::DOM::Element<std::string>& state);
- static bool isCompound(const Arabica::DOM::Element<std::string>& state);
- static bool isDescendant(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2);
- static bool isInEmbeddedDocument(const Arabica::DOM::Node<std::string>& node);
- bool isInitial(const Arabica::DOM::Element<std::string>& state);
-
- static std::string stateToString(InterpreterState state);
-
- Arabica::DOM::Element<std::string> getState(const std::string& stateId);
- Arabica::XPath::NodeSet<std::string> getStates(const std::list<std::string>& stateIds);
- Arabica::XPath::NodeSet<std::string> getAllStates();
-
- Arabica::XPath::NodeSet<std::string> getDocumentInitialTransitions();
- Arabica::XPath::NodeSet<std::string> getInitialStates(Arabica::DOM::Element<std::string> state = Arabica::DOM::Element<std::string>());
- Arabica::XPath::NodeSet<std::string> getReachableStates();
-
- static Arabica::XPath::NodeSet<std::string> getChildStates(const Arabica::DOM::Node<std::string>& state);
- static Arabica::XPath::NodeSet<std::string> getChildStates(const Arabica::XPath::NodeSet<std::string>& state);
- static Arabica::DOM::Element<std::string> getParentState(const Arabica::DOM::Node<std::string>& element);
- static Arabica::DOM::Node<std::string> getAncestorElement(const Arabica::DOM::Node<std::string>& node, const std::string tagName);
- virtual Arabica::XPath::NodeSet<std::string> getTargetStates(const Arabica::DOM::Element<std::string>& transition);
- virtual Arabica::XPath::NodeSet<std::string> getTargetStates(const Arabica::XPath::NodeSet<std::string>& transitions);
- virtual Arabica::DOM::Node<std::string> getSourceState(const Arabica::DOM::Element<std::string>& transition);
-
- Arabica::DOM::Node<std::string> findLCCA(const Arabica::XPath::NodeSet<std::string>& states);
- virtual Arabica::XPath::NodeSet<std::string> getProperAncestors(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2);
-
- virtual void handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event);
-
- std::vector<std::string> getReachableTargets() {
-
- std::vector<std::string> e;
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- Arabica::XPath::NodeSet<std::string> possibleTransitions = DOMUtils::filterChildElements( "transition", _configuration, false);
-
- for( size_t i = 0; i < possibleTransitions.size(); i++ ) {
- Arabica::DOM::Node<std::string> transitions = possibleTransitions[ i ];
- Arabica::DOM::NamedNodeMap<std::string> attributes = transitions.getAttributes();
- Arabica::DOM::Node<std::string> events = attributes.getNamedItem("target");
- e.push_back( std::string( events.getNodeValue() ) );
- }
- return e;
-
- }
-
- std::vector<std::string> getEventDescriptors() {
-
- std::vector<std::string> e;
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- Arabica::XPath::NodeSet<std::string> possibleTransitions = DOMUtils::filterChildElements( "transition", _configuration, false);
-
- for( size_t i = 0; i < possibleTransitions.size(); i++ ) {
- Arabica::DOM::Node<std::string> transitions = possibleTransitions[ i ];
- Arabica::DOM::NamedNodeMap<std::string> attributes = transitions.getAttributes();
- Arabica::DOM::Node<std::string> events = attributes.getNamedItem("event");
- e.push_back( std::string( events.getNodeValue() ) );
- }
- return e;
-
- }
-
-protected:
- static void run(void*); // static method for thread to run
-
- class DOMEventListener : public Arabica::DOM::Events::EventListener<std::string> {
- public:
- DOMEventListener() : _interpreter(NULL) {}
- void handleEvent(Arabica::DOM::Events::Event<std::string>& event);
- InterpreterImpl* _interpreter;
- };
-
- InterpreterImpl();
- void init();
- void setupDOM();
- void resolveXIncludes();
- void resolveXIncludes(std::list<std::string> includeChain,
- std::map<std::string, std::string>& mergedNS,
- const std::string& xIncludeNS,
- const URL& baseURL,
- const Arabica::DOM::Element<std::string>& xinclude);
- virtual void setupIOProcessors();
-
- std::list<InterpreterIssue> validate();
-
- void initializeData(const Arabica::DOM::Element<std::string>& data);
- void finalizeAndAutoForwardCurrentEvent();
- void stabilize();
- void microstep(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- void exitInterpreter();
-
- virtual Arabica::XPath::NodeSet<std::string> selectEventlessTransitions();
- virtual Arabica::XPath::NodeSet<std::string> selectTransitions(const std::string& event);
- virtual bool isEnabledTransition(const Arabica::DOM::Element<std::string>& transition, const std::string& event);
-
- void setInterpreterState(InterpreterState newState);
-
- bool _stable;
- tthread::thread* _thread;
- tthread::recursive_mutex _mutex;
- tthread::condition_variable _condVar;
- tthread::recursive_mutex _pluginMutex;
-
- // to be overwritten by implementations - these ought to be pure, but impl destructor runs first
- virtual void enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {}
- virtual void exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {}
- virtual Arabica::XPath::NodeSet<std::string> removeConflictingTransitions(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- return enabledTransitions;
- }
-
- InterpreterState _state;
-
- URL _sourceURL;
- std::map<Arabica::DOM::Node<std::string>, URL> _baseURL; // with xi:include, we might have different base URLs
- Arabica::DOM::Document<std::string> _document;
- Arabica::DOM::Element<std::string> _scxml;
- Arabica::XPath::XPath<std::string> _xpath;
- NameSpaceInfo _nsInfo;
-
- bool _topLevelFinalReached;
- bool _isInitialized;
- bool _domIsSetup;
- bool _userSuppliedDataModel;
- std::set<std::string> _dontDestructOnUninvoke;
-
- bool _isStarted;
- bool _isRunning;
-
- InterpreterImpl::Binding _binding;
- Arabica::XPath::NodeSet<std::string> _configuration;
- Arabica::XPath::NodeSet<std::string> _alreadyEntered;
- Arabica::XPath::NodeSet<std::string> _statesToInvoke;
- std::list<std::string> _startConfiguration;
- InvokeRequest _invokeReq;
-
- DataModel _dataModel;
- std::map<std::string, Arabica::XPath::NodeSet<std::string> > _historyValue;
-
- std::list<Event > _internalQueue;
- uscxml::concurrency::BlockingQueue<Event> _externalQueue;
- uscxml::concurrency::BlockingQueue<SendRequest>* _parentQueue;
- DelayedEventQueue* _sendQueue;
-
- DOMEventListener _domEventListener;
-
- Event _currEvent;
- Factory* _factory;
- InterpreterHTTPServlet* _httpServlet;
- InterpreterWebSocketServlet* _wsServlet;
- std::set<InterpreterMonitor*> _monitors;
- std::set<std::string> _microstepConfigurations;
-
- long _lastRunOnMainThread;
- std::string _name;
- std::string _sessionId;
- unsigned int _capabilities;
-
- Data _cmdLineOptions;
-
- virtual void executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow = false);
- virtual void executeContent(const Arabica::DOM::NodeList<std::string>& content, bool rethrow = false);
- virtual void executeContent(const Arabica::XPath::NodeSet<std::string>& content, bool rethrow = false);
-
- void processContentElement(const Arabica::DOM::Element<std::string>& element,
- Arabica::DOM::Node<std::string>& dom,
- std::string& text,
- std::string& expr);
- void processParamChilds(const Arabica::DOM::Element<std::string>& element,
- std::multimap<std::string, Data>& params);
- void processDOMorText(const Arabica::DOM::Element<std::string>& element,
- Arabica::DOM::Node<std::string>& dom,
- std::string& text);
-
- virtual void send(const Arabica::DOM::Element<std::string>& element);
- virtual void invoke(const Arabica::DOM::Element<std::string>& element);
- virtual void cancelInvoke(const Arabica::DOM::Element<std::string>& element);
- virtual void internalDoneSend(const Arabica::DOM::Element<std::string>& state, const Arabica::DOM::Element<std::string>& doneData);
- static void delayedSend(void* userdata, std::string eventName);
- void returnDoneEvent(const Arabica::DOM::Node<std::string>& state);
-
- bool hasConditionMatch(const Arabica::DOM::Element<std::string>& conditional);
- bool isInFinalState(const Arabica::DOM::Element<std::string>& state);
- bool parentIsScxmlState(const Arabica::DOM::Element<std::string>& state);
-
- IOProcessor getIOProcessor(const std::string& type);
- const URL& getBaseURLForNode(const Arabica::DOM::Node<std::string>& node);
-
- std::map<std::string, IOProcessor> _ioProcessors;
- std::map<std::string, std::pair<InterpreterImpl*, SendRequest> > _sendIds;
- std::map<std::string, Invoker> _invokers;
- std::map<Arabica::DOM::Node<std::string>, ExecutableContent> _executableContent;
- std::set<DataModelExtension*> _dataModelExtensions;
-
- std::map<std::pair<Arabica::DOM::Node<std::string>, Arabica::DOM::Node<std::string> >, Arabica::XPath::NodeSet<std::string> > _cachedProperAncestors;
- std::map<Arabica::DOM::Element<std::string>, Arabica::XPath::NodeSet<std::string> > _cachedTargets;
- std::map<std::string, Arabica::DOM::Element<std::string> > _cachedStates;
- std::map<std::string, URL> _cachedURLs;
-
- friend class USCXMLInvoker;
- friend class SCXMLIOProcessor;
- friend class Interpreter;
- friend class InterpreterIssue;
};
class USCXML_API Interpreter {
public:
- static Interpreter fromDOM(const Arabica::DOM::Document<std::string>& dom,
- const NameSpaceInfo& nameSpaceInfo,
- const std::string& sourceURL);
+ static Interpreter fromDocument(xercesc::DOMDocument* dom,
+ const std::string& baseURL,
+ bool copy = true);
+ static Interpreter fromElement(xercesc::DOMElement* element,
+ const std::string& baseURL);
static Interpreter fromXML(const std::string& xml,
- const std::string& sourceURL);
+ const std::string& baseURL);
static Interpreter fromURL(const std::string& URL);
static Interpreter fromClone(const Interpreter& other);
- Interpreter() : _impl() {} // the empty, invalid interpreter
- Interpreter(boost::shared_ptr<InterpreterImpl> const impl) : _impl(impl) { }
- Interpreter(const Interpreter& other) : _impl(other._impl) { }
- virtual ~Interpreter() {};
-
- operator bool() const {
- return (!!_impl && _impl->_state != USCXML_DESTROYED);
- }
- bool operator< (const Interpreter& other) const {
- return _impl < other._impl;
- }
- bool operator==(const Interpreter& other) const {
- return _impl == other._impl;
- }
- bool operator!=(const Interpreter& other) const {
- return _impl != other._impl;
- }
- Interpreter& operator= (const Interpreter& other) {
- _impl = other._impl;
- return *this;
- }
-
- virtual void writeTo(std::ostream& stream) {
- TIME_BLOCK
- return _impl->writeTo(stream);
- }
+ PIMPL_OPERATORS(Interpreter);
void reset() {
-#ifdef BUILD_PROFILING
- timer = Timer();
-#endif
return _impl->reset();
}
- std::vector<std::string> getReachableTargets() {
- return _impl->getReachableTargets();
- }
-
- std::vector<std::string> getEventDescriptors() {
- return _impl->getEventDescriptors();
- }
-
- void start() {
- return _impl->start();
- }
- void stop() {
- return _impl->stop();
- }
-// void join() {
-// return _impl->join();
-// };
- bool isRunning() {
- return _impl->isRunning();
- }
-
- void interpret() {
- _impl->interpret();
- };
-
- InterpreterState step(int waitForMS = 0) {
- TIME_BLOCK
- return _impl->step(waitForMS);
- };
-
- InterpreterState step(bool blocking) {
- TIME_BLOCK
- if (blocking)
- return _impl->step(-1);
- return _impl->step(0);
+ InterpreterState step(bool blocking = false) {
+ return _impl->step(blocking);
};
- std::list<InterpreterIssue> validate() {
- TIME_BLOCK
- return _impl->validate();
- }
-
- InterpreterState getState() {
- return _impl->getInterpreterState();
- }
-
- void addMonitor(InterpreterMonitor* monitor) {
- return _impl->addMonitor(monitor);
- }
-
- void removeMonitor(InterpreterMonitor* monitor) {
- return _impl->removeMonitor(monitor);
- }
-
- void setSourceURL(std::string sourceURL) {
- return _impl->setSourceURL(sourceURL);
- }
- std::string getSourceURL() {
- return _impl->getSourceURL();
- }
-
- std::string getBaseURL() {
- return _impl->getBaseURL();
- }
- std::string getBaseURL(const std::string& xpathExpr) {
- return _impl->getBaseURL(xpathExpr);
- }
- std::string getBaseURL(const Arabica::DOM::Node<std::string>& refNode) {
- return _impl->getBaseURL(refNode);
- }
-
- void setNameSpaceInfo(const NameSpaceInfo& nsInfo) {
- _impl->setNameSpaceInfo(nsInfo);
- }
- NameSpaceInfo getNameSpaceInfo() const {
- return _impl->getNameSpaceInfo();
- }
-
- void setCmdLineOptions(std::map<std::string, std::string> params) {
- return _impl->setCmdLineOptions(params);
- }
- Data getCmdLineOptions() {
- return _impl->getCmdLineOptions();
+ void cancel() {
+ return _impl->cancel();
}
- InterpreterHTTPServlet* getHTTPServlet() {
- return _impl->getHTTPServlet();
- }
-
- void setDataModel(const DataModel& dataModel) {
- _impl->setDataModel(dataModel);
- }
- DataModel getDataModel() {
- return _impl->getDataModel();
- }
-
- void addIOProcessor(IOProcessor ioProc) {
- _impl->addIOProcessor(ioProc);
- }
- const std::map<std::string, IOProcessor>& getIOProcessors() {
- return _impl->getIOProcessors();
- }
-
- void setInvoker(const std::string& invokeId, Invoker invoker) {
- _impl->setInvoker(invokeId, invoker);
- }
- const std::map<std::string, Invoker>& getInvokers() {
- return _impl->getInvokers();
- }
-
- void addDataModelExtension(DataModelExtension* ext) {
- _impl->addDataModelExtension(ext);
- }
-
-
- void setParentQueue(uscxml::concurrency::BlockingQueue<SendRequest>* parentQueue) {
- return _impl->setParentQueue(parentQueue);
- }
- void setFactory(Factory* factory) {
- return _impl->setFactory(factory);
- }
- Factory* getFactory() {
- return _impl->getFactory();
- }
- Arabica::XPath::NodeSet<std::string> getNodeSetForXPath(const std::string& xpathExpr) {
- TIME_BLOCK
- return _impl->getNodeSetForXPath(xpathExpr);
- }
-
- void inline receiveInternal(const Event& event) {
- TIME_BLOCK
- return _impl->receiveInternal(event);
- }
- void receive(const Event& event, bool toFront = false) {
- TIME_BLOCK
- return _impl->receive(event, toFront);
- }
-
- Event getCurrentEvent() {
- TIME_BLOCK
- return _impl->getCurrentEvent();
- }
-
- bool isInState(const std::string& stateId) {
- TIME_BLOCK
+ virtual bool isInState(const std::string& stateId) {
return _impl->isInState(stateId);
}
- Arabica::XPath::NodeSet<std::string> getConfiguration() {
- TIME_BLOCK
- return _impl->getConfiguration();
- }
-
- Arabica::XPath::NodeSet<std::string> getBasicConfiguration() {
- TIME_BLOCK
- return _impl->getBasicConfiguration();
- }
-
- void setInitalConfiguration(const std::list<std::string>& states) {
- TIME_BLOCK
- return _impl->setInitalConfiguration(states);
- }
-
-// Arabica::DOM::Node<std::string> getState(const std::string& stateId) {
-// return _impl->getState(stateId);
-// }
-// Arabica::XPath::NodeSet<std::string> getStates(const std::list<std::string>& stateIds) {
-// return _impl->getStates(stateIds);
-// }
-// Arabica::XPath::NodeSet<std::string> getAllStates() {
-// return _impl->getAllStates();
-// }
-
- Arabica::DOM::Document<std::string> getDocument() const {
- return _impl->getDocument();
- }
-
- void setCapabilities(unsigned int capabilities) {
- return _impl->setCapabilities(capabilities);
- }
-
- void setName(const std::string& name) {
- return _impl->setName(name);
+ InterpreterState getState() {
+ return _impl->getState();
}
- const std::string& getName() {
- return _impl->getName();
- }
- const std::string& getSessionId() {
- return _impl->getSessionId();
- }
- DelayedEventQueue* getDelayQueue() {
- return _impl->getDelayQueue();
+ std::list<xercesc::DOMElement*> getConfiguration() {
+ return _impl->getConfiguration();
}
- bool runOnMainThread(int fps, bool blocking = true) {
- TIME_BLOCK
- return _impl->runOnMainThread(fps, blocking);
+ virtual void receive(const Event& event) {
+ _impl->enqueueExternal(event);
}
- bool hasLegalConfiguration() {
- TIME_BLOCK
- return _impl->hasLegalConfiguration();
+ void setActionLanguage(ActionLanguage actionLanguage) {
+ return _impl->setActionLanguage(actionLanguage);
}
- bool isLegalConfiguration(const Arabica::XPath::NodeSet<std::string>& config) {
- TIME_BLOCK
- return _impl->isLegalConfiguration(config);
+ void setMonitor(InterpreterMonitor* monitor) {
+ return _impl->setMonitor(monitor);
}
- bool isLegalConfiguration(const std::list<std::string>& config) {
- TIME_BLOCK
- return _impl->isLegalConfiguration(config);
+ std::list<InterpreterIssue> validate() {
+ return InterpreterIssue::forInterpreter(_impl.get());
}
- boost::shared_ptr<InterpreterImpl> getImpl() const {
+ std::shared_ptr<InterpreterImpl> getImpl() const {
return _impl;
}
- static std::map<std::string, boost::weak_ptr<InterpreterImpl> > getInstances();
- static void addInstance(boost::shared_ptr<InterpreterImpl> instance);
-
-#ifdef BUILD_PROFILING
- Timer timer;
-#endif
-
-
protected:
+ std::shared_ptr<InterpreterImpl> _impl;
- void setInvokeRequest(const InvokeRequest& req) {
- return _impl->setInvokeRequest(req);
- }
-
- // we use a void ptr here as Arabica::SAX::InputSource complicates includes
- static Interpreter fromInputSource(void* source, const std::string& sourceURL);
-
- boost::shared_ptr<InterpreterImpl> _impl;
- static std::map<std::string, boost::weak_ptr<InterpreterImpl> > _instances;
- static tthread::recursive_mutex _instanceMutex;
};
-class USCXML_API InterpreterMonitor {
+class USCXML_API StateTransitionMonitor : public uscxml::InterpreterMonitor {
public:
- InterpreterMonitor() : _copyToInvokers(false) {}
- virtual ~InterpreterMonitor() {}
-
- virtual void beforeProcessingEvent(Interpreter interpreter, const Event& event) {}
- virtual void beforeMicroStep(Interpreter interpreter) {}
-
- virtual void beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {}
- virtual void afterExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {}
-
- virtual void beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element) {}
- virtual void afterExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element) {}
-
- virtual void beforeUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {}
- virtual void afterUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {}
-
- virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {}
- virtual void afterTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {}
+ StateTransitionMonitor(Interpreter interpreter) : _interpreter(interpreter) {}
+ virtual ~StateTransitionMonitor() {}
- virtual void beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {}
- virtual void afterEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {}
-
- virtual void beforeInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {}
- virtual void afterInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {}
-
- virtual void afterMicroStep(Interpreter interpreter) {}
-
- virtual void onStableConfiguration(Interpreter interpreter) {}
-
- virtual void beforeCompletion(Interpreter interpreter) {}
- virtual void afterCompletion(Interpreter interpreter) {}
-
- virtual void reportIssue(Interpreter interpreter, const InterpreterIssue& issue) {}
-
- void copyToInvokers(bool copy) {
- _copyToInvokers = copy;
- }
-
- bool copyToInvokers() {
- return _copyToInvokers;
- }
-
-protected:
- bool _copyToInvokers;
-
-};
-
-class StateTransitionMonitor : public uscxml::InterpreterMonitor {
-public:
- virtual void beforeTakingTransition(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
- virtual void beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element);
- virtual void onStableConfiguration(uscxml::Interpreter interpreter);
- virtual void beforeProcessingEvent(uscxml::Interpreter interpreter, const uscxml::Event& event);
- virtual void beforeExitingState(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeEnteringState(uscxml::Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeMicroStep(uscxml::Interpreter interpreter);
+ virtual void beforeTakingTransition(const xercesc::DOMElement* transition);
+ virtual void beforeExecutingContent(const xercesc::DOMElement* element);
+ virtual void onStableConfiguration();
+ virtual void beforeProcessingEvent(const uscxml::Event& event);
+ virtual void beforeExitingState(const xercesc::DOMElement* state);
+ virtual void beforeEnteringState(const xercesc::DOMElement* state);
+ virtual void beforeMicroStep();
protected:
- static tthread::recursive_mutex _mutex;
- void printNodeSet(const Arabica::XPath::NodeSet<std::string>& config);
- Arabica::XPath::NodeSet<std::string> exitingStates;
- Arabica::XPath::NodeSet<std::string> enteringStates;
+ Interpreter _interpreter;
+ static std::recursive_mutex _mutex;
};
}
-#endif
+#endif /* end of include guard: INTERPRETER_H_6CD5A168 */
diff --git a/src/uscxml/InterpreterInfo.h b/src/uscxml/InterpreterInfo.h
deleted file mode 100644
index 190ac0c..0000000
--- a/src/uscxml/InterpreterInfo.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * @file
- * @author 2012-2015 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef INTERPRETERINFO_H_CED68EFF
-#define INTERPRETERINFO_H_CED68EFF
-
-#include <iostream>
-
-#include "uscxml/plugins/IOProcessor.h"
-#include "uscxml/plugins/Invoker.h"
-
-#include <XPath/XPath.hpp>
-#include <DOM/Document.hpp>
-
-
-namespace uscxml {
-
-class USCXML_API NameSpaceInfo {
-public:
- NameSpaceInfo() : nsContext(NULL) {
- init(std::map<std::string, std::string>());
- }
-
- NameSpaceInfo(const std::map<std::string, std::string>& nsInfo) : nsContext(NULL) {
- init(nsInfo);
- }
-
- NameSpaceInfo(const NameSpaceInfo& other) : nsContext(NULL) {
- init(other.nsInfo);
- }
-
- virtual ~NameSpaceInfo() {
- if (nsContext)
- delete nsContext;
- }
-
- NameSpaceInfo& operator=( const NameSpaceInfo& other ) {
- init(other.nsInfo);
- return *this;
- }
-
- void setPrefix(Arabica::DOM::Element<std::string> element) {
- if (nsURL.size() > 0)
- element.setPrefix(nsToPrefix[nsURL]);
- }
-
- void setPrefix(Arabica::DOM::Attr<std::string> attribute) {
- if (nsURL.size() > 0)
- attribute.setPrefix(nsToPrefix[nsURL]);
- }
-
- std::string getXMLPrefixForNS(const std::string& ns) const {
- if (nsToPrefix.find(ns) != nsToPrefix.end() && nsToPrefix.at(ns).size())
- return nsToPrefix.at(ns) + ":";
- return "";
- }
-
- const Arabica::XPath::StandardNamespaceContext<std::string>* getNSContext() {
- return nsContext;
- }
-
- std::string nsURL; // ough to be "http://www.w3.org/2005/07/scxml" but maybe empty
- std::string xpathPrefix; // prefix mapped for xpath, "scxml" is _xmlNSPrefix is empty but _nsURL set
- std::string xmlNSPrefix; // the actual prefix for elements in the xml file
- std::map<std::string, std::string> nsToPrefix; // prefixes for a given namespace
- std::map<std::string, std::string> nsInfo; // all xmlns mappings
-
-private:
- Arabica::XPath::StandardNamespaceContext<std::string>* nsContext;
-
- void init(const std::map<std::string, std::string>& nsInfo);
-};
-
-class USCXML_API InterpreterInfo {
-public:
- virtual NameSpaceInfo getNameSpaceInfo() const = 0;
- virtual const std::string& getName() = 0;
- virtual const std::string& getSessionId() = 0;
- virtual const std::map<std::string, IOProcessor>& getIOProcessors() = 0;
- virtual bool isInState(const std::string& stateId) = 0;
- virtual Arabica::DOM::Document<std::string> getDocument() const = 0;
- virtual const std::map<std::string, Invoker>& getInvokers() = 0;
-};
-
-}
-
-#endif /* end of include guard: INTERPRETERINFO_H_CED68EFF */
diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h
deleted file mode 100644
index 5732857..0000000
--- a/src/uscxml/Message.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef EVENT_H_XZAQ4HR
-#define EVENT_H_XZAQ4HR
-
-#include "uscxml/messages/Blob.h"
-#include "uscxml/messages/Data.h"
-#include "uscxml/messages/Event.h"
-#include "uscxml/messages/SendRequest.h"
-#include "uscxml/messages/InvokeRequest.h"
-
-
-#endif /* end of include guard: EVENT_H_XZAQ4HR */
diff --git a/src/uscxml/URL.h b/src/uscxml/URL.h
deleted file mode 100644
index dacf0db..0000000
--- a/src/uscxml/URL.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef URL_H_9DAEGSMV
-#define URL_H_9DAEGSMV
-
-#include <curl/curl.h>
-#include <string>
-#include <iostream>
-#include <map>
-#include <vector>
-#include <set>
-
-#include "uscxml/messages/Data.h"
-#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>
-
-namespace uscxml {
-
-class URL;
-
-class USCXML_API 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 USCXML_API URLImpl : public boost::enable_shared_from_this<URLImpl> {
-public:
- 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 file() const;
- const std::vector<std::string> pathComponents() const {
- return _pathComponents;
- }
- 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);
-
- 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 getInHeaderField(const std::string& key);
- const std::string getStatusCode();
- const std::string getStatusMessage();
-
-
- const std::string getInContent(bool forceReload = false);
- const void download(bool blocking = false);
-
- void downloadStarted();
- void downloadCompleted();
- void downloadFailed(CURLcode errorCode);
-
- bool downloadFailed() {
- return _hasFailed;
- }
- operator Data() const;
-
- friend class URLFetcher;
-
-protected:
- URLImpl() : _handle(NULL), _isDownloaded(false), _hasFailed(false) {}
- std::string getLocalFilename(const std::string& suffix);
-
- CURL* getCurlHandle();
-
- std::string _outContent;
- std::map<std::string, std::string> _outHeader;
- std::string _requestType;
-
- CURL* _handle;
- std::stringstream _rawInContent;
- std::stringstream _rawInHeader;
-
- std::string _statusCode;
- std::string _statusMsg;
- std::map<std::string, std::string> _inHeaders;
-
- Arabica::io::URI _uri;
- std::vector<std::string> _pathComponents;
-
- bool _isDownloaded;
- bool _hasFailed;
-
- std::string _localFile;
- std::string _error;
-
- tthread::condition_variable _condVar;
- tthread::recursive_mutex _mutex;
-
- std::set<URLMonitor*> _monitors;
- typedef std::set<URLMonitor*>::iterator monIter_t;
-};
-
-class USCXML_API 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;
- }
-
- const std::map<std::string, std::string> getInHeaderFields() const {
- return _impl->getInHeaderFields();
- }
- const std::string getInHeaderField(const std::string& key) const {
- return _impl->getInHeaderField(key);
- }
- const std::string getStatusCode() const {
- return _impl->getStatusCode();
- }
- const std::string getStatusMessage() const {
- return _impl->getStatusMessage();
- }
-
- 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 asBaseURL(const URL& url);
- static void toBaseURL(URL& uri);
-
- static std::string getResourceDir();
- static std::string getTmpFilename(const std::string& suffix = "");
-
- static URL toLocalFile(const std::string& content, const std::string& suffix) {
- boost::shared_ptr<URLImpl> impl = URLImpl::toLocalFile(content, suffix);
- return URL(impl);
- }
-
- void dump();
-
- void addMonitor(URLMonitor* monitor) {
- _impl->addMonitor(monitor);
- }
- void removeMonitor(URLMonitor* monitor) {
- _impl->removeMonitor(monitor);
- }
-
- bool downloadFailed() {
- return _impl->downloadFailed();
- }
-
- 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::vector<std::string> pathComponents() const {
- return _impl->pathComponents();
- }
- const std::string file() const {
- return _impl->file();
- }
-
- const std::string asString() const {
- if (_impl)
- return _impl->asString();
- return "";
- }
-
- static std::string tmpDir();
- static std::map<std::string, std::string> mimeTypes;
- static std::string getMimeType(const std::string extension, std::string magic = "");
-
- friend class URLFetcher;
- friend USCXML_API std::ostream & operator<<(std::ostream &stream, const URL& p);
-
- operator Data() const {
- return _impl->operator Data();
- }
-
- operator std::string() const {
- return asString();
- }
-
-protected:
- void downloadStarted() {
- return _impl->downloadStarted();
- }
- void downloadCompleted() {
- return _impl->downloadCompleted();
- }
- void downloadFailed(CURLcode errorCode) {
- return _impl->downloadFailed(errorCode);
- }
-
- boost::shared_ptr<URLImpl> _impl;
-};
-
-class USCXML_API URLFetcher {
-public:
- URLFetcher();
- ~URLFetcher();
-
- static void fetchURL(URL& url);
- static void breakURL(URL& url);
-
- void start();
- void stop();
-
-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;
- char* _envProxy;
-};
-
-USCXML_API std::ostream& operator<< (std::ostream &stream, const URL& p);
-
-}
-
-#endif /* end of include guard: URL_H_9DAEGSMV */
diff --git a/src/uscxml/URL.mm b/src/uscxml/URL.mm
deleted file mode 100644
index 3bd1607..0000000
--- a/src/uscxml/URL.mm
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "URL.h"
-#include "Foundation/Foundation.h"
-
-#ifdef __has_feature
-# if __has_feature(objc_arc)
-# define(HAS_AUTORELEASE_POOL)
-# endif
-#endif
-
-namespace uscxml {
-
-std::string URL::getResourceDir() {
- std::string path;
-#if HAS_AUTORELEASE_POOL
- @autoreleasepool {
-#else
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-#endif
- NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
- path = [resourcePath cStringUsingEncoding:NSUTF8StringEncoding];
-
-#if HAS_AUTORELEASE_POOL
- }
-#else
- [pool drain];
-#endif
- return path;
-}
-
-}
diff --git a/src/uscxml/concurrency/BlockingQueue.h b/src/uscxml/concurrency/BlockingQueue.h
deleted file mode 100644
index e53de25..0000000
--- a/src/uscxml/concurrency/BlockingQueue.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef BLOCKINGQUEUE_H_4LEVMY0N
-#define BLOCKINGQUEUE_H_4LEVMY0N
-
-#include "uscxml/Common.h"
-#include "uscxml/concurrency/tinythread.h"
-#include <list>
-
-namespace uscxml {
-namespace concurrency {
-
-template <class T>
-class BlockingQueue {
-public:
- BlockingQueue() {}
- virtual ~BlockingQueue() {
- }
-
- virtual void push(const T& elem) {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
- _queue.push_back(elem);
- _cond.notify_all();
- }
-
- virtual void push_front(const T& elem) {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
- _queue.push_front(elem);
- _cond.notify_all();
- }
-
- virtual T pop() {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
-// std::cout << "Popping from " << this << std::endl;
- while (_queue.empty()) {
- _cond.wait(_mutex);
- }
- T ret = _queue.front();
- _queue.pop_front();
- return ret;
- }
-
- virtual void clear() {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
- _queue.clear();
- }
-
- virtual bool isEmpty() {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
- return _queue.empty();
- }
-
-protected:
- tthread::mutex _mutex;
- tthread::condition_variable _cond;
- std::list<T> _queue;
-};
-
-}
-}
-
-#endif /* end of include guard: BLOCKINGQUEUE_H_4LEVMY0N */
diff --git a/src/uscxml/concurrency/DelayedEventQueue.cpp b/src/uscxml/concurrency/DelayedEventQueue.cpp
deleted file mode 100644
index 897e99d..0000000
--- a/src/uscxml/concurrency/DelayedEventQueue.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "DelayedEventQueue.h"
-#include "uscxml/messages/Event.h"
-
-#include <glog/logging.h>
-
-#include <event2/event.h>
-#include "event2/thread.h"
-
-namespace uscxml {
-
-DelayedEventQueue::DelayedEventQueue() {
-#ifndef _WIN32
- evthread_use_pthreads();
-#else
- evthread_use_windows_threads();
-#endif
- _eventLoop = event_base_new();
- _thread = NULL;
- _isStarted = false;
-}
-
-DelayedEventQueue::~DelayedEventQueue() {
-// std::cout << "Deleting DelayedEventQueue" << std::endl;
- stop();
- if (_thread && _isStarted)
- _thread->join();
- if(_eventLoop)
- event_base_free(_eventLoop);
-}
-
-void DelayedEventQueue::run(void* instance) {
- DelayedEventQueue* INSTANCE = (DelayedEventQueue*)instance;
- int result;
- while(INSTANCE->_isStarted) {
-// #ifndef EVLOOP_NO_EXIT_ON_EMPTY
-// result = event_base_dispatch(INSTANCE->_eventLoop);
-// #else
- result = event_base_loop(INSTANCE->_eventLoop, EVLOOP_NO_EXIT_ON_EMPTY);
-//#endif
- (void)result;
- }
-}
-
-void DelayedEventQueue::addEvent(std::string eventId, int fd, short opMask, void (*callback)(void*, const std::string eventId), void* userData, bool persist) {
- if(_callbackData.find(eventId) != _callbackData.end()) {
- cancelEvent(eventId);
- }
-
- if (persist)
- opMask |= EV_PERSIST;
-
- struct event* event = event_new(_eventLoop, fd, opMask, DelayedEventQueue::fileCallback, &_callbackData[eventId]);
-
- _callbackData[eventId].eventId = eventId;
- _callbackData[eventId].userData = userData;
- _callbackData[eventId].eventQueue = this;
- _callbackData[eventId].callback = callback;
- _callbackData[eventId].event = event;
- _callbackData[eventId].persist = false;
-
- event_add(event, NULL);
-
-}
-
-void DelayedEventQueue::addEvent(std::string eventId, void (*callback)(void*, const std::string eventId), uint32_t delayMs, void* userData, bool persist) {
- if(_callbackData.find(eventId) != _callbackData.end()) {
- cancelEvent(eventId);
- }
-
- struct timeval delay = {delayMs / 1000, (delayMs % 1000) * 1000};
- struct event* event = event_new(_eventLoop, -1, (persist ? EV_PERSIST : 0), DelayedEventQueue::timerCallback, &_callbackData[eventId]);
-
- _callbackData[eventId].eventId = eventId;
- _callbackData[eventId].userData = userData;
- _callbackData[eventId].eventQueue = this;
- _callbackData[eventId].callback = callback;
- _callbackData[eventId].event = event;
- _callbackData[eventId].persist = persist;
-
- event_add(event, &delay);
-}
-
-void DelayedEventQueue::cancelAllEvents() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- while(_callbackData.size() > 0) {
- event_del(_callbackData[_callbackData.begin()->first].event);
- event_free(_callbackData[_callbackData.begin()->first].event);
- _callbackData.erase(_callbackData.begin());
- }
-}
-
-void DelayedEventQueue::cancelEvent(std::string eventId) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- if(_callbackData.find(eventId) != _callbackData.end()) {
- event_del(_callbackData[eventId].event);
- event_free(_callbackData[eventId].event);
- _callbackData.erase(eventId);
- }
-}
-
-void DelayedEventQueue::start() {
- _isStarted = true;
- _thread = new tthread::thread(DelayedEventQueue::run, this);
-}
-
-void DelayedEventQueue::stop() {
- if (_isStarted) {
- _isStarted = false;
- event_base_loopbreak(_eventLoop);
- }
- if (_thread) {
- _thread->join();
- delete _thread;
- _thread = NULL;
- }
-}
-
-void DelayedEventQueue::dummyCallback(evutil_socket_t fd, short what, void *arg) {
-}
-
-void DelayedEventQueue::fileCallback(evutil_socket_t fd, short what, void *arg) {
- struct callbackData *data = (struct callbackData*)arg;
- tthread::lock_guard<tthread::recursive_mutex> lock(data->eventQueue->_mutex);
- std::string eventId = data->eventId; // copy eventId
- data->callback(data->userData, eventId);
-}
-
-void DelayedEventQueue::timerCallback(evutil_socket_t fd, short what, void *arg) {
- struct callbackData *data = (struct callbackData*)arg;
- tthread::lock_guard<tthread::recursive_mutex> lock(data->eventQueue->_mutex);
-
- std::string eventId = data->eventId; // copy eventId
- try {
- data->callback(data->userData, eventId);
- } catch (Event e) {
- LOG(ERROR) << "Exception thrown when executing delayed event:" << std::endl << e << std::endl;
- } catch (...) {
- LOG(ERROR) << "Exception thrown when executing delayed event" << std::endl;
- }
- if (!data->persist) {
- event_free(data->event);
- data->eventQueue->_callbackData.erase(data->eventId);
- }
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/concurrency/DelayedEventQueue.h b/src/uscxml/concurrency/DelayedEventQueue.h
deleted file mode 100644
index 7c2789f..0000000
--- a/src/uscxml/concurrency/DelayedEventQueue.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef DELAYEDEVENTQUEUE_H_JA6WRBVP
-#define DELAYEDEVENTQUEUE_H_JA6WRBVP
-
-#include "uscxml/concurrency/tinythread.h"
-
-
-#include "uscxml/Common.h"
-#include "event2/util.h" // for evutil_socket_t
-#include <event2/event.h>
-
-#include <inttypes.h>
-
-#include <map>
-#include <string>
-
-namespace uscxml {
-
-class USCXML_API DelayedEventQueue {
-public:
-
- enum OpMask {
- DEQ_READ = EV_READ,
- DEQ_WRITE = EV_WRITE,
- DEQ_SIGNAL = EV_SIGNAL
- };
-
- struct callbackData {
- void *userData;
- void (*callback)(void*, const std::string eventId);
- std::string eventId;
- bool persist;
- struct event *event;
- DelayedEventQueue* eventQueue;
- };
-
- DelayedEventQueue();
- virtual ~DelayedEventQueue();
-
- void addEvent(std::string eventId, int fd, short opMask, void (*callback)(void*, const std::string eventId), void* userData, bool persist = true);
- void addEvent(std::string eventId, void (*callback)(void*, const std::string eventId), uint32_t delayMs, void* userData, bool persist = false);
- void cancelEvent(std::string eventId);
- void cancelAllEvents();
-
- void start();
- void stop();
- static void run(void*);
-
- bool isEmpty() {
- return _callbackData.empty();
- }
-
- static void timerCallback(evutil_socket_t fd, short what, void *arg);
- static void fileCallback(evutil_socket_t fd, short what, void *arg);
- static void dummyCallback(evutil_socket_t fd, short what, void *arg);
-
- bool _isStarted;
- tthread::thread* _thread;
- tthread::recursive_mutex _mutex;
-
- std::map<std::string, callbackData> _callbackData;
- struct event_base* _eventLoop;
-};
-
-}
-
-
-#endif /* end of include guard: DELAYEDEVENTQUEUE_H_JA6WRBVP */
diff --git a/src/uscxml/concurrency/EventBase.cpp b/src/uscxml/concurrency/EventBase.cpp
deleted file mode 100644
index ec25181..0000000
--- a/src/uscxml/concurrency/EventBase.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "EventBase.h"
-
-namespace uscxml {
-
-std::map<std::string, boost::weak_ptr<EventBase> > EventBase::_eventBases;
-tthread::recursive_mutex EventBase::_instanceMutex;
-
-boost::shared_ptr<EventBase> EventBase::get(const std::string& name) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
-
- std::map<std::string, boost::weak_ptr<EventBase> >::iterator instIter = _eventBases.begin();
- while(instIter != _eventBases.end()) {
- if (!instIter->second.lock()) {
- _eventBases.erase(instIter++);
- } else {
- instIter++;
- }
- }
-
- instIter = _eventBases.find(name);
- boost::shared_ptr<EventBase> instance = instIter->second.lock();
- if (instance)
- return instance;
-
- instance = boost::shared_ptr<EventBase>(new EventBase());
- _eventBases.insert(std::make_pair(name, instance));
-
- return instance;
-}
-
-EventBase::EventBase() {
- base = event_base_new();
- _isStarted = true;
- _thread = new tthread::thread(EventBase::run, this);
-}
-
-void EventBase::run(void* arg) {
- EventBase* INSTANCE = (EventBase*)arg;
- int result;
-
- while(INSTANCE->_isStarted) {
- result = event_base_loop(INSTANCE->base, EVLOOP_NO_EXIT_ON_EMPTY);
- (void)result;
- }
-}
-
-EventBase::~EventBase() {
- _isStarted = false;
- event_base_loopbreak(base);
- _thread->join();
- event_base_free(base);
- delete _thread;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/concurrency/EventBase.h b/src/uscxml/concurrency/EventBase.h
deleted file mode 100644
index 22bd664..0000000
--- a/src/uscxml/concurrency/EventBase.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef EVENTBASE_H_C479DA74
-#define EVENTBASE_H_C479DA74
-
-#include "uscxml/Common.h"
-#include "uscxml/concurrency/tinythread.h"
-
-extern "C" {
-#include <event2/event.h>
-#include <event2/buffer.h>
-#include <event2/bufferevent.h>
-}
-
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-#include <map>
-#include <string>
-
-namespace uscxml {
-
-class USCXML_API EventBase {
-public:
- EventBase();
- virtual ~EventBase();
-
- static boost::shared_ptr<EventBase> get(const std::string& name);
- struct event_base* base;
-
-protected:
-
- static void run(void*);
-
- tthread::thread* _thread;
- bool _isStarted;
-
- static std::map<std::string, boost::weak_ptr<EventBase> > _eventBases;
- static tthread::recursive_mutex _instanceMutex;
-
-};
-
-}
-
-#endif /* end of include guard: EVENTBASE_H_C479DA74 */
diff --git a/src/uscxml/concurrency/Timer.cpp b/src/uscxml/concurrency/Timer.cpp
deleted file mode 100644
index 77b712f..0000000
--- a/src/uscxml/concurrency/Timer.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2013 Alex Reece.
-//
-// A cross platform monotonic timer.
-
-// see https://github.com/awreece/monotonic_timer
-
-#include "uscxml/config.h"
-#ifdef HAS_UNISTD_H
-#include <unistd.h>
-#endif
-#include "Timer.h"
-
-#define NANOS_PER_SECF 1000000000.0
-#define USECS_PER_SEC 1000000
-
-#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
-// If we have it, use clock_gettime and CLOCK_MONOTONIC.
-
-#include <time.h>
-
-double uscxml::Timer::monotonic_seconds() {
- struct timespec time;
- // Note: Make sure to link with -lrt to define clock_gettime.
- clock_gettime(CLOCK_MONOTONIC, &time);
- return ((double) time.tv_sec) + ((double) time.tv_nsec / (NANOS_PER_SECF));
-}
-
-#elif defined(__APPLE__)
-// If we don't have CLOCK_MONOTONIC, we might be on a Mac. There we instead
-// use mach_absolute_time().
-
-#include <mach/mach_time.h>
-
-static mach_timebase_info_data_t info;
-static void __attribute__((constructor)) init_info() {
- mach_timebase_info(&info);
-}
-
-double uscxml::Timer::monotonic_seconds() {
- uint64_t time = mach_absolute_time();
- double dtime = (double) time;
- dtime *= (double) info.numer;
- dtime /= (double) info.denom;
- return dtime / NANOS_PER_SECF;
-}
-
-#elif defined(_MSC_VER)
-// On Windows, use QueryPerformanceCounter and QueryPerformanceFrequency.
-
-#define NOMINMAX
-#include <windows.h>
-
-static double PCFreq = 0.0;
-__int64 CounterStart = 0;
-
-double uscxml::Timer::monotonic_seconds() {
- if (CounterStart == 0) {
- // Accoring to http://stackoverflow.com/a/1739265/447288, this will
- // properly initialize the QueryPerformanceCounter.
-
- LARGE_INTEGER li;
- int has_qpc = QueryPerformanceFrequency(&li);
-
- PCFreq = ((double) li.QuadPart) / 1000.0;
- }
- LARGE_INTEGER li;
- QueryPerformanceCounter(&li);
- return double(li.QuadPart - CounterStart)/PCFreq;
-}
-
-#else
-// Fall back to rdtsc. The reason we don't use clock() is this scary message
-// from the man page:
-// "On several other implementations, the value returned by clock() also
-// includes the times of any children whose status has been collected via
-// wait(2) (or another wait-type call)."
-//
-// Also, clock() only has microsecond accuracy.
-//
-// This whitepaper offered excellent advice on how to use rdtscp for
-// profiling: http://download.intel.com/embedded/software/IA/324264.pdf
-//
-// Unfortunately, we can't follow its advice exactly with our semantics,
-// so we're just going to use rdtscp with cpuid.
-//
-// Note that rdtscp will only be available on new processors.
-
-#include <stdint.h>
-
-static inline uint64_t rdtsc() {
- uint32_t hi, lo;
- asm volatile("rdtscp\n"
- "movl %%edx, %0\n"
- "movl %%eax, %1\n"
- "cpuid"
- : "=r" (hi), "=r" (lo) : : "%rax", "%rbx", "%rcx", "%rdx");
- return (((uint64_t)hi) << 32) | (uint64_t)lo;
-}
-
-static uint64_t rdtsc_per_sec = 0;
-static void __attribute__((constructor)) init_rdtsc_per_sec() {
- uint64_t before, after;
-
- before = rdtsc();
- usleep(USECS_PER_SEC);
- after = rdtsc();
-
- rdtsc_per_sec = after - before;
-}
-
-double uscxml::Timer::monotonic_seconds() {
- return (double) rdtsc() / (double) rdtsc_per_sec;
-}
-
-#endif
diff --git a/src/uscxml/concurrency/Timer.h b/src/uscxml/concurrency/Timer.h
deleted file mode 100644
index 1ecfeb2..0000000
--- a/src/uscxml/concurrency/Timer.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2013 Alex Reece.
-//
-// A cross platform monotonic timer.
-
-// see https://github.com/awreece/monotonic_timer
-
-#ifndef MONOTONIC_TIMER_H_
-#define MONOTONIC_TIMER_H_
-
-#include "uscxml/Common.h"
-
-// Returns seconds since some unspecified start time (guaranteed to be
-// monotonicly increasing).
-
-// Copyright 2015 Stefan Radomski.
-
-namespace uscxml {
-
-class USCXML_API Timer {
-public:
-
- static double monotonic_seconds();
-
- Timer() {
- invocations = 0;
- elapsed = 0;
- }
-
- void start() {
- if (invocations == 0) {
- started = monotonic_seconds();
- }
- invocations++;
- }
-
- void reset() {
- elapsed = 0;
- }
-
- void stop() {
- if (invocations == 0)
- return;
-
- invocations--;
- if (invocations == 0) {
- elapsed += monotonic_seconds() - started;
- }
- }
-
- ~Timer() {
- }
- double elapsed;
-
-protected:
- size_t invocations;
- double started;
-};
-
-class USCXML_API Measurement {
-public:
- Measurement(Timer* timer) : timer(timer) {
- timer->start();
- }
-
- ~Measurement() {
- timer->stop();
- }
-
-protected:
- Timer* timer;
-};
-
-}
-#endif // MONOTONIC_TIMER_H_
diff --git a/src/uscxml/concurrency/tinythread.cpp b/src/uscxml/concurrency/tinythread.cpp
deleted file mode 100644
index d46cda3..0000000
--- a/src/uscxml/concurrency/tinythread.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-/* -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; -*-
-Copyright (c) 2010-2012 Marcus Geelnard
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software. This version was altered!
-
- 3. This notice may not be removed or altered from any source
- distribution.
-*/
-
-#include <exception>
-#include "tinythread.h"
-
-#if defined(_TTHREAD_POSIX_)
-#include <unistd.h>
-#include <map>
-#elif defined(_TTHREAD_WIN32_)
-#include <process.h>
-#endif
-
-namespace tthread {
-
-unsigned long long int timeStamp() {
- unsigned long long int time = 0;
-#ifdef WIN32
- FILETIME tv;
- GetSystemTimeAsFileTime(&tv);
- time = (((unsigned long long int) tv.dwHighDateTime) << 32) + tv.dwLowDateTime;
- time /= 10000;
-#else
- struct timeval tv;
- gettimeofday(&tv, NULL);
- time += tv.tv_sec * 1000;
- time += tv.tv_usec / 1000;
-#endif
- return time;
-}
-
-//------------------------------------------------------------------------------
-// condition_variable
-//------------------------------------------------------------------------------
-// NOTE 1: The Win32 implementation of the condition_variable class is based on
-// the corresponding implementation in GLFW, which in turn is based on a
-// description by Douglas C. Schmidt and Irfan Pyarali:
-// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
-//
-// NOTE 2: Windows Vista actually has native support for condition variables
-// (InitializeConditionVariable, WakeConditionVariable, etc), but we want to
-// be portable with pre-Vista Windows versions, so TinyThread++ does not use
-// Vista condition variables.
-//------------------------------------------------------------------------------
-
-#if defined(_TTHREAD_WIN32_)
-#define _CONDITION_EVENT_ONE 0
-#define _CONDITION_EVENT_ALL 1
-#endif
-
-#if defined(_TTHREAD_WIN32_)
-condition_variable::condition_variable() : mWaitersCount(0) {
- mEvents[_CONDITION_EVENT_ONE] = CreateEvent(NULL, FALSE, FALSE, NULL);
- mEvents[_CONDITION_EVENT_ALL] = CreateEvent(NULL, TRUE, FALSE, NULL);
- InitializeCriticalSection(&mWaitersCountLock);
-}
-#endif
-
-#if defined(_TTHREAD_WIN32_)
-condition_variable::~condition_variable() {
- CloseHandle(mEvents[_CONDITION_EVENT_ONE]);
- CloseHandle(mEvents[_CONDITION_EVENT_ALL]);
- DeleteCriticalSection(&mWaitersCountLock);
-}
-#endif
-
-#if defined(_TTHREAD_WIN32_)
-void condition_variable::_wait(unsigned int ms) {
- if (ms <= 0)
- ms = INFINITE;
- // Wait for either event to become signaled due to notify_one() or
- // notify_all() being called
- int result = WaitForMultipleObjects(2, mEvents, FALSE, ms);
- if (result == WAIT_FAILED) {
- LPVOID lpMsgBuf;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL);
-// UM_LOG_ERR("%s", lpMsgBuf);
- LocalFree(lpMsgBuf);
-
- }
-
- // Check if we are the last waiter
- EnterCriticalSection(&mWaitersCountLock);
- -- mWaitersCount;
- bool lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) &&
- (mWaitersCount == 0);
- LeaveCriticalSection(&mWaitersCountLock);
-
- // If we are the last waiter to be notified to stop waiting, reset the event
- if(lastWaiter)
- ResetEvent(mEvents[_CONDITION_EVENT_ALL]);
-}
-#endif
-
-#if defined(_TTHREAD_WIN32_)
-void condition_variable::notify_one() {
- // Are there any waiters?
- EnterCriticalSection(&mWaitersCountLock);
- bool haveWaiters = (mWaitersCount > 0);
- LeaveCriticalSection(&mWaitersCountLock);
-
- // If we have any waiting threads, send them a signal
- if(haveWaiters)
- SetEvent(mEvents[_CONDITION_EVENT_ONE]);
-}
-#endif
-
-#if defined(_TTHREAD_WIN32_)
-void condition_variable::notify_all() {
- // Are there any waiters?
- EnterCriticalSection(&mWaitersCountLock);
- bool haveWaiters = (mWaitersCount > 0);
- LeaveCriticalSection(&mWaitersCountLock);
-
- // If we have any waiting threads, send them a signal
- if(haveWaiters)
- SetEvent(mEvents[_CONDITION_EVENT_ALL]);
-}
-#endif
-
-
-//------------------------------------------------------------------------------
-// POSIX pthread_t to unique thread::id mapping logic.
-// Note: Here we use a global thread safe std::map to convert instances of
-// pthread_t to small thread identifier numbers (unique within one process).
-// This method should be portable across different POSIX implementations.
-//------------------------------------------------------------------------------
-
-#if defined(_TTHREAD_POSIX_)
-static thread::id _pthread_t_to_ID(const pthread_t &aHandle) {
- static mutex idMapLock;
- static std::map<pthread_t, unsigned long int> idMap;
- static unsigned long int idCount(1);
-
- lock_guard<mutex> guard(idMapLock);
- if(idMap.find(aHandle) == idMap.end())
- idMap[aHandle] = idCount ++;
- return thread::id(idMap[aHandle]);
-}
-#endif // _TTHREAD_POSIX_
-
-
-//------------------------------------------------------------------------------
-// thread
-//------------------------------------------------------------------------------
-
-/// Information to pass to the new thread (what to run).
-struct _thread_start_info {
- void (*mFunction)(void *); ///< Pointer to the function to be executed.
- void * mArg; ///< Function argument for the thread function.
- thread * mThread; ///< Pointer to the thread object.
-};
-
-// Thread wrapper function.
-#if defined(_TTHREAD_WIN32_)
-unsigned WINAPI thread::wrapper_function(void * aArg)
-#elif defined(_TTHREAD_POSIX_)
-void * thread::wrapper_function(void * aArg)
-#endif
-{
- // Get thread startup information
- _thread_start_info * ti = (_thread_start_info *) aArg;
-
- try {
- // Call the actual client thread function
- ti->mFunction(ti->mArg);
- } catch(...) {
- // Uncaught exceptions will terminate the application (default behavior
- // according to C++11)
- std::terminate();
- }
-
- // The thread is no longer executing
- lock_guard<mutex> guard(ti->mThread->mDataMutex);
- ti->mThread->mNotAThread = true;
-
- // The thread is responsible for freeing the startup information
- delete ti;
-
- return 0;
-}
-
-thread::thread(void (*aFunction)(void *), void * aArg) {
- // Serialize access to this thread structure
- lock_guard<mutex> guard(mDataMutex);
-
- // Fill out the thread startup information (passed to the thread wrapper,
- // which will eventually free it)
- _thread_start_info * ti = new _thread_start_info;
- ti->mFunction = aFunction;
- ti->mArg = aArg;
- ti->mThread = this;
-
- // The thread is now alive
- mNotAThread = false;
-
- // Create the thread
-#if defined(_TTHREAD_WIN32_)
- mHandle = (HANDLE) _beginthreadex(0, 0, wrapper_function, (void *) ti, 0, &mWin32ThreadID);
-#elif defined(_TTHREAD_POSIX_)
- if(pthread_create(&mHandle, NULL, wrapper_function, (void *) ti) != 0)
- mHandle = 0;
-#endif
-
- // Did we fail to create the thread?
- if(!mHandle) {
- mNotAThread = true;
- delete ti;
- }
-}
-
-thread::~thread() {
- if(joinable())
- std::terminate();
-}
-
-void thread::join() {
- if(joinable()) {
-#if defined(_TTHREAD_WIN32_)
- WaitForSingleObject(mHandle, INFINITE);
- CloseHandle(mHandle);
-#elif defined(_TTHREAD_POSIX_)
- pthread_join(mHandle, NULL);
-#endif
- }
-}
-
-bool thread::joinable() const {
- mDataMutex.lock();
- bool result = !mNotAThread;
- mDataMutex.unlock();
- return result;
-}
-
-void thread::detach() {
- mDataMutex.lock();
- if(!mNotAThread) {
-#if defined(_TTHREAD_WIN32_)
- CloseHandle(mHandle);
-#elif defined(_TTHREAD_POSIX_)
- pthread_detach(mHandle);
-#endif
- mNotAThread = true;
- }
- mDataMutex.unlock();
-}
-
-thread::id thread::get_id() const {
- if(!joinable())
- return id();
-#if defined(_TTHREAD_WIN32_)
- return id((unsigned long int) mWin32ThreadID);
-#elif defined(_TTHREAD_POSIX_)
- return _pthread_t_to_ID(mHandle);
-#endif
-}
-
-unsigned thread::hardware_concurrency() {
-#if defined(_TTHREAD_WIN32_)
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- return (int) si.dwNumberOfProcessors;
-#elif defined(_SC_NPROCESSORS_ONLN)
- return (int) sysconf(_SC_NPROCESSORS_ONLN);
-#elif defined(_SC_NPROC_ONLN)
- return (int) sysconf(_SC_NPROC_ONLN);
-#else
- // The standard requires this function to return zero if the number of
- // hardware cores could not be determined.
- return 0;
-#endif
-}
-
-
-//------------------------------------------------------------------------------
-// this_thread
-//------------------------------------------------------------------------------
-
-thread::id this_thread::get_id() {
-#if defined(_TTHREAD_WIN32_)
- return thread::id((unsigned long int) GetCurrentThreadId());
-#elif defined(_TTHREAD_POSIX_)
- return _pthread_t_to_ID(pthread_self());
-#endif
-}
-
-namespace chrono {
-namespace system_clock {
-uint64_t now() {
- uint64_t time = 0;
-#ifdef _WIN32
- FILETIME tv;
- GetSystemTimeAsFileTime(&tv);
- time = (((uint64_t) tv.dwHighDateTime) << 32) + tv.dwLowDateTime;
- time /= 10000;
-#else
- struct timeval tv;
- gettimeofday(&tv, NULL);
- time += tv.tv_sec * 1000;
- time += tv.tv_usec / 1000;
-#endif
- return time;
-}
-}
-}
-
-}
diff --git a/src/uscxml/concurrency/tinythread.h b/src/uscxml/concurrency/tinythread.h
deleted file mode 100644
index e5e5e25..0000000
--- a/src/uscxml/concurrency/tinythread.h
+++ /dev/null
@@ -1,726 +0,0 @@
-/* -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; -*-
-Copyright (c) 2010-2012 Marcus Geelnard
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software. This version was altered!
-
- 3. This notice may not be removed or altered from any source
- distribution.
-*/
-
-#ifndef _TINYTHREAD_H_
-#define _TINYTHREAD_H_
-
-#include "uscxml/Common.h"
-//#include <ostream>
-
-/// @file
-/// @mainpage TinyThread++ API Reference
-///
-/// @section intro_sec Introduction
-/// TinyThread++ is a minimal, portable implementation of basic threading
-/// classes for C++.
-///
-/// They closely mimic the functionality and naming of the C++11 standard, and
-/// should be easily replaceable with the corresponding std:: variants.
-///
-/// @section port_sec Portability
-/// The Win32 variant uses the native Win32 API for implementing the thread
-/// classes, while for other systems, the POSIX threads API (pthread) is used.
-///
-/// @section class_sec Classes
-/// In order to mimic the threading API of the C++11 standard, subsets of
-/// several classes are provided. The fundamental classes are:
-/// @li tthread::thread
-/// @li tthread::mutex
-/// @li tthread::recursive_mutex
-/// @li tthread::condition_variable
-/// @li tthread::lock_guard
-/// @li tthread::fast_mutex
-///
-/// @section misc_sec Miscellaneous
-/// The following special keywords are available: #thread_local.
-///
-/// For more detailed information (including additional classes), browse the
-/// different sections of this documentation. A good place to start is:
-/// tinythread.h.
-
-// Which platform are we on?
-#if !defined(_TTHREAD_PLATFORM_DEFINED_)
-#if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__)
-#define _TTHREAD_WIN32_
-#include <boost/cstdint.hpp>
-#else
-#define _TTHREAD_POSIX_
-#endif
-#define _TTHREAD_PLATFORM_DEFINED_
-#endif
-
-// Platform specific includes
-#if defined(_TTHREAD_WIN32_)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#define __UNDEF_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#ifdef __UNDEF_LEAN_AND_MEAN
-#undef WIN32_LEAN_AND_MEAN
-#undef __UNDEF_LEAN_AND_MEAN
-#endif
-#else
-#include <pthread.h>
-#include <signal.h>
-#include <sched.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <inttypes.h>
-#endif
-
-// Generic includes
-#include <ostream>
-
-/// TinyThread++ version (major number).
-#define TINYTHREAD_VERSION_MAJOR 1
-/// TinyThread++ version (minor number).
-#define TINYTHREAD_VERSION_MINOR 1
-/// TinyThread++ version (full version).
-#define TINYTHREAD_VERSION (TINYTHREAD_VERSION_MAJOR * 100 + TINYTHREAD_VERSION_MINOR)
-
-// Do we have a fully featured C++11 compiler?
-#if (__cplusplus > 199711L) || (defined(__STDCXX_VERSION__) && (__STDCXX_VERSION__ >= 201001L))
-#define _TTHREAD_CPP11_
-#endif
-
-// ...at least partial C++11?
-#if defined(_TTHREAD_CPP11_) || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
-#define _TTHREAD_CPP11_PARTIAL_
-#endif
-
-// Macro for disabling assignments of objects.
-#ifdef _TTHREAD_CPP11_PARTIAL_
-#define _TTHREAD_DISABLE_ASSIGNMENT(name) \
- name(const name&) = delete; \
- name& operator=(const name&) = delete;
-#else
-#define _TTHREAD_DISABLE_ASSIGNMENT(name) \
- name(const name&); \
- name& operator=(const name&);
-#endif
-
-/// @def thread_local
-/// Thread local storage keyword.
-/// A variable that is declared with the @c thread_local keyword makes the
-/// value of the variable local to each thread (known as thread-local storage,
-/// or TLS). Example usage:
-/// @code
-/// // This variable is local to each thread.
-/// thread_local int variable;
-/// @endcode
-/// @note The @c thread_local keyword is a macro that maps to the corresponding
-/// compiler directive (e.g. @c __declspec(thread)). While the C++11 standard
-/// allows for non-trivial types (e.g. classes with constructors and
-/// destructors) to be declared with the @c thread_local keyword, most pre-C++11
-/// compilers only allow for trivial types (e.g. @c int). So, to guarantee
-/// portable code, only use trivial types for thread local storage.
-/// @note This directive is currently not supported on Mac OS X (it will give
-/// a compiler error), since compile-time TLS is not supported in the Mac OS X
-/// executable format. Also, some older versions of MinGW (before GCC 4.x) do
-/// not support this directive.
-/// @hideinitializer
-
-#if !defined(_TTHREAD_CPP11_) && !defined(thread_local)
-#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
-#define thread_local __thread
-#else
-#define thread_local __declspec(thread)
-#endif
-#endif
-
-
-/// Main name space for TinyThread++.
-/// This namespace is more or less equivalent to the @c std namespace for the
-/// C++11 thread classes. For instance, the tthread::mutex class corresponds to
-/// the std::mutex class.
-namespace tthread {
-
-unsigned long long int timeStamp();
-
-/// Mutex class.
-/// This is a mutual exclusion object for synchronizing access to shared
-/// memory areas for several threads. The mutex is non-recursive (i.e. a
-/// program may deadlock if the thread that owns a mutex object calls lock()
-/// on that object).
-/// @see recursive_mutex
-
-class USCXML_API mutex {
-public:
- /// Constructor.
- mutex()
-#if defined(_TTHREAD_WIN32_)
- : mAlreadyLocked(false)
-#endif
- {
-#if defined(_TTHREAD_WIN32_)
- InitializeCriticalSection(&mHandle);
-#else
- pthread_mutex_init(&mHandle, NULL);
-#endif
- }
-
- /// Destructor.
- ~mutex() {
-#if defined(_TTHREAD_WIN32_)
- DeleteCriticalSection(&mHandle);
-#else
- pthread_mutex_destroy(&mHandle);
-#endif
- }
-
- /// Lock the mutex.
- /// The method will block the calling thread until a lock on the mutex can
- /// be obtained. The mutex remains locked until @c unlock() is called.
- /// @see lock_guard
- inline void lock() {
-#if defined(_TTHREAD_WIN32_)
- EnterCriticalSection(&mHandle);
- while(mAlreadyLocked) Sleep(1000); // Simulate deadlock...
- mAlreadyLocked = true;
-#else
- pthread_mutex_lock(&mHandle);
-#endif
- }
-
- /// Try to lock the mutex.
- /// The method will try to lock the mutex. If it fails, the function will
- /// return immediately (non-blocking).
- /// @return @c true if the lock was acquired, or @c false if the lock could
- /// not be acquired.
- inline bool try_lock() {
-#if defined(_TTHREAD_WIN32_)
- bool ret = (TryEnterCriticalSection(&mHandle) ? true : false);
- if(ret && mAlreadyLocked) {
- LeaveCriticalSection(&mHandle);
- ret = false;
- }
- return ret;
-#else
- return (pthread_mutex_trylock(&mHandle) == 0) ? true : false;
-#endif
- }
-
- /// Unlock the mutex.
- /// If any threads are waiting for the lock on this mutex, one of them will
- /// be unblocked.
- inline void unlock() {
-#if defined(_TTHREAD_WIN32_)
- mAlreadyLocked = false;
- LeaveCriticalSection(&mHandle);
-#else
- pthread_mutex_unlock(&mHandle);
-#endif
- }
-
- //_TTHREAD_DISABLE_ASSIGNMENT(mutex)
-
-private:
-#if defined(_TTHREAD_WIN32_)
- CRITICAL_SECTION mHandle;
- bool mAlreadyLocked;
-#else
- pthread_mutex_t mHandle;
-#endif
-
- friend class condition_variable;
-};
-
-/// Recursive mutex class.
-/// This is a mutual exclusion object for synchronizing access to shared
-/// memory areas for several threads. The mutex is recursive (i.e. a thread
-/// may lock the mutex several times, as long as it unlocks the mutex the same
-/// number of times).
-/// @see mutex
-class USCXML_API recursive_mutex {
-public:
- /// Constructor.
- recursive_mutex() {
-#if defined(_TTHREAD_WIN32_)
- InitializeCriticalSection(&mHandle);
-#else
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&mHandle, &attr);
-#endif
- }
-
- /// Destructor.
- ~recursive_mutex() {
-#if defined(_TTHREAD_WIN32_)
- DeleteCriticalSection(&mHandle);
-#else
- pthread_mutex_destroy(&mHandle);
-#endif
- }
-
- /// Lock the mutex.
- /// The method will block the calling thread until a lock on the mutex can
- /// be obtained. The mutex remains locked until @c unlock() is called.
- /// @see lock_guard
- inline void lock() {
-#if defined(_TTHREAD_WIN32_)
- EnterCriticalSection(&mHandle);
-#else
- pthread_mutex_lock(&mHandle);
-#endif
- }
-
- /// Try to lock the mutex.
- /// The method will try to lock the mutex. If it fails, the function will
- /// return immediately (non-blocking).
- /// @return @c true if the lock was acquired, or @c false if the lock could
- /// not be acquired.
- inline bool try_lock() {
-#if defined(_TTHREAD_WIN32_)
- return TryEnterCriticalSection(&mHandle) ? true : false;
-#else
- return (pthread_mutex_trylock(&mHandle) == 0) ? true : false;
-#endif
- }
-
- /// Unlock the mutex.
- /// If any threads are waiting for the lock on this mutex, one of them will
- /// be unblocked.
- inline void unlock() {
-#if defined(_TTHREAD_WIN32_)
- LeaveCriticalSection(&mHandle);
-#else
- pthread_mutex_unlock(&mHandle);
-#endif
- }
-
- //_TTHREAD_DISABLE_ASSIGNMENT(recursive_mutex)
-
-private:
-#if defined(_TTHREAD_WIN32_)
- CRITICAL_SECTION mHandle;
-#else
- pthread_mutex_t mHandle;
-#endif
-
- friend class condition_variable;
-};
-
-/// Lock guard class.
-/// The constructor locks the mutex, and the destructor unlocks the mutex, so
-/// the mutex will automatically be unlocked when the lock guard goes out of
-/// scope. Example usage:
-/// @code
-/// mutex m;
-/// int counter;
-///
-/// void increment()
-/// {
-/// lock_guard<mutex> guard(m);
-/// ++ counter;
-/// }
-/// @endcode
-
-template <class T>
-class USCXML_API lock_guard {
-public:
- typedef T mutex_type;
-
- lock_guard() : mMutex(0) {}
-
- /// The constructor locks the mutex.
- explicit lock_guard(mutex_type &aMutex) {
- mMutex = &aMutex;
- mMutex->lock();
- }
-
- /// The destructor unlocks the mutex.
- ~lock_guard() {
- if(mMutex)
- mMutex->unlock();
- }
-
-private:
- mutex_type * mMutex;
-};
-
-/// Condition variable class.
-/// This is a signalling object for synchronizing the execution flow for
-/// several threads. Example usage:
-/// @code
-/// // Shared data and associated mutex and condition variable objects
-/// int count;
-/// mutex m;
-/// condition_variable cond;
-///
-/// // Wait for the counter to reach a certain number
-/// void wait_counter(int targetCount)
-/// {
-/// lock_guard<mutex> guard(m);
-/// while(count < targetCount)
-/// cond.wait(m);
-/// }
-///
-/// // Increment the counter, and notify waiting threads
-/// void increment()
-/// {
-/// lock_guard<mutex> guard(m);
-/// ++ count;
-/// cond.notify_all();
-/// }
-/// @endcode
-class USCXML_API condition_variable {
-public:
- /// Constructor.
-#if defined(_TTHREAD_WIN32_)
- condition_variable();
-#else
- condition_variable() {
- pthread_cond_init(&mHandle, NULL);
- }
-#endif
-
- /// Destructor.
-#if defined(_TTHREAD_WIN32_)
- ~condition_variable();
-#else
- ~condition_variable() {
- pthread_cond_destroy(&mHandle);
- }
-#endif
-
- /// Wait for the condition.
- /// The function will block the calling thread until the condition variable
- /// is woken by @c notify_one(), @c notify_all() or a spurious wake up.
- /// @param[in] aMutex A mutex that will be unlocked when the wait operation
- /// starts, an locked again as soon as the wait operation is finished.
- template <class _mutexT>
- inline void wait(_mutexT &aMutex) {
-#if defined(_TTHREAD_WIN32_)
- // Increment number of waiters
- EnterCriticalSection(&mWaitersCountLock);
- ++ mWaitersCount;
- LeaveCriticalSection(&mWaitersCountLock);
-
- // Release the mutex while waiting for the condition (will decrease
- // the number of waiters when done)...
- aMutex.unlock();
- _wait(0);
- aMutex.lock();
-#else
- pthread_cond_wait(&mHandle, &aMutex.mHandle);
-#endif
- }
-
- template <class _mutexT>
- inline void wait_for(_mutexT &aMutex, unsigned int ms) {
-#if defined(_TTHREAD_WIN32_)
- // Increment number of waiters
- EnterCriticalSection(&mWaitersCountLock);
- ++ mWaitersCount;
- LeaveCriticalSection(&mWaitersCountLock);
-
- // Release the mutex while waiting for the condition (will decrease
- // the number of waiters when done)...
- aMutex.unlock();
- _wait(ms);
- aMutex.lock();
-#else
- struct timeval tv;
- gettimeofday(&tv, NULL);
-
- struct timespec ts;
- ts.tv_sec = tv.tv_sec + (ms / 1000);
- ts.tv_nsec = (tv.tv_usec * 1000); // convert tv microseconds to nanoseconds
- ts.tv_nsec += (ms % 1000) * 1000000; // add millisecond part of wait time
- pthread_cond_timedwait(&mHandle, &aMutex.mHandle, &ts);
-#endif
- }
-
- /// Notify one thread that is waiting for the condition.
- /// If at least one thread is blocked waiting for this condition variable,
- /// one will be woken up.
- /// @note Only threads that started waiting prior to this call will be
- /// woken up.
-#if defined(_TTHREAD_WIN32_)
- void notify_one();
-#else
- inline void notify_one() {
- pthread_cond_signal(&mHandle);
- }
-#endif
-
- /// Notify all threads that are waiting for the condition.
- /// All threads that are blocked waiting for this condition variable will
- /// be woken up.
- /// @note Only threads that started waiting prior to this call will be
- /// woken up.
-#if defined(_TTHREAD_WIN32_)
- void notify_all();
-#else
- inline void notify_all() {
- pthread_cond_broadcast(&mHandle);
- }
-#endif
-
- //_TTHREAD_DISABLE_ASSIGNMENT(condition_variable)
-
-private:
-#if defined(_TTHREAD_WIN32_)
- void _wait(unsigned int ms);
- HANDLE mEvents[2]; ///< Signal and broadcast event HANDLEs.
- unsigned int mWaitersCount; ///< Count of the number of waiters.
- CRITICAL_SECTION mWaitersCountLock; ///< Serialize access to mWaitersCount.
-#else
- pthread_cond_t mHandle;
-#endif
-};
-
-
-/// Thread class.
-class USCXML_API thread {
-public:
-#if defined(_TTHREAD_WIN32_)
- typedef HANDLE native_handle_type;
-#else
- typedef pthread_t native_handle_type;
-#endif
-
- class id;
-
- /// Default constructor.
- /// Construct a @c thread object without an associated thread of execution
- /// (i.e. non-joinable).
- thread() : mHandle(0), mNotAThread(true)
-#if defined(_TTHREAD_WIN32_)
- , mWin32ThreadID(0)
-#endif
- {}
-
- /// Thread starting constructor.
- /// Construct a @c thread object with a new thread of execution.
- /// @param[in] aFunction A function pointer to a function of type:
- /// <tt>void fun(void * arg)</tt>
- /// @param[in] aArg Argument to the thread function.
- /// @note This constructor is not fully compatible with the standard C++
- /// thread class. It is more similar to the pthread_create() (POSIX) and
- /// CreateThread() (Windows) functions.
- thread(void (*aFunction)(void *), void * aArg);
-
- /// Destructor.
- /// @note If the thread is joinable upon destruction, @c std::terminate()
- /// will be called, which terminates the process. It is always wise to do
- /// @c join() before deleting a thread object.
- ~thread();
-
- /// Wait for the thread to finish (join execution flows).
- /// After calling @c join(), the thread object is no longer associated with
- /// a thread of execution (i.e. it is not joinable, and you may not join
- /// with it nor detach from it).
- void join();
-
- /// Check if the thread is joinable.
- /// A thread object is joinable if it has an associated thread of execution.
- bool joinable() const;
-
- /// Detach from the thread.
- /// After calling @c detach(), the thread object is no longer assicated with
- /// a thread of execution (i.e. it is not joinable). The thread continues
- /// execution without the calling thread blocking, and when the thread
- /// ends execution, any owned resources are released.
- void detach();
-
- /// Return the thread ID of a thread object.
- id get_id() const;
-
- /// Get the native handle for this thread.
- /// @note Under Windows, this is a @c HANDLE, and under POSIX systems, this
- /// is a @c pthread_t.
- inline native_handle_type native_handle() {
- return mHandle;
- }
-
- /// Determine the number of threads which can possibly execute concurrently.
- /// This function is useful for determining the optimal number of threads to
- /// use for a task.
- /// @return The number of hardware thread contexts in the system.
- /// @note If this value is not defined, the function returns zero (0).
- static unsigned hardware_concurrency();
-
- //_TTHREAD_DISABLE_ASSIGNMENT(thread)
-
-private:
- native_handle_type mHandle; ///< Thread handle.
- mutable mutex mDataMutex; ///< Serializer for access to the thread private data.
- bool mNotAThread; ///< True if this object is not a thread of execution.
-#if defined(_TTHREAD_WIN32_)
- unsigned int mWin32ThreadID; ///< Unique thread ID (filled out by _beginthreadex).
-#endif
-
- // This is the internal thread wrapper function.
-#if defined(_TTHREAD_WIN32_)
- static unsigned WINAPI wrapper_function(void * aArg);
-#else
- static void * wrapper_function(void * aArg);
-#endif
-};
-
-/// Thread ID.
-/// The thread ID is a unique identifier for each thread.
-/// @see thread::get_id()
-class USCXML_API thread::id {
-public:
- /// Default constructor.
- /// The default constructed ID is that of thread without a thread of
- /// execution.
- id() : mId(0) {};
-
- id(unsigned long int aId) : mId(aId) {};
-
- id(const id& aId) : mId(aId.mId) {};
-
- inline id & operator=(const id &aId) {
- mId = aId.mId;
- return *this;
- }
-
- inline friend bool operator==(const id &aId1, const id &aId2) {
- return (aId1.mId == aId2.mId);
- }
-
- inline friend bool operator!=(const id &aId1, const id &aId2) {
- return (aId1.mId != aId2.mId);
- }
-
- inline friend bool operator<=(const id &aId1, const id &aId2) {
- return (aId1.mId <= aId2.mId);
- }
-
- inline friend bool operator<(const id &aId1, const id &aId2) {
- return (aId1.mId < aId2.mId);
- }
-
- inline friend bool operator>=(const id &aId1, const id &aId2) {
- return (aId1.mId >= aId2.mId);
- }
-
- inline friend bool operator>(const id &aId1, const id &aId2) {
- return (aId1.mId > aId2.mId);
- }
-
- inline friend std::ostream& operator <<(std::ostream &os, const id &obj) {
- os << obj.mId;
- return os;
- }
-
-private:
- unsigned long int mId;
-};
-
-
-// Related to <ratio> - minimal to be able to support chrono.
-typedef long long __intmax_t;
-
-/// Minimal implementation of the @c ratio class. This class provides enough
-/// functionality to implement some basic @c chrono classes.
-template <__intmax_t N, __intmax_t D = 1> class ratio {
-public:
- static double _as_double() {
- return double(N) / double(D);
- }
-};
-
-/// Minimal implementation of the @c chrono namespace.
-/// The @c chrono namespace provides types for specifying time intervals.
-namespace chrono {
-/// Duration template class. This class provides enough functionality to
-/// implement @c this_thread::sleep_for().
-template <class _Rep, class _Period = ratio<1> > class USCXML_API duration {
-private:
- _Rep rep_;
-public:
- typedef _Rep rep;
- typedef _Period period;
-
- /// Construct a duration object with the given duration.
- template <class _Rep2>
- explicit duration(const _Rep2& r) : rep_(r) {};
-
- /// Return the value of the duration object.
- rep count() const {
- return rep_;
- }
-};
-
-// Standard duration types.
-typedef duration<__intmax_t, ratio<1, 1000000000> > nanoseconds; ///< Duration with the unit nanoseconds.
-typedef duration<__intmax_t, ratio<1, 1000000> > microseconds; ///< Duration with the unit microseconds.
-typedef duration<__intmax_t, ratio<1, 1000> > milliseconds; ///< Duration with the unit milliseconds.
-typedef duration<__intmax_t> seconds; ///< Duration with the unit seconds.
-typedef duration<__intmax_t, ratio<60> > minutes; ///< Duration with the unit minutes.
-typedef duration<__intmax_t, ratio<3600> > hours; ///< Duration with the unit hours.
-
-namespace system_clock {
-uint64_t now();
-}
-
-}
-
-/// The namespace @c this_thread provides methods for dealing with the
-/// calling thread.
-namespace this_thread {
-/// Return the thread ID of the calling thread.
-thread::id get_id();
-
-/// Yield execution to another thread.
-/// Offers the operating system the opportunity to schedule another thread
-/// that is ready to run on the current processor.
-inline void yield() {
-#if defined(_TTHREAD_WIN32_)
- Sleep(0);
-#else
- sched_yield();
-#endif
-}
-
-/// Blocks the calling thread for a period of time.
-/// @param[in] aTime Minimum time to put the thread to sleep.
-/// Example usage:
-/// @code
-/// // Sleep for 100 milliseconds
-/// this_thread::sleep_for(chrono::milliseconds(100));
-/// @endcode
-/// @note Supported duration types are: nanoseconds, microseconds,
-/// milliseconds, seconds, minutes and hours.
-template <class _Rep, class _Period> void sleep_for(const chrono::duration<_Rep, _Period>& aTime) {
-#if defined(_TTHREAD_WIN32_)
- Sleep(int(double(aTime.count()) * (1000.0 * _Period::_as_double()) + 0.5));
-#else
- usleep(int(double(aTime.count()) * (1000000.0 * _Period::_as_double()) + 0.5));
-#endif
-}
-}
-
-}
-
-// Define/macro cleanup
-#undef _TTHREAD_DISABLE_ASSIGNMENT
-
-#endif // _TINYTHREAD_H_
diff --git a/src/uscxml/debug/Breakpoint.cpp b/src/uscxml/debug/Breakpoint.cpp
deleted file mode 100644
index d7eb2af..0000000
--- a/src/uscxml/debug/Breakpoint.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/debug/Breakpoint.h"
-#include "uscxml/Interpreter.h"
-#include "uscxml/dom/DOMUtils.h"
-
-namespace uscxml {
-
-Breakpoint::Breakpoint(const Data& data) {
- enabled = true;
- subject = UNDEF_SUBJECT;
- when = UNDEF_WHEN;
- action = UNDEF_ACTION;
-
- if (data.hasKey("when")) {
- if (false) {
- } else if (data.at("when").atom == "before") {
- when = BEFORE;
- } else if (data.at("when").atom == "after") {
- when = AFTER;
- } else if (data.at("when").atom == "on") {
- when = ON;
- }
- }
-
- if (data.hasKey("action")) {
- if (false) {
- } else if (data.at("action").atom == "enter") {
- action = ENTER;
- } else if (data.at("action").atom == "exit") {
- action = EXIT;
- } else if (data.at("action").atom == "invoke") {
- action = INVOKE;
- } else if (data.at("action").atom == "cancel") {
- action = UNINVOKE;
- }
- }
-
- if (data.hasKey("subject")) {
- if (false) {
- } else if (data.at("subject").atom == "state") {
- subject = STATE;
- } else if (data.at("subject").atom == "transition") {
- subject = TRANSITION;
- } else if (data.at("subject").atom == "stable") {
- subject = STABLE;
- } else if (data.at("subject").atom == "microstep") {
- subject = MICROSTEP;
- } else if (data.at("subject").atom == "event") {
- subject = EVENT;
- } else if (data.at("subject").atom == "invoker") {
- subject = INVOKER;
- } else if (data.at("subject").atom == "executable") {
- subject = EXECUTABLE;
- }
- }
-
- if (data.hasKey("condition"))
- condition = data.at("condition").atom;
-
- if (data.hasKey("invokeId"))
- invokeId = data.at("invokeId").atom;
-
- if (data.hasKey("invokeType"))
- invokeType = data.at("invokeType").atom;
-
- if (data.hasKey("eventName"))
- eventName = data.at("eventName").atom;
-
- if (data.hasKey("executableName"))
- executableName = data.at("executableName").atom;
-
- if (data.hasKey("executableXPath"))
- executableXPath = data.at("executableXPath").atom;
-
- if (data.hasKey("stateId"))
- stateId = data.at("stateId").atom;
-
- if (data.hasKey("transSourceId"))
- transSourceId = data.at("transSourceId").atom;
-
- if (data.hasKey("transTargetId"))
- transTargetId = data.at("transTargetId").atom;
-
-}
-
-Data Breakpoint::toData() const {
- Data data;
-
- switch (subject) {
- case STATE:
- data.compound["subject"] = Data("state", Data::VERBATIM);
- break;
- case TRANSITION:
- data.compound["subject"] = Data("transition", Data::VERBATIM);
- break;
- case STABLE:
- data.compound["subject"] = Data("stable", Data::VERBATIM);
- break;
- case MICROSTEP:
- data.compound["subject"] = Data("microstep", Data::VERBATIM);
- break;
- case EVENT:
- data.compound["subject"] = Data("event", Data::VERBATIM);
- break;
- case INVOKER:
- data.compound["subject"] = Data("invoker", Data::VERBATIM);
- break;
- case EXECUTABLE:
- data.compound["subject"] = Data("executable", Data::VERBATIM);
- break;
- default:
- break;
- }
-
- switch (when) {
- case AFTER:
- data.compound["when"] = Data("after", Data::VERBATIM);
- break;
- case BEFORE:
- data.compound["when"] = Data("before", Data::VERBATIM);
- break;
- case ON:
- data.compound["when"] = Data("on", Data::VERBATIM);
- break;
- default:
- break;
- }
-
- switch (action) {
- case ENTER:
- data.compound["action"] = Data("enter", Data::VERBATIM);
- break;
- case EXIT:
- data.compound["action"] = Data("exit", Data::VERBATIM);
- break;
- case INVOKE:
- data.compound["action"] = Data("invoke", Data::VERBATIM);
- break;
- case UNINVOKE:
- data.compound["action"] = Data("cancel", Data::VERBATIM);
- break;
- default:
- break;
- }
-
- if (invokeId.length() > 0)
- data.compound["invokeId"] = Data(invokeId, Data::VERBATIM);
-
- if (invokeType.length() > 0)
- data.compound["invokeType"] = Data(invokeType, Data::VERBATIM);
-
- if (eventName.length() > 0)
- data.compound["eventName"] = Data(eventName, Data::VERBATIM);
-
- if (executableName.length() > 0)
- data.compound["executableName"] = Data(executableName, Data::VERBATIM);
-
- if (executableXPath.length() > 0) {
- data.compound["executableXPath"] = Data(executableXPath, Data::VERBATIM);
- }
-
- if (element)
- data.compound["xpath"] = Data(DOMUtils::xPathForNode(element, "*"), Data::VERBATIM);
-
- if (stateId.length() > 0)
- data.compound["stateId"] = Data(stateId, Data::VERBATIM);
-
- if (transSourceId.length() > 0)
- data.compound["transSourceId"] = Data(transSourceId, Data::VERBATIM);
-
- if (transTargetId.length() > 0)
- data.compound["transTargetId"] = Data(transTargetId, Data::VERBATIM);
-
- if (condition.length() > 0)
- data.compound["condition"] = Data(condition, Data::VERBATIM);
-
- return data;
-}
-
-bool Breakpoint::matches(Interpreter interpreter, const Breakpoint& other) const {
- // would we match the given breakpoint?
-
- if (subject != UNDEF_SUBJECT &&
- other.subject != subject)
- return false; // subject does not match
-
- if (when != UNDEF_WHEN &&
- other.when != when)
- return false; // time does not match
-
- if (action != UNDEF_ACTION &&
- other.action != action)
- return false; // action does not match
-
- // when we have a qualifier it has to match
- if(invokeId.length() > 0 && invokeId != other.invokeId) {
- return false;
- }
-
- if(invokeType.length() > 0 && invokeType != other.invokeType) {
- return false;
- }
-
- if(stateId.length() > 0 && stateId != other.stateId) {
- return false;
- }
-
- if(eventName.length() > 0 && !nameMatch(eventName, other.eventName)) {
- return false;
- }
-
- if(executableName.length() > 0 && executableName != other.executableName) {
- return false;
- }
-
- if(executableXPath.length()) {
- Arabica::XPath::NodeSet<std::string> nodes;
- try {
- nodes = interpreter.getNodeSetForXPath(executableXPath);
- } catch (...) {
- return false;
- }
- return InterpreterImpl::isMember(other.element, nodes);
- }
-
- if(transSourceId.length() > 0 && transSourceId != other.transSourceId) {
- return false;
- }
-
- if(transTargetId.length() > 0 && transTargetId != other.transTargetId) {
- return false;
- }
-
- if (condition.length() > 0) {
- try {
- DataModel dm = interpreter.getDataModel();
- if (!dm || !dm.evalAsBool(condition)) {
- return false;
- }
- } catch (...) {
- return false;
- }
- }
-
- return true;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/debug/Breakpoint.h b/src/uscxml/debug/Breakpoint.h
deleted file mode 100644
index d7df03d..0000000
--- a/src/uscxml/debug/Breakpoint.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef BREAKPOINT_H_VR7K7T1X
-#define BREAKPOINT_H_VR7K7T1X
-
-#include <string> // for string
-#include "uscxml/Common.h" // for USCXML_API
-#include "uscxml/Interpreter.h"
-#include "DOM/Element.hpp" // for Element
-#include "uscxml/messages/Data.h" // for Data
-
-namespace uscxml {
-
-class USCXML_API Breakpoint {
-public:
-
- enum When {
- UNDEF_WHEN, AFTER, BEFORE, ON
- };
-
- enum Subject {
- UNDEF_SUBJECT, STATE, TRANSITION, STABLE, MICROSTEP, EVENT, INVOKER, EXECUTABLE
- };
-
- enum Action {
- UNDEF_ACTION, ENTER, EXIT, INVOKE, UNINVOKE
- };
-
- Breakpoint() {
- subject = UNDEF_SUBJECT;
- when = UNDEF_WHEN;
- action = UNDEF_ACTION;
- }
- Breakpoint(const Data& data);
-
- // would we match the given breakpoint as well?
- bool matches(Interpreter interpreter, const Breakpoint& other) const;
-
- Data toData() const;
-
- bool operator<(const Breakpoint& other) const {
- return (toData() < other.toData());
- }
-
- operator bool() {
- return (subject != UNDEF_SUBJECT ||
- when != UNDEF_WHEN ||
- action != UNDEF_ACTION);
- }
-
- mutable bool enabled;
-
- When when;
- Subject subject;
- Action action;
-
- Arabica::DOM::Element<std::string> element;
-
- std::string invokeId;
- std::string invokeType;
-
- std::string eventName;
-
- std::string executableName;
- std::string executableXPath;
-
- std::string stateId;
- std::string transSourceId;
- std::string transTargetId;
-
- std::string condition;
-};
-
-}
-
-
-
-#endif /* end of include guard: BREAKPOINT_H_VR7K7T1X */
diff --git a/src/uscxml/debug/Complexity.cpp b/src/uscxml/debug/Complexity.cpp
deleted file mode 100644
index 232260c..0000000
--- a/src/uscxml/debug/Complexity.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
-* @file
-* @author 2012-2015 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
-* @copyright Simplified BSD
-*
-* @cond
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the FreeBSD license as published by the FreeBSD
-* project.
-*
-* This program 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.
-*
-* You should have received a copy of the FreeBSD license along with this
-* program. If not, see <http://www.opensource.org/licenses/bsd-license>.
-* @endcond
-*/
-
-#include "Complexity.h"
-#include "uscxml/dom/DOMUtils.h"
-
-#include <boost/algorithm/string.hpp>
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-std::list<std::set<Element<std::string> > > Complexity::getAllConfigurations(const Arabica::DOM::Element<std::string>& root) {
-
- std::list<std::set<Element<std::string> > > allConfigurations;
- std::string nsPrefix = (root.getPrefix().size() > 0 ? root.getPrefix() + ":" : "");
- std::string localName = root.getLocalName();
- bool isAtomic = true;
-
- NodeList<std::string> children = root.getChildNodes();
- for (size_t i = 0; i < children.getLength(); i++) {
- if (children.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Element<std::string> childElem(children.item(i));
- if (childElem.getTagName() == nsPrefix + "state" ||
- childElem.getTagName() == nsPrefix + "parallel" ||
- childElem.getTagName() == nsPrefix + "final") {
- // nested child state
- std::list<std::set<Element<std::string> > > nestedConfigurations = getAllConfigurations(childElem);
- isAtomic = false;
- if (localName == "parallel" && allConfigurations.size() > 0) {
- // for every nested configuration, every new nested is valid
- std::list<std::set<Element<std::string> > > combinedConfigurations;
- for (std::list<std::set<Element<std::string> > >::iterator existIter = allConfigurations.begin(); existIter != allConfigurations.end(); existIter++) {
- std::set<Element<std::string> > existingConfig = *existIter;
-
- for (std::list<std::set<Element<std::string> > >::iterator newIter = nestedConfigurations.begin(); newIter != nestedConfigurations.end(); newIter++) {
-
- std::set<Element<std::string> > newConfig = *newIter;
- std::set<Element<std::string> > combinedSet;
- combinedSet.insert(existingConfig.begin(), existingConfig.end());
- combinedSet.insert(newConfig.begin(), newConfig.end());
-
- combinedConfigurations.push_back(combinedSet);
- }
- }
- allConfigurations = combinedConfigurations;
- } else {
- // just add nested configurations and this
- for (std::list<std::set<Element<std::string> > >::iterator newIter = nestedConfigurations.begin(); newIter != nestedConfigurations.end(); newIter++) {
- std::set<Element<std::string> > newConfig = *newIter;
- if (localName != "scxml")
- newConfig.insert(root);
- allConfigurations.push_back(newConfig);
- }
- }
- }
- }
-
- if (isAtomic) {
- std::set<Element<std::string> > soleConfig;
- soleConfig.insert(root);
- allConfigurations.push_back(soleConfig);
- }
- return allConfigurations;
-}
-
-std::map<size_t, size_t> Complexity::getTransitionHistogramm(const Arabica::DOM::Element<std::string>& root) {
- std::map<size_t, size_t> histogram;
- std::string nameSpace;
-
- std::list<std::set<Element<std::string> > > allConfig = Complexity::getAllConfigurations(root);
-
- // for every legal configuration, count the transitions
- for (std::list<std::set<Element<std::string> > >::iterator confIter = allConfig.begin(); confIter != allConfig.end(); confIter++) {
- NodeSet<std::string> configNodeSet;
- std::set<Element<std::string> > config = *confIter;
- for (std::set<Element<std::string> >::iterator elemIter = config.begin(); elemIter != config.end(); elemIter++) {
- configNodeSet.push_back(*elemIter);
- if (nameSpace.size() == 0 && elemIter->getPrefix().size() > 0)
- nameSpace = elemIter->getPrefix() + ":";
- }
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(nameSpace + "transition", configNodeSet);
- histogram[transitions.size()]++;
- }
-
- return histogram;
-}
-
-
-uint64_t Complexity::stateMachineComplexity(InterpreterImpl* interpreter, Variant variant) {
- Arabica::DOM::Element<std::string> root = interpreter->getDocument().getDocumentElement();
-
- Arabica::XPath::NodeSet<std::string> reachable;
-
- if (variant & IGNORE_UNREACHABLE) {
- reachable = interpreter->getReachableStates();
- }
-
- Complexity complexity = calculateStateMachineComplexity(root, reachable);
- uint64_t value = complexity.value;
-
- if (!(variant & IGNORE_HISTORY)) {
- for (std::list<uint64_t>::const_iterator histIter = complexity.history.begin(); histIter != complexity.history.end(); histIter++) {
- value *= *histIter;
- }
- }
-
- if (!(variant & IGNORE_NESTED_DATA)) {
- bool ignoreNestedData = false;
- if (root.getLocalName() == "scxml" && (!HAS_ATTR_CAST(root, "binding") || boost::to_lower_copy(ATTR_CAST(root, "binding")) == "early")) {
- ignoreNestedData = true;
- }
-
- if (!ignoreNestedData) {
- uint64_t power = complexity.nestedData;
- while(power--) {
- value *= 2;
- }
- }
- }
-
- return value;
-}
-
-Complexity Complexity::calculateStateMachineComplexity(const Arabica::DOM::Element<std::string>& root, const Arabica::XPath::NodeSet<std::string>& reachable) {
- Complexity complexity;
-
- bool hasFlatHistory = false;
- bool hasDeepHistory = false;
- bool hasNestedData = false;
-
- Arabica::DOM::NodeList<std::string> childElems = root.getChildNodes();
- for (size_t i = 0; i < childElems.getLength(); i++) {
- if (childElems.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Element<std::string> childElem = Element<std::string>(childElems.item(i));
- if (InterpreterImpl::isHistory(childElem)) {
- if (HAS_ATTR(childElem, "type") && ATTR(childElem, "type") == "deep") {
- hasDeepHistory = true;
- } else {
- hasFlatHistory = true;
- }
- }
- if (!hasNestedData && childElem.getLocalName() == "datamodel") {
- Arabica::DOM::NodeList<std::string> dataElemChilds = childElem.getChildNodes();
- for (size_t j = 0; j < dataElemChilds.getLength(); j++) {
- if (dataElemChilds.item(j).getLocalName() == "data")
- hasNestedData = true;
- }
- }
- }
-
- if (hasNestedData)
- complexity.nestedData++;
-
- if (reachable.size() > 0 && !InterpreterImpl::isMember(root, reachable)) {
- return 0;
- } else if (InterpreterImpl::isCompound(root) || TAGNAME(root) == "scxml") {
- // compounds can be in any of the child state -> add
- NodeSet<std::string> childs = InterpreterImpl::getChildStates(root);
- for (size_t i = 0; i < childs.size(); i++) {
- complexity += calculateStateMachineComplexity(Element<std::string>(childs[i]), reachable);
- }
- if (hasFlatHistory) {
- complexity.history.push_back(childs.size());
- }
- if (hasDeepHistory) {
- complexity.history.push_back(complexity.value);
- }
- } else if (InterpreterImpl::isParallel(root)) {
- // parallels are in all states -> multiply
- NodeSet<std::string> childs = InterpreterImpl::getChildStates(root);
- complexity.value = 1;
- for (size_t i = 0; i < childs.size(); i++) {
- complexity *= calculateStateMachineComplexity(Element<std::string>(childs[i]), reachable);
- }
- if (hasDeepHistory) {
- complexity.history.push_back(complexity.value);
- }
-
- } else if (InterpreterImpl::isAtomic(root)) {
- return 1;
- }
-
- return complexity;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/debug/Complexity.h b/src/uscxml/debug/Complexity.h
deleted file mode 100644
index de05692..0000000
--- a/src/uscxml/debug/Complexity.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * @file
- * @author 2012-2015 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef COMPLEXITY_H_F972C065
-#define COMPLEXITY_H_F972C065
-
-#include "uscxml/Common.h" // for USCXML_API
-#include "uscxml/Interpreter.h"
-
-namespace uscxml {
-
-class USCXML_API Complexity {
-public:
-
- enum Variant {
- IGNORE_NOTHING = 0x0000,
- IGNORE_HISTORY = 0x0001,
- IGNORE_NESTED_DATA = 0x0002,
- IGNORE_UNREACHABLE = 0x0004,
- };
-
- Complexity() : value(0), nestedData(0) {}
- Complexity(uint64_t value) : value(value), nestedData(0) {}
-
- Complexity& operator+=(const Complexity& rhs) {
- value += rhs.value;
- nestedData += rhs.nestedData;
- history.insert(history.end(), rhs.history.begin(), rhs.history.end());
- return *this;
- }
-
- Complexity& operator*=(const Complexity& rhs) {
- value *= rhs.value;
- nestedData += rhs.nestedData;
- history.insert(history.end(), rhs.history.begin(), rhs.history.end());
- return *this;
- }
-
- static uint64_t stateMachineComplexity(const Interpreter& interpreter, Complexity::Variant variant = IGNORE_NOTHING) {
- return stateMachineComplexity(interpreter.getImpl().get());
- }
- static uint64_t stateMachineComplexity(InterpreterImpl* interpreter, Complexity::Variant variant = IGNORE_NOTHING);
-
- static std::list<std::set<Arabica::DOM::Element<std::string> > > getAllConfigurations(const Arabica::DOM::Element<std::string>& root);
- static std::map<size_t, size_t> getTransitionHistogramm(const Arabica::DOM::Element<std::string>& root);
-
-protected:
- static Complexity calculateStateMachineComplexity(const Arabica::DOM::Element<std::string>& root, const Arabica::XPath::NodeSet<std::string>& reachable);
-
- uint64_t value;
- uint64_t nestedData;
- std::list<uint64_t> history;
-};
-
-inline Complexity::Variant operator | ( Complexity::Variant lhs, Complexity::Variant rhs ) {
- // Cast to int first otherwise we'll just end up recursing
- return static_cast< Complexity::Variant >( static_cast< int >( lhs ) | static_cast< int >( rhs ) );
-}
-
-}
-
-#endif /* end of include guard: COMPLEXITY_H_F972C065 */
diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp
deleted file mode 100644
index 6e81563..0000000
--- a/src/uscxml/debug/DebugSession.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/debug/DebugSession.h"
-#include "uscxml/debug/Debugger.h"
-
-namespace uscxml {
-
-void DebugSession::checkBreakpoints(const std::list<Breakpoint> qualifiedBreakpoints) {
- std::list<Breakpoint>::const_iterator qualifiedBreakpointIter = qualifiedBreakpoints.begin();
-
- if (!_breakpointsEnabled)
- return;
-
- while(qualifiedBreakpointIter != qualifiedBreakpoints.end()) {
- const Breakpoint& qualifiedBreakpoint = *qualifiedBreakpointIter++;
-
- // check if one of the user-supplied breakpoints match
- bool userBreakpointMatched = false;
- Data replyData;
-
- if (_skipTo) {
- if (_skipTo.matches(_interpreter, qualifiedBreakpoint)) {
- replyData.compound["breakpoint"] = _skipTo.toData();
- replyData.compound["qualified"] = qualifiedBreakpoint.toData();
- breakExecution(replyData);
- _skipTo = Breakpoint();
- }
- continue;
- }
-
- std::set<Breakpoint>::const_iterator breakpointIter = _breakPoints.begin();
- while(breakpointIter != _breakPoints.end()) {
- const Breakpoint& breakpoint = *breakpointIter++;
- if (!breakpoint.enabled)
- continue;
- if (breakpoint.matches(_interpreter, qualifiedBreakpoint)) {
- // do we have a condition?
-
- replyData.compound["breakpoint"] = breakpoint.toData();
- replyData.compound["qualified"] = qualifiedBreakpoint.toData();
-
- userBreakpointMatched = true;
- breakExecution(replyData);
- }
- }
- if (_isStepping && !userBreakpointMatched) {
- replyData.compound["qualified"] = qualifiedBreakpoint.toData();
- breakExecution(replyData);
-
- }
- }
-}
-
-void DebugSession::breakExecution(Data replyData) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- Arabica::XPath::NodeSet<std::string> basicConf = _interpreter.getBasicConfiguration();
- for (size_t i = 0; i < basicConf.size(); i++) {
- Arabica::DOM::Element<std::string> element = Arabica::DOM::Element<std::string>(basicConf[i]);
- if (element.hasAttribute("id")) {
- replyData.compound["basicStates"].array.push_back(Data(element.getAttribute("id"), Data::VERBATIM));
- }
- }
-
- Arabica::XPath::NodeSet<std::string> activeConf = _interpreter.getConfiguration();
- for (size_t i = 0; i < activeConf.size(); i++) {
- Arabica::DOM::Element<std::string> element = Arabica::DOM::Element<std::string>(activeConf[i]);
- if (element.hasAttribute("id")) {
- replyData.compound["activeStates"].array.push_back(Data(element.getAttribute("id"), Data::VERBATIM));
- }
- }
-
- replyData.compound["replyType"] = Data("breakpoint", Data::VERBATIM);
- _debugger->pushData(shared_from_this(), replyData);
- _resumeCond.wait(_mutex);
-}
-
-Data DebugSession::debugPrepare(const Data& data) {
- Data replyData;
-
- if (!data.hasKey("xml") && !data.hasKey("url")) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No XML or URL given", Data::VERBATIM);
- return replyData;
- }
-
- debugStop(data);
-
- _isAttached = false;
-
- if (data.hasKey("xml")) {
- _interpreter = Interpreter::fromXML(data.at("xml").atom, "");
- } else if (data.hasKey("url")) {
- _interpreter = Interpreter::fromURL(data.at("url").atom);
- } else {
- _interpreter = Interpreter();
- }
-
- if (_interpreter) {
- // register ourself as a monitor
- _interpreter.addMonitor(_debugger);
- _debugger->attachSession(_interpreter, shared_from_this());
- if (data.hasKey("url")) {
- // this allows to resolve relative external reources
- _interpreter.setSourceURL(data.at("url").atom);
- }
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- } else {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- }
-
- return replyData;
-}
-
-Data DebugSession::debugAttach(const Data& data) {
- Data replyData;
- _isAttached = true;
-
- if (!data.hasKey("attach")) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No id to attach to given", Data::VERBATIM);
- return replyData;
- }
-
- std::string interpreterId = data.at("attach").atom;
- bool interpreterFound = false;
-
- // find interpreter for sessionid
- std::map<std::string, boost::weak_ptr<InterpreterImpl> > instances = Interpreter::getInstances();
- for (std::map<std::string, boost::weak_ptr<InterpreterImpl> >::iterator instIter = instances.begin();
- instIter != instances.end();
- instIter++) {
-
- boost::shared_ptr<InterpreterImpl> instance = instIter->second.lock();
- if (instance && instance->getSessionId() == interpreterId) {
- _interpreter = instance;
- _debugger->attachSession(_interpreter, shared_from_this());
- interpreterFound = true;
- break;
- }
- }
-
- if (!interpreterFound) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No interpreter with given id found", Data::VERBATIM);
- } else {
- replyData.compound["xml"].node = _interpreter.getDocument();
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- }
-
- return replyData;
-}
-
-Data DebugSession::debugDetach(const Data& data) {
- Data replyData;
- _isAttached = false;
-
- _debugger->detachSession(_interpreter);
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- return replyData;
-}
-
-Data DebugSession::debugStart(const Data& data) {
- Data replyData;
-
- if (_isAttached) {
- replyData.compound["reason"] = Data("Already started when attached", Data::VERBATIM);
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- } else if (!_interpreter) {
- replyData.compound["reason"] = Data("No interpreter attached or loaded", Data::VERBATIM);
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- } else {
- _interpreter.start();
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- }
-
- return replyData;
-}
-
-Data DebugSession::debugStop(const Data& data) {
- Data replyData;
-
- if (_interpreter) {
- // detach from old intepreter
- _debugger->detachSession(_interpreter);
- }
-
- if (_interpreter && !_isAttached)
- _interpreter.stop();
- // unblock
- _resumeCond.notify_all();
-
- _skipTo = Breakpoint();
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- // calls destructor
- _interpreter = Interpreter();
-
- return replyData;
-}
-
-Data DebugSession::debugStep(const Data& data) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- stepping(true);
- _resumeCond.notify_one();
-
- Data replyData;
- if (_interpreter) {
- // register ourself as a monitor
- if (!_interpreter.isRunning())
- _interpreter.start();
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- } else {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- }
- return replyData;
-}
-
-Data DebugSession::debugResume(const Data& data) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- stepping(false);
-
- Data replyData;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- _resumeCond.notify_one();
- return replyData;
-}
-
-
-Data DebugSession::debugPause(const Data& data) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- _skipTo = Breakpoint();
- stepping(true);
-
- Data replyData;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- return replyData;
-}
-
-Data DebugSession::skipToBreakPoint(const Data& data) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- _skipTo = Breakpoint(data);
-
- Data replyData;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- _resumeCond.notify_one();
- return replyData;
-}
-
-Data DebugSession::addBreakPoint(const Data& data) {
- Breakpoint breakpoint(data);
-
- Data replyData;
- if (_breakPoints.find(breakpoint) == _breakPoints.end()) {
- _breakPoints.insert(breakpoint);
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- } else {
- replyData.compound["reason"] = Data("Breakpoint already exists", Data::VERBATIM);
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- }
- return replyData;
-}
-
-Data DebugSession::removeBreakPoint(const Data& data) {
- Breakpoint breakpoint(data);
-
- Data replyData;
- if (_breakPoints.find(breakpoint) != _breakPoints.end()) {
- _breakPoints.erase(breakpoint);
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- } else {
- replyData.compound["reason"] = Data("No such breakpoint", Data::VERBATIM);
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- }
- return replyData;
-}
-
-Data DebugSession::enableBreakPoint(const Data& data) {
- Breakpoint breakpoint(data);
-
- Data replyData;
- if (_breakPoints.find(breakpoint) != _breakPoints.end()) {
- _breakPoints.find(breakpoint)->enabled = true;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- } else {
- replyData.compound["reason"] = Data("No such breakpoint", Data::VERBATIM);
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- }
-
- return replyData;
-}
-Data DebugSession::disableBreakPoint(const Data& data) {
- Breakpoint breakpoint(data);
-
- Data replyData;
- if (_breakPoints.find(breakpoint) != _breakPoints.end()) {
- _breakPoints.find(breakpoint)->enabled = false;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- } else {
- replyData.compound["reason"] = Data("No such breakpoint", Data::VERBATIM);
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- }
-
- return replyData;
-}
-Data DebugSession::enableAllBreakPoints() {
- Data replyData;
-
- _breakpointsEnabled = true;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- return replyData;
-}
-Data DebugSession::disableAllBreakPoints() {
- Data replyData;
-
- _breakpointsEnabled = false;
- replyData.compound["status"] = Data("success", Data::VERBATIM);
-
- return replyData;
-}
-
-Data DebugSession::debugEval(const Data& data) {
- Data replyData;
-
- if (!data.hasKey("expression")) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No expression given", Data::VERBATIM);
- return replyData;
- }
-
- std::string expr = data.at("expression").atom;
-
- if (!_interpreter) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No interpreter running", Data::VERBATIM);
- } else if (!_interpreter.getDataModel()) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No datamodel available", Data::VERBATIM);
- } else {
- try {
- replyData.compound["eval"] = _interpreter.getDataModel().getStringAsData(expr);
- } catch (Event e) {
- replyData.compound["eval"] = e.data;
- replyData.compound["eval"].compound["error"] = Data(e.name, Data::VERBATIM);
- }
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- }
- return replyData;
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/debug/DebugSession.h b/src/uscxml/debug/DebugSession.h
deleted file mode 100644
index 1fb4f4d..0000000
--- a/src/uscxml/debug/DebugSession.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef DEBUGSESSION_H_M8YHEGV6
-#define DEBUGSESSION_H_M8YHEGV6
-
-#include "uscxml/debug/Breakpoint.h"
-#include "uscxml/Interpreter.h"
-#include <time.h>
-
-namespace uscxml {
-
-class Debugger;
-
-class USCXML_API DebugSession : public boost::enable_shared_from_this<DebugSession> {
-public:
- DebugSession() {
- _isStepping = false;
- _isAttached = false;
- _breakpointsEnabled = true;
- _markedForDeletion = false;
- _debugger = NULL;
- }
-
- void stepping(bool enable) {
- _isStepping = enable;
- }
-
- void checkBreakpoints(const std::list<Breakpoint> qualifiedBreakpoints);
-
- Data debugPrepare(const Data& data);
- Data debugAttach(const Data& data);
- Data debugDetach(const Data& data);
- Data debugStart(const Data& data);
- Data debugStop(const Data& data);
- Data debugStep(const Data& data);
- Data debugResume(const Data& data);
- Data debugPause(const Data& data);
- Data skipToBreakPoint(const Data& data);
- Data addBreakPoint(const Data& data);
- Data removeBreakPoint(const Data& data);
- Data enableBreakPoint(const Data& data);
- Data disableBreakPoint(const Data& data);
- Data enableAllBreakPoints();
- Data disableAllBreakPoints();
- Data debugEval(const Data& data);
-
- void setDebugger(Debugger* debugger) {
- _debugger = debugger;
- }
-
- Interpreter getInterpreter() {
- return _interpreter;
- }
-
- void markForDeletion(bool mark) {
- _markedForDeletion = mark;
- }
-
-protected:
- void breakExecution(Data replyData);
-
- bool _isStepping;
- bool _isAttached;
- bool _breakpointsEnabled;
-
- tthread::condition_variable _resumeCond;
- tthread::recursive_mutex _runMutex;
- tthread::recursive_mutex _mutex;
-
- bool _markedForDeletion;
- Debugger* _debugger;
- Interpreter _interpreter;
- std::set<Breakpoint> _breakPoints;
- Breakpoint _skipTo;
-
-};
-
-
-}
-
-
-#endif /* end of include guard: DEBUGSESSION_H_M8YHEGV6 */
diff --git a/src/uscxml/debug/Debugger.cpp b/src/uscxml/debug/Debugger.cpp
deleted file mode 100644
index f8b13fe..0000000
--- a/src/uscxml/debug/Debugger.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/**
-* @file
-* @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
-* @copyright Simplified BSD
-*
-* @cond
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the FreeBSD license as published by the FreeBSD
-* project.
-*
-* This program 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.
-*
-* You should have received a copy of the FreeBSD license along with this
-* program. If not, see <http://www.opensource.org/licenses/bsd-license>.
-* @endcond
-*/
-
-#include "uscxml/debug/Debugger.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/debug/DebugSession.h"
-
-namespace uscxml {
-
-void Debugger::afterCompletion(Interpreter interpreter) {
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- Data msg;
- msg.compound["replyType"] = Data("finished", Data::VERBATIM);
- pushData(session, msg);
-}
-
-std::list<Breakpoint> getQualifiedStateBreakpoints(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, Breakpoint breakpointTemplate) {
- std::list<Breakpoint> breakpoints;
-
- Breakpoint bp = breakpointTemplate; // copy base as template
- bp.stateId = ATTR(state, "id");
- bp.element = state;
- bp.subject = Breakpoint::STATE;
- breakpoints.push_back(bp);
-
- return breakpoints;
-}
-
-std::list<Breakpoint> getQualifiedInvokeBreakpoints(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string invokeId, Breakpoint breakpointTemplate) {
- std::list<Breakpoint> breakpoints;
-
- Breakpoint bp = breakpointTemplate; // copy base as template
- bp.subject = Breakpoint::INVOKER;
- bp.element = invokeElem;
- bp.invokeId = invokeId;
-
- if (HAS_ATTR(invokeElem, "type")) {
- bp.invokeType = ATTR(invokeElem, "type");
- } else if (HAS_ATTR(invokeElem, "typeexpr")) {
- bp.invokeType = interpreter.getDataModel().evalAsString(ATTR(invokeElem, "typeexpr"));
- }
-
- breakpoints.push_back(bp);
-
- return breakpoints;
-}
-
-std::list<Breakpoint> getQualifiedTransBreakpoints(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, Breakpoint breakpointTemplate) {
- std::list<Breakpoint> breakpoints;
-
- Arabica::DOM::Element<std::string> source(interpreter.getImpl()->getSourceState(transition));
- Arabica::XPath::NodeSet<std::string> targets = interpreter.getImpl()->getTargetStates(transition);
-
- for (size_t j = 0; j < targets.size(); j++) {
- Arabica::DOM::Element<std::string> target(targets[j]);
-
- Breakpoint bp = breakpointTemplate; // copy base as template
- bp.element = transition;
- bp.transSourceId = ATTR(source, "id");
- bp.transTargetId = ATTR(target, "id");
- bp.subject = Breakpoint::TRANSITION;
-
- breakpoints.push_back(bp);
- }
-
- return breakpoints;
-}
-
-void Debugger::beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
- handleTransition(interpreter, transition, Breakpoint::BEFORE);
-}
-void Debugger::afterTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
- handleTransition(interpreter, transition, Breakpoint::AFTER);
-}
-void Debugger::beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& content) {
- handleExecutable(interpreter, Arabica::DOM::Element<std::string>(content), Breakpoint::BEFORE);
-}
-void Debugger::afterExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& content) {
- handleExecutable(interpreter, Arabica::DOM::Element<std::string>(content), Breakpoint::AFTER);
-}
-void Debugger::beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- handleState(interpreter, state, Breakpoint::BEFORE, Breakpoint::EXIT);
-}
-void Debugger::afterExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- handleState(interpreter, state, Breakpoint::AFTER, Breakpoint::EXIT);
-}
-void Debugger::beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- handleState(interpreter, state, Breakpoint::BEFORE, Breakpoint::ENTER);
-}
-void Debugger::afterEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- handleState(interpreter, state, Breakpoint::AFTER, Breakpoint::ENTER);
-}
-void Debugger::beforeUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
- handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::BEFORE, Breakpoint::UNINVOKE);
-}
-void Debugger::afterUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
- handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::AFTER, Breakpoint::UNINVOKE);
-}
-void Debugger::beforeInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
- handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::BEFORE, Breakpoint::INVOKE);
-}
-void Debugger::afterInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
- handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::AFTER, Breakpoint::INVOKE);
-}
-void Debugger::onStableConfiguration(Interpreter interpreter) {
- handleStable(interpreter, Breakpoint::ON);
-}
-void Debugger::beforeMicroStep(Interpreter interpreter) {
- handleMicrostep(interpreter, Breakpoint::BEFORE);
-}
-void Debugger::afterMicroStep(Interpreter interpreter) {
- handleMicrostep(interpreter, Breakpoint::AFTER);
-}
-void Debugger::beforeProcessingEvent(Interpreter interpreter, const Event& event) {
- handleEvent(interpreter, event, Breakpoint::BEFORE);
-}
-
-void Debugger::handleExecutable(Interpreter interpreter,
- const Arabica::DOM::Element<std::string>& execContentElem,
- Breakpoint::When when) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- std::list<Breakpoint> breakpoints;
-
- Breakpoint breakpoint;
- breakpoint.when = when;
- breakpoint.element = execContentElem;
- breakpoint.executableName = execContentElem.getLocalName();
- breakpoint.subject = Breakpoint::EXECUTABLE;
- breakpoints.push_back(breakpoint);
-
- session->checkBreakpoints(breakpoints);
-
-}
-
-void Debugger::handleEvent(Interpreter interpreter, const Event& event, Breakpoint::When when) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- std::list<Breakpoint> breakpoints;
-
- Breakpoint breakpoint;
- breakpoint.when = when;
- breakpoint.eventName = event.name;
- breakpoint.subject = Breakpoint::EVENT;
- breakpoints.push_back(breakpoint);
-
- session->checkBreakpoints(breakpoints);
-
-}
-
-void Debugger::handleStable(Interpreter interpreter, Breakpoint::When when) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- std::list<Breakpoint> breakpoints;
-
- Breakpoint breakpoint;
- breakpoint.when = when;
- breakpoint.subject = Breakpoint::STABLE;
- breakpoints.push_back(breakpoint);
-
- session->checkBreakpoints(breakpoints);
-}
-
-void Debugger::handleMicrostep(Interpreter interpreter, Breakpoint::When when) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- std::list<Breakpoint> breakpoints;
-
- Breakpoint breakpoint;
- breakpoint.when = when;
- breakpoint.subject = Breakpoint::MICROSTEP;
- breakpoints.push_back(breakpoint);
-
- session->checkBreakpoints(breakpoints);
-}
-
-void Debugger::handleTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, Breakpoint::When when) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- Breakpoint breakpointTemplate;
- breakpointTemplate.when = when;
- std::list<Breakpoint> qualifiedBreakpoints = getQualifiedTransBreakpoints(interpreter, transition, breakpointTemplate);
- session->checkBreakpoints(qualifiedBreakpoints);
-}
-
-void Debugger::handleState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, Breakpoint::When when, Breakpoint::Action action) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- Breakpoint breakpointTemplate;
- breakpointTemplate.when = when;
- breakpointTemplate.action = action;
- std::list<Breakpoint> qualifiedBreakpoints = getQualifiedStateBreakpoints(interpreter, state, breakpointTemplate);
- session->checkBreakpoints(qualifiedBreakpoints);
-
-}
-
-void Debugger::handleInvoke(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeId, Breakpoint::When when, Breakpoint::Action action) {
- if (!interpreter.isRunning())
- return;
- boost::shared_ptr<DebugSession> session = getSession(interpreter);
- if (!session)
- return;
-
- Breakpoint breakpointTemplate;
- breakpointTemplate.when = when;
- breakpointTemplate.action = action;
- std::list<Breakpoint> qualifiedBreakpoints = getQualifiedInvokeBreakpoints(interpreter, invokeElem, invokeId, breakpointTemplate);
- session->checkBreakpoints(qualifiedBreakpoints);
-
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/debug/Debugger.h b/src/uscxml/debug/Debugger.h
deleted file mode 100644
index 03846e5..0000000
--- a/src/uscxml/debug/Debugger.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef DEBUGGERMONITOR_H_Z050WPFH
-#define DEBUGGERMONITOR_H_Z050WPFH
-
-#include "uscxml/messages/Data.h" // for Data
-#include "uscxml/messages/Event.h" // for Event
-#include "uscxml/Interpreter.h"
-#include "uscxml/debug/Breakpoint.h"
-
-namespace uscxml {
-
-class DebugSession;
-
-class USCXML_API Debugger : public InterpreterMonitor {
-public:
- Debugger() {
- }
- virtual ~Debugger() {}
-
- virtual void attachSession(Interpreter interpreter, boost::shared_ptr<DebugSession> session) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_sessionMutex);
- _sessionForInterpreter[interpreter] = session;
- }
-
- virtual void detachSession(Interpreter interpreter) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_sessionMutex);
- _sessionForInterpreter.erase(interpreter);
- }
-
- virtual boost::shared_ptr<DebugSession> getSession(Interpreter interpreter) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_sessionMutex);
- if (_sessionForInterpreter.find(interpreter) != _sessionForInterpreter.end())
- return _sessionForInterpreter[interpreter];
- return boost::shared_ptr<DebugSession>();
- }
-
- virtual void pushData(boost::shared_ptr<DebugSession> session, Data pushData) = 0;
-
- // InterpreterMonitor
- virtual void beforeProcessingEvent(Interpreter interpreter, const Event& event);
- virtual void beforeMicroStep(Interpreter interpreter);
- virtual void beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void afterExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element);
- virtual void afterExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element);
- virtual void beforeUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid);
- virtual void afterUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid);
- virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
- virtual void afterTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
- virtual void beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void afterEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid);
- virtual void afterInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid);
- virtual void afterMicroStep(Interpreter interpreter);
- virtual void onStableConfiguration(Interpreter interpreter);
- virtual void beforeCompletion(Interpreter interpreter) {}
- virtual void afterCompletion(Interpreter interpreter);
-
-protected:
-
- void handleTransition(Interpreter interpreter,
- const Arabica::DOM::Element<std::string>& transition,
- Breakpoint::When when);
- void handleState(Interpreter interpreter,
- const Arabica::DOM::Element<std::string>& state,
- Breakpoint::When when,
- Breakpoint::Action action);
- void handleInvoke(Interpreter interpreter,
- const Arabica::DOM::Element<std::string>& invokeElem,
- const std::string& invokeId,
- Breakpoint::When when,
- Breakpoint::Action action);
- void handleExecutable(Interpreter interpreter,
- const Arabica::DOM::Element<std::string>& execContentElem,
- Breakpoint::When when);
- void handleStable(Interpreter interpreter, Breakpoint::When when);
- void handleMicrostep(Interpreter interpreter, Breakpoint::When when);
- void handleEvent(Interpreter interpreter, const Event& event, Breakpoint::When when);
-
- tthread::recursive_mutex _sessionMutex;
- std::map<Interpreter, boost::shared_ptr<DebugSession> > _sessionForInterpreter;
-};
-
-}
-
-
-#endif /* end of include guard: DEBUGGERMONITOR_H_Z050WPFH */
diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp
deleted file mode 100644
index 64426ff..0000000
--- a/src/uscxml/debug/DebuggerServlet.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/debug/DebuggerServlet.h"
-#include "uscxml/debug/DebugSession.h"
-#include "uscxml/UUID.h"
-#include <boost/algorithm/string.hpp>
-
-namespace uscxml {
-
-void DebuggerServlet::pushData(boost::shared_ptr<DebugSession> session, Data pushData) {
- std::cout << "trying to push " << pushData.at("replyType").atom << std::endl;
-
- if (!session) {
- if (_sendQueues.size() > 0) // logging is not aware of its interpreter
- _sendQueues.begin()->second.push(pushData);
- } else {
- _sendQueues[session].push(pushData);
- }
-
- serverPushData(session);
-}
-
-void DebuggerServlet::serverPushData(boost::shared_ptr<DebugSession> session) {
- if (_sendQueues[session].isEmpty())
- return;
-
- if (!_clientConns[session])
- return;
-
- Data reply = _sendQueues[session].pop();
- std::cout << "pushing " << reply.at("replyType").atom << std::endl;
- returnData(_clientConns[session], reply);
- _clientConns[session] = HTTPServer::Request();
-}
-
-void DebuggerServlet::returnData(const HTTPServer::Request& request, Data replyData) {
- HTTPServer::Reply reply(request);
-
- if (!replyData.hasKey("status")) {
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- }
-
- std::cout << "<- " << replyData << std::endl;
-
- reply.content = Data::toJSON(replyData);
- reply.headers["Access-Control-Allow-Origin"] = "*";
- reply.headers["Content-Type"] = "application/json";
- HTTPServer::reply(reply);
-}
-
-bool DebuggerServlet::isCORS(const HTTPServer::Request& request) {
- return (request.data.at("type").atom == "options" &&
- request.data.at("header").hasKey("Origin") &&
- request.data.at("header").hasKey("Access-Control-Request-Method"));
-}
-
-void DebuggerServlet::handleCORS(const HTTPServer::Request& request) {
- HTTPServer::Reply corsReply(request);
- if (request.data.at("header").hasKey("Origin")) {
- corsReply.headers["Access-Control-Allow-Origin"] = request.data.at("header").at("Origin").atom;
- } else {
- corsReply.headers["Access-Control-Allow-Origin"] = "*";
- }
- if (request.data.at("header").hasKey("Access-Control-Request-Method"))
- corsReply.headers["Access-Control-Allow-Methods"] = request.data.at("header").at("Access-Control-Request-Method").atom;
- if (request.data.at("header").hasKey("Access-Control-Request-Headers"))
- corsReply.headers["Access-Control-Allow-Headers"] = request.data.at("header").at("Access-Control-Request-Headers").atom;
-
- // std::cout << "CORS!" << std::endl << request << std::endl;
- HTTPServer::reply(corsReply);
-}
-
-bool DebuggerServlet::httpRecvRequest(const HTTPServer::Request& request) {
- if (!request.data.hasKey("path"))
- return false; // returnError(request);
-
- if (isCORS(request)) {
- handleCORS(request);
- return true;
- }
-
- std::cout << request.data["path"] << ": " << request.data["content"] << std::endl;
-
- Data replyData;
- // process request that don't need a session
- if (false) {
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/connect")) {
- processConnect(request);
- return true;
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/sessions")) {
- processListSessions(request);
- return true;
- }
-
- // get session or return error
- if (false) {
- } else if (!request.data.at("content").hasKey("session")) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No session given", Data::VERBATIM);
- } else if (_sessionForId.find(request.data.at("content").at("session").atom) == _sessionForId.end()) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No such session", Data::VERBATIM);
- }
- if (!replyData.empty()) {
- returnData(request, replyData);
- return true;
- }
-
- boost::shared_ptr<DebugSession> session = _sessionForId[request.data.at("content").at("session").atom];
-
- if (false) {
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/poll")) {
- // save long-standing client poll
- _clientConns[session] = request;
- serverPushData(session);
-
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/disconnect")) {
- processDisconnect(request);
-
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/enable/all")) {
- replyData = session->enableAllBreakPoints();
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/disable/all")) {
- replyData = session->disableAllBreakPoints();
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/skipto")) {
- replyData = session->skipToBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/add")) {
- replyData = session->addBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/remove")) {
- replyData = session->removeBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/enable")) {
- replyData = session->enableBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/disable")) {
- replyData = session->disableBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/stop")) {
- replyData = session->debugStop(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/prepare")) {
- replyData = session->debugPrepare(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/attach")) {
- replyData = session->debugAttach(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/start")) {
- replyData = session->debugStart(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/step")) {
- replyData = session->debugStep(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/pause")) {
- replyData = session->debugPause(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/resume")) {
- replyData = session->debugResume(request.data["content"]);
- } else if (boost::starts_with(request.data.at("path").atom, "/debug/eval")) {
- replyData = session->debugEval(request.data["content"]);
- }
-
- if (!replyData.empty()) {
- returnData(request, replyData);
- return true;
- }
-
- return true;
-}
-
-// someone connected, create a new session
-void DebuggerServlet::processConnect(const HTTPServer::Request& request) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::string sessionId = UUID::getUUID();
-
- _sessionForId[sessionId] = boost::shared_ptr<DebugSession>(new DebugSession());
- _sessionForId[sessionId]->setDebugger(this);
-
- Data replyData;
- replyData.compound["session"] = Data(sessionId, Data::VERBATIM);
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- returnData(request, replyData);
-}
-
-void DebuggerServlet::processDisconnect(const HTTPServer::Request& request) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- Data replyData;
-
- if (!request.data.at("content").hasKey("session")) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No session given", Data::VERBATIM);
- returnData(request, replyData);
- }
-
- std::string sessionId = request.data.at("content").at("session").atom;
-
- if (_sessionForId.find(sessionId) == _sessionForId.end()) {
- replyData.compound["status"] = Data("failure", Data::VERBATIM);
- replyData.compound["reason"] = Data("No such session", Data::VERBATIM);
- } else {
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- detachSession(_sessionForId[sessionId]->getInterpreter());
- _sessionForId[sessionId]->debugStop(request.data["content"]);
- _clientConns.erase(_sessionForId[sessionId]);
- _sendQueues.erase(_sessionForId[sessionId]);
- _sessionForId.erase(sessionId);
- }
-
- returnData(request, replyData);
-}
-
-void DebuggerServlet::processListSessions(const HTTPServer::Request& request) {
- Data replyData;
-
- std::map<std::string, boost::weak_ptr<InterpreterImpl> > instances = Interpreter::getInstances();
- for (std::map<std::string, boost::weak_ptr<InterpreterImpl> >::iterator instIter = instances.begin();
- instIter != instances.end();
- instIter++) {
-
- boost::shared_ptr<InterpreterImpl> instance = instIter->second.lock();
- if (instance) {
- Data sessionData;
- sessionData.compound["name"] = Data(instance->getName(), Data::VERBATIM);
- sessionData.compound["id"] = Data(instance->getSessionId(), Data::VERBATIM);
- sessionData.compound["source"] = Data(instance->getSourceURL(), Data::VERBATIM);
- sessionData.compound["xml"].node = instance->getDocument();
-
- replyData.compound["sessions"].array.push_back(sessionData);
- }
- }
-
- replyData.compound["status"] = Data("success", Data::VERBATIM);
- returnData(request, replyData);
-}
-
-void DebuggerServlet::send(google::LogSeverity severity, const char* full_filename,
- const char* base_filename, int line,
- const struct ::tm* tm_time,
- const char* message, size_t message_len) {
-
- // _sendQueue is thread-safe, not sure about ToString though
-
- LogMessage msg(severity,
- full_filename,
- base_filename,
- line,
- tm_time,
- std::string(message, message_len),
- ToString(severity, base_filename, line, tm_time, message, message_len));
- msg.compound["replyType"] = Data("log", Data::VERBATIM);
- pushData(boost::shared_ptr<DebugSession>(), msg);
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/debug/DebuggerServlet.h b/src/uscxml/debug/DebuggerServlet.h
deleted file mode 100644
index 8abe741..0000000
--- a/src/uscxml/debug/DebuggerServlet.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef DEBUGGERSERVLET_H_ATUMDA3G
-#define DEBUGGERSERVLET_H_ATUMDA3G
-
-#include "uscxml/Common.h"
-#include <glog/logging.h>
-
-#include "uscxml/server/HTTPServer.h"
-
-#include "uscxml/debug/Debugger.h"
-#include "uscxml/concurrency/tinythread.h"
-
-namespace uscxml {
-
-class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet, public google::LogSink {
-public:
- class LogMessage : public Data {
- public:
- LogMessage(google::LogSeverity severity, const char* full_filename,
- const char* base_filename, int line,
- const struct ::tm* tm_time,
- std::string message, std::string formatted) {
-
- compound["severity"] = severity;
- compound["fullFilename"] = Data(full_filename, Data::VERBATIM);
- compound["baseFilename"] = Data(base_filename, Data::VERBATIM);
- compound["line"] = line;
- compound["message"] = Data(message, Data::VERBATIM);
- compound["time"] = Data(mktime((struct ::tm*)tm_time), Data::INTERPRETED);
- compound["formatted"] = Data(formatted, Data::VERBATIM);
- }
- };
-
- virtual ~DebuggerServlet() {}
-
- // from Debugger
- virtual void addBreakpoint(const Breakpoint& breakpoint) {};
-
- bool isCORS(const HTTPServer::Request& request);
- void handleCORS(const HTTPServer::Request& request);
-
- bool httpRecvRequest(const HTTPServer::Request& request);
- void setURL(const std::string& url) {
- _url = url;
- }
-
- void pushData(boost::shared_ptr<DebugSession> session, Data pushData);
- void returnData(const HTTPServer::Request& request, Data replyData);
-
- void processDisconnect(const HTTPServer::Request& request);
- void processConnect(const HTTPServer::Request& request);
- void processListSessions(const HTTPServer::Request& request);
-
-// void processDebugPrepare(const HTTPServer::Request& request);
-// void processDebugAttach(const HTTPServer::Request& request);
-// void processDebugStart(const HTTPServer::Request& request);
-// void processDebugStop(const HTTPServer::Request& request);
-
-// void processDebugEval(const HTTPServer::Request& request);
-// void processDebugStart(const HTTPServer::Request& request);
-// void processDebugStop(const HTTPServer::Request& request);
-// void processDebugStep(const HTTPServer::Request& request);
-// void processDebugResume(const HTTPServer::Request& request);
-// void processDebugPause(const HTTPServer::Request& request);
-// void processAddBreakPoint(const HTTPServer::Request& request);
-// void processRemoveBreakPoint(const HTTPServer::Request& request);
-// void processPoll(const HTTPServer::Request& request);
-
- // Logsink
- virtual void send(google::LogSeverity severity, const char* full_filename,
- const char* base_filename, int line,
- const struct ::tm* tm_time,
- const char* message, size_t message_len);
-
-protected:
- void serverPushData(boost::shared_ptr<DebugSession>);
-
- std::string _url;
- std::map<boost::shared_ptr<DebugSession>, HTTPServer::Request> _clientConns;
- std::map<boost::shared_ptr<DebugSession>, concurrency::BlockingQueue<Data> > _sendQueues;
- std::map<std::string, boost::shared_ptr<DebugSession> > _sessionForId;
-
- tthread::recursive_mutex _mutex;
-};
-
-}
-
-#endif /* end of include guard: DEBUGGERSERVLET_H_ATUMDA3G */
diff --git a/src/uscxml/debug/InterpreterIssue.cpp b/src/uscxml/debug/InterpreterIssue.cpp
index 1bb14f6..ce61af6 100644
--- a/src/uscxml/debug/InterpreterIssue.cpp
+++ b/src/uscxml/debug/InterpreterIssue.cpp
@@ -20,67 +20,128 @@
#include <string>
#include "InterpreterIssue.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/debug/Complexity.h"
+#include "uscxml/util/DOM.h"
+#include "uscxml/util/String.h"
+#include "uscxml/util/Predicates.h"
+//#include "uscxml/debug/Complexity.h"
#include "uscxml/Interpreter.h"
-#include "uscxml/Factory.h"
+#include "uscxml/plugins/Factory.h"
-#include <XPath/XPath.hpp>
-#include <DOM/Document.hpp>
+#include <xercesc/dom/DOMDocument.hpp>
namespace uscxml {
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
+using namespace xercesc;
-InterpreterIssue::InterpreterIssue(const std::string& msg, Arabica::DOM::Node<std::string> node, IssueSeverity severity, const std::string& specRef) : message(msg), node(node), severity(severity), specRef(specRef) {
+InterpreterIssue::InterpreterIssue(const std::string& msg, DOMNode* node, IssueSeverity severity, const std::string& specRef) : message(msg), node(node), severity(severity), specRef(specRef) {
if (node)
xPath = DOMUtils::xPathForNode(node);
}
// find all elements in the SCXML namespace in one traversal
-void assembleNodeSets(const std::string nsPrefix, const Node<std::string>& node, std::map<std::string, NodeSet<std::string> >& sets) {
- NodeList<std::string> childs = node.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
+void assembleNodeSets(const std::string nsPrefix, DOMNode* node, std::map<std::string, std::list<DOMElement*> >& sets) {
+ DOMNodeList* childs = node->getChildNodes();
+ for (unsigned int i = 0; i < childs->getLength(); i++) {
+ if (childs->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
continue;
// std::cout << TAGNAME(childs.item(i)) << std::endl;
- if (TAGNAME_CAST(childs.item(i)).find(nsPrefix) == 0) {
+ if (TAGNAME_CAST(childs->item(i)).find(nsPrefix) == 0) {
// correct namespace, insert via localname
- sets[LOCALNAME_CAST(childs.item(i))].push_back(childs.item(i));
+ sets[LOCALNAME_CAST(childs->item(i))].push_back(static_cast<DOMElement*>(childs->item(i)));
}
- assembleNodeSets(nsPrefix, childs.item(i), sets);
+ assembleNodeSets(nsPrefix, childs->item(i), sets);
}
}
+std::list<std::set<const DOMElement* > > getAllConfigurations(const DOMElement* root) {
+ std::list<std::set<const DOMElement* > > allConfigurations;
+ std::string nsPrefix = X(root->getPrefix());
+ std::string localName = X(root->getLocalName());
+ bool isAtomic = true;
+
+ std::cout << *root;
+
+ DOMNodeList* children = root->getChildNodes();
+ for (size_t i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ DOMElement* childElem = static_cast<DOMElement*>(children->item(i));
+ std::cout << *childElem;
+
+ if (XMLString::compareIString(childElem->getTagName(), X(nsPrefix + "state")) == 0 ||
+ XMLString::compareIString(childElem->getTagName(), X(nsPrefix + "parallel")) == 0 ||
+ XMLString::compareIString(childElem->getTagName(), X(nsPrefix + "final")) == 0) {
+ // nested child state
+ std::list<std::set<const DOMElement*> > nestedConfigurations = getAllConfigurations(childElem);
+ isAtomic = false;
+ if (localName == "parallel" && allConfigurations.size() > 0) {
+ // for every nested configuration, every new nested is valid
+ std::list<std::set<const DOMElement*> > combinedConfigurations;
+ for (auto existIter = allConfigurations.begin(); existIter != allConfigurations.end(); existIter++) {
+ std::set<const DOMElement*> existingConfig = *existIter;
+
+ for (auto newIter = nestedConfigurations.begin(); newIter != nestedConfigurations.end(); newIter++) {
+
+ std::set<const DOMElement*> newConfig = *newIter;
+ std::set<const DOMElement*> combinedSet;
+ combinedSet.insert(existingConfig.begin(), existingConfig.end());
+ combinedSet.insert(newConfig.begin(), newConfig.end());
+
+ combinedConfigurations.push_back(combinedSet);
+ }
+ }
+ allConfigurations = combinedConfigurations;
+ } else {
+ // just add nested configurations and this
+ for (auto newIter = nestedConfigurations.begin(); newIter != nestedConfigurations.end(); newIter++) {
+ std::set<const DOMElement*> newConfig = *newIter;
+ if (localName != "scxml")
+ newConfig.insert(root);
+ allConfigurations.push_back(newConfig);
+ }
+ }
+ }
+ }
+
+ if (isAtomic) {
+ std::set<const DOMElement*> soleConfig;
+ soleConfig.insert(root);
+ allConfigurations.push_back(soleConfig);
+ }
+ return allConfigurations;
+
+}
/**
* Can the given states ever appear in an active configuration?
*/
-bool hasLegalCompletion(const NodeSet<std::string>& states) {
+bool hasLegalCompletion(const std::list<DOMElement*>& states) {
if (states.size() < 2)
return true;
// iterate every pair
- for (unsigned int outer = 0; outer < states.size() - 1; outer++) {
- Element<std::string> s1(states[outer]);
- for (unsigned int inner = outer + 1; inner < states.size(); inner++) {
- Element<std::string> s2(states[inner]);
- Node<std::string> parent;
+ for (auto outer = states.begin(); outer != states.end(); outer++) {
+ DOMElement* s1 = *outer;
+ for (auto inner = outer; inner != states.end(); inner++) {
+ if (inner == outer)
+ continue;
+
+ DOMElement* s2 = *inner;
+ DOMNode* parent;
// ok to be directly ancestorally related
- if (InterpreterImpl::isDescendant(s1, s2) || InterpreterImpl::isDescendant(s2, s1))
+ if (DOMUtils::isDescendant(s1, s2) || DOMUtils::isDescendant(s2, s1))
goto NEXT_PAIR;
// find least common ancestor
- parent = s1.getParentNode();
- while(parent && parent.getNodeType() == Node_base::ELEMENT_NODE) {
- if (InterpreterImpl::isDescendant(s2, parent)) {
- if (InterpreterImpl::isParallel(Element<std::string>(parent)))
+ parent = s1->getParentNode();
+ while(parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
+ if (DOMUtils::isDescendant(s2, parent)) {
+ if (isParallel(static_cast<DOMElement*>(parent)))
goto NEXT_PAIR;
}
- parent = parent.getParentNode();
+ parent = parent->getParentNode();
}
return false;
@@ -100,91 +161,90 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
std::list<InterpreterIssue> issues;
if (!interpreter->_scxml) {
- InterpreterIssue issue("No SCXML element to be found", Node<std::string>(), InterpreterIssue::USCXML_ISSUE_FATAL);
+ InterpreterIssue issue("No SCXML element to be found", NULL, InterpreterIssue::USCXML_ISSUE_FATAL);
issues.push_back(issue);
return issues;
}
- std::map<std::string, Arabica::DOM::Element<std::string> > seenStates;
+ std::map<std::string, DOMElement* > seenStates;
// get some aliases
- Element<std::string>& _scxml = interpreter->_scxml;
- NameSpaceInfo& _nsInfo = interpreter->_nsInfo;
+ DOMElement* _scxml = interpreter->_scxml;
Factory* _factory = interpreter->_factory;
DataModel& _dataModel = interpreter->_dataModel;
+ std::string xmlNSPrefix = interpreter->_xmlPrefix;
+ std::map<std::string, std::list<DOMElement*> > nodeSets;
+ assembleNodeSets(xmlNSPrefix, _scxml, nodeSets);
- std::map<std::string, NodeSet<std::string> > nodeSets;
- assembleNodeSets(_nsInfo.xmlNSPrefix, _scxml, nodeSets);
-
- NodeSet<std::string> scxmls = nodeSets["scxml"];
+ std::list<DOMElement*> scxmls = nodeSets["scxml"];
scxmls.push_back(_scxml);
- NodeSet<std::string> reachable = interpreter->getReachableStates();
-
- NodeSet<std::string>& states = nodeSets["state"];
- NodeSet<std::string>& parallels = nodeSets["parallel"];
- NodeSet<std::string>& transitions = nodeSets["transition"];
- NodeSet<std::string>& initials = nodeSets["initial"];
- NodeSet<std::string>& finals = nodeSets["final"];
- NodeSet<std::string>& onEntries = nodeSets["onentry"];
- NodeSet<std::string>& onExits = nodeSets["onexit"];
- NodeSet<std::string>& histories = nodeSets["history"];
-
- NodeSet<std::string>& raises = nodeSets["raise"];
- NodeSet<std::string>& ifs = nodeSets["if"];
- NodeSet<std::string>& elseIfs = nodeSets["elseif"];
- NodeSet<std::string>& elses = nodeSets["else"];
- NodeSet<std::string>& foreachs = nodeSets["foreach"];
- NodeSet<std::string>& logs = nodeSets["log"];
-
- NodeSet<std::string>& dataModels = nodeSets["datamodel"];
- NodeSet<std::string>& datas = nodeSets["data"];
- NodeSet<std::string>& assigns = nodeSets["assign"];
- NodeSet<std::string>& doneDatas = nodeSets["donedata"];
- NodeSet<std::string>& contents = nodeSets["content"];
- NodeSet<std::string>& params = nodeSets["param"];
- NodeSet<std::string>& scripts = nodeSets["script"];
-
- NodeSet<std::string>& sends = nodeSets["send"];
- NodeSet<std::string>& cancels = nodeSets["cancel"];
- NodeSet<std::string>& invokes = nodeSets["invoke"];
- NodeSet<std::string>& finalizes = nodeSets["finalize"];
-
- NodeSet<std::string> allStates;
- allStates.push_back(states);
- allStates.push_back(parallels);
- allStates.push_back(histories);
- allStates.push_back(finals);
-
- NodeSet<std::string> allExecContents;
- allExecContents.push_back(raises);
- allExecContents.push_back(ifs);
- allExecContents.push_back(elseIfs);
- allExecContents.push_back(elses);
- allExecContents.push_back(foreachs);
- allExecContents.push_back(logs);
- allExecContents.push_back(sends);
- allExecContents.push_back(assigns);
- allExecContents.push_back(scripts);
- allExecContents.push_back(cancels);
-
- NodeSet<std::string> allElements;
- allElements.push_back(scxmls);
- allElements.push_back(allStates);
- allElements.push_back(allExecContents);
- allElements.push_back(transitions);
- allElements.push_back(initials);
- allElements.push_back(onEntries);
- allElements.push_back(onExits);
- allElements.push_back(dataModels);
- allElements.push_back(datas);
- allElements.push_back(doneDatas);
- allElements.push_back(contents);
- allElements.push_back(params);
- allElements.push_back(invokes);
- allElements.push_back(finalizes);
+ std::list<xercesc::DOMElement*> reachable = getReachableStates(_scxml);
+
+ std::list<DOMElement*>& states = nodeSets["state"];
+ std::list<DOMElement*>& parallels = nodeSets["parallel"];
+ std::list<DOMElement*>& transitions = nodeSets["transition"];
+ std::list<DOMElement*>& initials = nodeSets["initial"];
+ std::list<DOMElement*>& finals = nodeSets["final"];
+ std::list<DOMElement*>& onEntries = nodeSets["onentry"];
+ std::list<DOMElement*>& onExits = nodeSets["onexit"];
+ std::list<DOMElement*>& histories = nodeSets["history"];
+
+ std::list<DOMElement*>& raises = nodeSets["raise"];
+ std::list<DOMElement*>& ifs = nodeSets["if"];
+ std::list<DOMElement*>& elseIfs = nodeSets["elseif"];
+ std::list<DOMElement*>& elses = nodeSets["else"];
+ std::list<DOMElement*>& foreachs = nodeSets["foreach"];
+ std::list<DOMElement*>& logs = nodeSets["log"];
+
+ std::list<DOMElement*>& dataModels = nodeSets["datamodel"];
+ std::list<DOMElement*>& datas = nodeSets["data"];
+ std::list<DOMElement*>& assigns = nodeSets["assign"];
+ std::list<DOMElement*>& doneDatas = nodeSets["donedata"];
+ std::list<DOMElement*>& contents = nodeSets["content"];
+ std::list<DOMElement*>& params = nodeSets["param"];
+ std::list<DOMElement*>& scripts = nodeSets["script"];
+
+ std::list<DOMElement*>& sends = nodeSets["send"];
+ std::list<DOMElement*>& cancels = nodeSets["cancel"];
+ std::list<DOMElement*>& invokes = nodeSets["invoke"];
+ std::list<DOMElement*>& finalizes = nodeSets["finalize"];
+
+ std::list<DOMElement*> allStates;
+ allStates.insert(allStates.end(), states.begin(), states.end());
+ allStates.insert(allStates.end(), parallels.begin(), parallels.end());
+ allStates.insert(allStates.end(), histories.begin(), histories.end());
+ allStates.insert(allStates.end(), finals.begin(), finals.end());
+
+ std::list<DOMElement*> allExecContents;
+ allExecContents.insert(allExecContents.end(), raises.begin(), raises.end());
+ allExecContents.insert(allExecContents.end(), ifs.begin(), ifs.end());
+ allExecContents.insert(allExecContents.end(), elseIfs.begin(), elseIfs.end());
+ allExecContents.insert(allExecContents.end(), elses.begin(), elses.end());
+ allExecContents.insert(allExecContents.end(), foreachs.begin(), foreachs.end());
+ allExecContents.insert(allExecContents.end(), logs.begin(), logs.end());
+ allExecContents.insert(allExecContents.end(), sends.begin(), sends.end());
+ allExecContents.insert(allExecContents.end(), assigns.begin(), assigns.end());
+ allExecContents.insert(allExecContents.end(), scripts.begin(), scripts.end());
+ allExecContents.insert(allExecContents.end(), cancels.begin(), cancels.end());
+
+ std::list<DOMElement*> allElements;
+ allElements.insert(allElements.end(), scxmls.begin(), scxmls.end());
+ allElements.insert(allElements.end(), allStates.begin(), allStates.end());
+ allElements.insert(allElements.end(), allExecContents.begin(), allExecContents.end());
+ allElements.insert(allElements.end(), transitions.begin(), transitions.end());
+ allElements.insert(allElements.end(), initials.begin(), initials.end());
+ allElements.insert(allElements.end(), onEntries.begin(), onEntries.end());
+ allElements.insert(allElements.end(), onExits.begin(), onExits.end());
+ allElements.insert(allElements.end(), dataModels.begin(), dataModels.end());
+ allElements.insert(allElements.end(), datas.begin(), datas.end());
+ allElements.insert(allElements.end(), doneDatas.begin(), doneDatas.end());
+ allElements.insert(allElements.end(), contents.begin(), contents.end());
+ allElements.insert(allElements.end(), params.begin(), params.end());
+ allElements.insert(allElements.end(), invokes.begin(), invokes.end());
+ allElements.insert(allElements.end(), finalizes.begin(), finalizes.end());
std::set<std::string> execContentSet;
@@ -278,10 +338,10 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
}
- for (size_t i = 0; i < allStates.size(); i++) {
- Element<std::string> state = Element<std::string>(allStates[i]);
+ for (auto stateIter = allStates.begin(); stateIter != allStates.end(); stateIter++) {
+ DOMElement* state = static_cast<DOMElement*>(*stateIter);
- if (InterpreterImpl::isMember(state, finals) && !HAS_ATTR(state, "id")) // id is not required for finals
+ if (DOMUtils::isMember(state, finals) && !HAS_ATTR(state, "id")) // id is not required for finals
continue;
// check for existance of id attribute - this not actually required!
@@ -299,13 +359,13 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
// check for valid transition with history states
if (LOCALNAME(state) == "history") {
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state, false);
+ std::list<DOMElement*> transitions = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "transition", state, false);
if (transitions.size() > 1) {
issues.push_back(InterpreterIssue("History pseudo-state with id '" + stateId + "' has multiple transitions", state, InterpreterIssue::USCXML_ISSUE_FATAL));
} else if (transitions.size() == 0) {
issues.push_back(InterpreterIssue("History pseudo-state with id '" + stateId + "' has no default transition", state, InterpreterIssue::USCXML_ISSUE_FATAL));
} else {
- Element<std::string> transition = Element<std::string>(transitions[0]);
+ DOMElement* transition = static_cast<DOMElement*>(transitions.front());
if (HAS_ATTR(transition, "cond")) {
issues.push_back(InterpreterIssue("Transition in history pseudo-state '" + stateId + "' must not have a condition", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
}
@@ -315,16 +375,16 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
if (!HAS_ATTR(transition, "target")) {
issues.push_back(InterpreterIssue("Transition in history pseudo-state '" + stateId + "' has no target", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
} else {
- NodeSet<std::string> targetStates = interpreter->getTargetStates(transition);
- for (size_t j = 0; j < targetStates.size(); j++) {
- Element<std::string> target = Element<std::string>(targetStates[j]);
+ std::list<DOMElement*> targetStates = getTargetStates(transition, _scxml);
+ for (auto tIter = targetStates.begin(); tIter != targetStates.end(); tIter++) {
+ DOMElement* target = *tIter;
if (HAS_ATTR(state, "type") && ATTR(state, "type") == "deep") {
- if (!InterpreterImpl::isDescendant(target, state.getParentNode())) {
- issues.push_back(InterpreterIssue("Transition in deep history pseudo-state '" + stateId + "' has invalid target state '" + ATTR(target, "id") + "'", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
+ if (!DOMUtils::isDescendant(target, state->getParentNode())) {
+ issues.push_back(InterpreterIssue("Transition in deep history pseudo-state '" + stateId + "' has illegal target state '" + ATTR(target, "id") + "'", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
}
} else {
- if (target.getParentNode() != state.getParentNode()) {
- issues.push_back(InterpreterIssue("Transition in shallow history pseudo-state '" + stateId + "' has invalid target state '" + ATTR(target, "id") + "'", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
+ if (target->getParentNode() != state->getParentNode()) {
+ issues.push_back(InterpreterIssue("Transition in shallow history pseudo-state '" + stateId + "' has illegal target state '" + ATTR(target, "id") + "'", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
}
}
}
@@ -333,7 +393,7 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
}
// check whether state is reachable
- if (!InterpreterImpl::isMember(state, reachable) && !InterpreterImpl::isInEmbeddedDocument(state)) {
+ if (!DOMUtils::isMember(state, reachable) && !isInEmbeddedDocument(state)) {
issues.push_back(InterpreterIssue("State with id '" + stateId + "' is unreachable", state, InterpreterIssue::USCXML_ISSUE_FATAL));
}
@@ -345,8 +405,8 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
seenStates[ATTR(state, "id")] = state;
}
- for (size_t i = 0; i < transitions.size(); i++) {
- Element<std::string> transition = Element<std::string>(transitions[i]);
+ for (auto tIter = transitions.begin(); tIter != transitions.end(); tIter++) {
+ DOMElement* transition = *tIter;
// check for valid target
if (HAS_ATTR(transition, "target")) {
@@ -365,16 +425,14 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
}
// check for redundancy of transition
- for (size_t i = 0; i < allStates.size(); i++) {
- Element<std::string> state = Element<std::string>(allStates[i]);
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state, false);
-
- transitions.to_document_order();
+ for (auto stateIter = allStates.begin(); stateIter != allStates.end(); stateIter++) {
+ DOMElement* state = *stateIter;
+ std::list<DOMElement*> transitions = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "transition", state, false);
- for (size_t j = 1; j < transitions.size(); j++) {
- Element<std::string> transition = Element<std::string>(transitions[j]);
- for (size_t k = 0; k < j; k++) {
- Element<std::string> earlierTransition = Element<std::string>(transitions[k]);
+ for (auto tIter = transitions.begin(); tIter != transitions.end(); tIter++) {
+ DOMElement* transition = *tIter;
+ for (auto t2Iter = transitions.begin(); t2Iter != tIter; t2Iter++) {
+ DOMElement* earlierTransition = *t2Iter;
// will the earlier transition always be enabled when the later is?
if (!HAS_ATTR(earlierTransition, "cond")) {
@@ -410,16 +468,18 @@ NEXT_TRANSITION:
// check for useless history elements
{
- for (size_t i = 0; i < histories.size(); i++) {
- Element<std::string> history = Element<std::string>(histories[i]);
- if (!history.getParentNode() || history.getParentNode().getNodeType() != Node_base::ELEMENT_NODE)
+ for (auto histIter = histories.begin(); histIter != histories.end(); histIter++) {
+ DOMElement* history = *histIter;
+
+ if (!history->getParentNode() || history->getParentNode()->getNodeType() != DOMNode::ELEMENT_NODE)
continue; // syntax check will have catched this
- Element<std::string> parent(history.getParentNode());
- if (InterpreterImpl::isAtomic(parent)) {
+
+ DOMElement* parent = static_cast<DOMElement*>(history->getParentNode());
+ if (isAtomic(parent)) {
issues.push_back(InterpreterIssue("Useless history '" + ATTR(history, "id") + "' in atomic state", history, InterpreterIssue::USCXML_ISSUE_INFO));
continue;
}
- std::list<std::set<Arabica::DOM::Element<std::string> > > configs = Complexity::getAllConfigurations(parent);
+ std::list<std::set<const DOMElement* > > configs = getAllConfigurations(parent);
if (configs.size() <= 1) {
issues.push_back(InterpreterIssue("Useless history '" + ATTR(history, "id") + "' in state with single legal configuration", history, InterpreterIssue::USCXML_ISSUE_INFO));
continue;
@@ -429,19 +489,24 @@ NEXT_TRANSITION:
// check for valid initial attribute
{
- NodeSet<std::string> withInitialAttr;
- withInitialAttr.push_back(allStates);
+ std::list<DOMElement*> withInitialAttr;
+ withInitialAttr.insert(withInitialAttr.end(), allStates.begin(), allStates.end());
withInitialAttr.push_back(_scxml);
- for (size_t i = 0; i < withInitialAttr.size(); i++) {
- Element<std::string> state = Element<std::string>(withInitialAttr[i]);
+ for (auto stateIter = withInitialAttr.begin(); stateIter != withInitialAttr.end(); stateIter++) {
+ DOMElement* state = *stateIter;
if (HAS_ATTR(state, "initial")) {
- NodeSet<std::string> childs;
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "state", state, true));
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "parallel", state, true));
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "final", state, true));
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", state, true));
+ std::list<DOMElement*> childs;
+ std::list<DOMElement*> tmp;
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "state", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "parallel", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "final", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "history", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
std::list<std::string> intials = tokenize(ATTR(state, "initial"));
for (std::list<std::string>::iterator initIter = intials.begin(); initIter != intials.end(); initIter++) {
@@ -450,7 +515,7 @@ NEXT_TRANSITION:
continue;
}
// value of the 'initial' attribute [..] must be descendants of the containing <state> or <parallel> element
- if (!InterpreterImpl::isMember(seenStates[*initIter], childs)) {
+ if (!DOMUtils::isMember(seenStates[*initIter], childs)) {
issues.push_back(InterpreterIssue("Initial attribute references non-child state '" + *initIter + "'", state, InterpreterIssue::USCXML_ISSUE_FATAL));
}
}
@@ -460,37 +525,37 @@ NEXT_TRANSITION:
// check for legal configuration of target sets
{
- std::map<Element<std::string>, std::string > targetIdSets;
- for (size_t i = 0; i < transitions.size(); i++) {
- Element<std::string> transition = Element<std::string>(transitions[i]);
+ std::map<DOMElement*, std::string > targetIdSets;
+ for (auto iter = transitions.begin(); iter != transitions.end(); iter++) {
+ DOMElement* transition = *iter;
if (HAS_ATTR(transition, "target")) {
targetIdSets[transition] = ATTR(transition, "target");
}
}
- for (size_t i = 0; i < initials.size(); i++) {
- Element<std::string> initial = Element<std::string>(initials[i]);
+ for (auto iter = initials.begin(); iter != initials.end(); iter++) {
+ DOMElement* initial = *iter;
if (HAS_ATTR(initial, "target")) {
targetIdSets[initial] = ATTR(initial, "target");
}
}
- for (size_t i = 0; i < allStates.size(); i++) {
- Element<std::string> state = Element<std::string>(allStates[i]);
+ for (auto iter = allStates.begin(); iter != allStates.end(); iter++) {
+ DOMElement* state = *iter;
if (HAS_ATTR(state, "initial")) {
targetIdSets[state] = ATTR(state, "initial");
}
}
- for (std::map<Element<std::string>, std::string >::iterator setIter = targetIdSets.begin();
+ for (auto setIter = targetIdSets.begin();
setIter != targetIdSets.end();
setIter++) {
- NodeSet<std::string> targets;
+ std::list<DOMElement*> targets;
std::list<std::string> targetIds = tokenize(setIter->second);
- for (std::list<std::string>::iterator tgtIter = targetIds.begin(); tgtIter != targetIds.end(); tgtIter++) {
+ for (auto tgtIter = targetIds.begin(); tgtIter != targetIds.end(); tgtIter++) {
if (seenStates.find(*tgtIter) == seenStates.end())
goto NEXT_SET;
targets.push_back(seenStates[*tgtIter]);
@@ -505,21 +570,21 @@ NEXT_SET:
// check for valid initial transition
{
- NodeSet<std::string> initTrans;
-// initTrans.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", histories, true));
+ std::list<DOMElement*> initTrans;
+
+ for (auto iter = initials.begin(); iter != initials.end(); iter++) {
+ DOMElement* initial = *iter;
- for (size_t i = 0; i < initials.size(); i++) {
- Element<std::string> initial = Element<std::string>(initials[i]);
- NodeSet<std::string> initTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", initial, true);
+ std::list<DOMElement*> initTransitions = DOMUtils::filterChildElements(XML_PREFIX(initial).str() + "transition", initial, true);
if (initTransitions.size() != 1) {
issues.push_back(InterpreterIssue("Initial element must define exactly one transition", initial, InterpreterIssue::USCXML_ISSUE_FATAL));
}
- initTrans.push_back(initTransitions);
+ initTrans.insert(initTrans.end(), initTransitions.begin(), initTransitions.end());
}
- for (size_t i = 0; i < initTrans.size(); i++) {
- Element<std::string> transition = Element<std::string>(initTrans[i]);
+ for (auto iter = initTrans.begin(); iter != initTrans.end(); iter++) {
+ DOMElement* transition = *iter;
/* In a conformant SCXML document, this transition must not contain 'cond' or 'event' attributes, and must specify a non-null 'target'
* whose value is a valid state specification consisting solely of descendants of the containing state
@@ -532,22 +597,29 @@ NEXT_SET:
issues.push_back(InterpreterIssue("Initial transition cannot be eventful", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
}
- if (!transition.getParentNode() || !transition.getParentNode().getParentNode() || transition.getParentNode().getParentNode().getNodeType() != Node_base::ELEMENT_NODE)
+ if (!transition->getParentNode() ||
+ !transition->getParentNode()->getParentNode() ||
+ transition->getParentNode()->getParentNode()->getNodeType() != DOMNode::ELEMENT_NODE)
continue; // syntax will catch this one
- Element<std::string> state(transition.getParentNode().getParentNode());
- if (!InterpreterImpl::isState(state))
+ DOMElement* state = static_cast<DOMElement*>(transition->getParentNode()->getParentNode());
+ if (!isState(state))
continue; // syntax will catch this one
- NodeSet<std::string> childs;
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "state", state, true));
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "parallel", state, true));
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "final", state, true));
- childs.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", state, true));
+ std::list<DOMElement*> childs;
+ std::list<DOMElement*> tmp;
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "state", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "parallel", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "final", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
+ tmp = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "history", state, true);
+ childs.insert(childs.end(), tmp.begin(), tmp.end());
std::list<std::string> intials = tokenize(ATTR(transition, "target"));
for (std::list<std::string>::iterator initIter = intials.begin(); initIter != intials.end(); initIter++) {
// the 'target' of a <transition> inside an <initial> or <history> element: all the states must be descendants of the containing <state> or <parallel> element
- if (!InterpreterImpl::isMember(seenStates[*initIter], childs)) {
+ if (!DOMUtils::isMember(seenStates[*initIter], childs)) {
issues.push_back(InterpreterIssue("Target of initial transition references non-child state '" + *initIter + "'", transition, InterpreterIssue::USCXML_ISSUE_FATAL));
}
}
@@ -557,8 +629,8 @@ NEXT_SET:
// check that all invokers exists
{
- for (size_t i = 0; i < invokes.size(); i++) {
- Element<std::string> invoke = Element<std::string>(invokes[i]);
+ for (auto iter = invokes.begin(); iter != invokes.end(); iter++) {
+ DOMElement* invoke = *iter;
if (HAS_ATTR(invoke, "type") && !_factory->hasInvoker(ATTR(invoke, "type"))) {
// unknown at factory - adhoc extension?
if (HAS_ATTR(invoke, "id") && interpreter->_invokers.find(ATTR(invoke, "id")) != interpreter->_invokers.end())
@@ -580,10 +652,10 @@ NEXT_SET:
// check that all io processors exists
{
- for (size_t i = 0; i < sends.size(); i++) {
- Element<std::string> send = Element<std::string>(sends[i]);
+ for (auto iter = sends.begin(); iter != sends.end(); iter++) {
+ DOMElement* send = *iter;
if (HAS_ATTR(send, "type") && !_factory->hasIOProcessor(ATTR(send, "type"))) {
- if (interpreter->_ioProcessors.find(ATTR(send, "type")) != interpreter->_ioProcessors.end())
+ if (interpreter->_ioProcs.find(ATTR(send, "type")) != interpreter->_ioProcs.end())
continue; // not an issue, available ad-hoc
issues.push_back(InterpreterIssue("Send to unknown IO Processor '" + ATTR(send, "type") + "'", send, InterpreterIssue::USCXML_ISSUE_FATAL));
@@ -594,23 +666,24 @@ NEXT_SET:
// check that all custom executable content is known
{
- NodeSet<std::string> allExecContentContainers;
- allExecContentContainers.push_back(onEntries);
- allExecContentContainers.push_back(onExits);
- allExecContentContainers.push_back(transitions);
- allExecContentContainers.push_back(finalizes);
-
- for (size_t i = 0; i < allExecContentContainers.size(); i++) {
- Element<std::string> block = Element<std::string>(allExecContentContainers[i]);
- NodeSet<std::string> execContents = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, block);
- for (size_t j = 0; j < execContents.size(); j++) {
- Element<std::string> execContent = Element<std::string>(execContents[j]);
+ std::list<DOMElement*> allExecContentContainers;
+ allExecContentContainers.insert(allExecContentContainers.end(), onEntries.begin(), onEntries.end());
+ allExecContentContainers.insert(allExecContentContainers.end(), onExits.begin(), onExits.end());
+ allExecContentContainers.insert(allExecContentContainers.end(), transitions.begin(), transitions.end());
+ allExecContentContainers.insert(allExecContentContainers.end(), finalizes.begin(), finalizes.end());
+
+ for (auto bIter = allExecContentContainers.begin(); bIter != allExecContentContainers.end(); bIter++) {
+ DOMElement* block = *bIter;
+ std::list<DOMNode*> execContents = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, block);
+ for (auto ecIter = execContents.begin(); ecIter != execContents.end(); ecIter++) {
+ DOMElement* execContent = static_cast<DOMElement*>(*ecIter);
// SCXML specific executable content, always available
- if (InterpreterImpl::isMember(execContent, allExecContents)) {
+ if (DOMUtils::isMember(execContent, allExecContents)) {
continue;
}
- if (!_factory->hasExecutableContent(execContent.getLocalName(), execContent.getNamespaceURI())) {
- issues.push_back(InterpreterIssue("Executable content element '" + execContent.getLocalName() + "' in namespace '" + execContent.getNamespaceURI() + "' unknown", execContent, InterpreterIssue::USCXML_ISSUE_FATAL));
+
+ if (!_factory->hasExecutableContent(X(execContent->getLocalName()), X(execContent->getNamespaceURI()))) {
+ issues.push_back(InterpreterIssue("Executable content element '" + (std::string)X(execContent->getLocalName()) + "' in namespace '" + (std::string)X(execContent->getNamespaceURI()) + "' unknown", execContent, InterpreterIssue::USCXML_ISSUE_FATAL));
continue;
}
}
@@ -619,8 +692,8 @@ NEXT_SET:
// check that all SCXML elements have valid parents and required attributes
{
- for (size_t i = 0; i < allElements.size(); i++) {
- Element<std::string> element = Element<std::string>(allElements[i]);
+ for (auto iter = allElements.begin(); iter != allElements.end(); iter++) {
+ DOMElement* element = *iter;
std::string localName = LOCALNAME(element);
if (reqAttr.find(localName) != reqAttr.end()) {
@@ -638,12 +711,12 @@ NEXT_SET:
if (localName == "scxml") // can be anywhere: <assign>, <content>, <other:embed>
continue;
- if (!element.getParentNode() || element.getParentNode().getNodeType() != Node_base::ELEMENT_NODE) {
+ if (!element->getParentNode() || element->getParentNode()->getNodeType() != DOMNode::ELEMENT_NODE) {
issues.push_back(InterpreterIssue("Parent of " + localName + " is no element", element, InterpreterIssue::USCXML_ISSUE_WARNING));
continue;
}
- Element<std::string> parent = Element<std::string>(element.getParentNode());
+ DOMElement* parent = static_cast<DOMElement*>(element->getParentNode());
std::string parentName = LOCALNAME(parent);
if (validParents[localName].find(parentName) == validParents[localName].end()) {
@@ -655,55 +728,55 @@ NEXT_SET:
// check attribute constraints
{
- for (size_t i = 0; i < initials.size(); i++) {
- Element<std::string> initial = Element<std::string>(initials[i]);
- if (initial.getParentNode() && initial.getParentNode().getNodeType() == Node_base::ELEMENT_NODE) {
- Element<std::string> state(initial.getParentNode());
+ for (auto iter = initials.begin(); iter != initials.end(); iter++) {
+ DOMElement* initial = *iter;
+ if (initial->getParentNode() && initial->getParentNode()->getNodeType() == DOMNode::ELEMENT_NODE) {
+ DOMElement* state = static_cast<DOMElement*>(initial->getParentNode());
if (HAS_ATTR(state, "initial")) {
issues.push_back(InterpreterIssue("State with initial attribute cannot have <initial> child ", state, InterpreterIssue::USCXML_ISSUE_WARNING));
}
- if (InterpreterImpl::isAtomic(state)) {
+ if (isAtomic(state)) {
issues.push_back(InterpreterIssue("Atomic state cannot have <initial> child ", state, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
}
- for (size_t i = 0; i < allStates.size(); i++) {
- Element<std::string> state = Element<std::string>(allStates[i]);
- if (InterpreterImpl::isAtomic(state) && HAS_ATTR(state, "initial")) {
+ for (auto iter = allStates.begin(); iter != allStates.end(); iter++) {
+ DOMElement* state = *iter;
+ if (isAtomic(state) && HAS_ATTR(state, "initial")) {
issues.push_back(InterpreterIssue("Atomic state cannot have initial attribute ", state, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < assigns.size(); i++) {
- Element<std::string> assign = Element<std::string>(assigns[i]);
- if (HAS_ATTR(assign, "expr") && assign.getChildNodes().getLength() > 0) {
+ for (auto iter = assigns.begin(); iter != assigns.end(); iter++) {
+ DOMElement* assign = *iter;
+ if (HAS_ATTR(assign, "expr") && assign->getChildNodes()->getLength() > 0) {
issues.push_back(InterpreterIssue("Assign element cannot have expr attribute and children", assign, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < contents.size(); i++) {
- Element<std::string> content = Element<std::string>(contents[i]);
- if (HAS_ATTR(content, "expr") && content.getChildNodes().getLength() > 0) {
+ for (auto iter = contents.begin(); iter != contents.end(); iter++) {
+ DOMElement* content = *iter;
+ if (HAS_ATTR(content, "expr") && content->getChildNodes()->getLength() > 0) {
issues.push_back(InterpreterIssue("Content element cannot have expr attribute and children", content, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < params.size(); i++) {
- Element<std::string> param = Element<std::string>(params[i]);
+ for (auto iter = params.begin(); iter != params.end(); iter++) {
+ DOMElement* param = *iter;
if (HAS_ATTR(param, "expr") && HAS_ATTR(param, "location")) {
issues.push_back(InterpreterIssue("Param element cannot have both expr and location attribute", param, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < scripts.size(); i++) {
- Element<std::string> script = Element<std::string>(scripts[i]);
- if (HAS_ATTR(script, "src") && script.getChildNodes().getLength() > 0) {
+ for (auto iter = scripts.begin(); iter != scripts.end(); iter++) {
+ DOMElement* script = *iter;
+ if (HAS_ATTR(script, "src") && script->getChildNodes()->getLength() > 0) {
issues.push_back(InterpreterIssue("Script element cannot have src attribute and children", script, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < sends.size(); i++) {
- Element<std::string> send = Element<std::string>(sends[i]);
+ for (auto iter = sends.begin(); iter != sends.end(); iter++) {
+ DOMElement* send = *iter;
if (HAS_ATTR(send, "event") && HAS_ATTR(send, "eventexpr")) {
issues.push_back(InterpreterIssue("Send element cannot have both event and eventexpr attribute", send, InterpreterIssue::USCXML_ISSUE_WARNING));
}
@@ -723,8 +796,8 @@ NEXT_SET:
issues.push_back(InterpreterIssue("Send element cannot have delay with target _internal", send, InterpreterIssue::USCXML_ISSUE_WARNING));
}
- NodeSet<std::string> contentChilds = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", send, false);
- NodeSet<std::string> paramChilds = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", send, false);
+ std::list<DOMElement*> contentChilds = DOMUtils::filterChildElements(XML_PREFIX(send).str() + "content", send, false);
+ std::list<DOMElement*> paramChilds = DOMUtils::filterChildElements(XML_PREFIX(send).str() + "param", send, false);
if (HAS_ATTR(send, "namelist") && contentChilds.size() > 0) {
issues.push_back(InterpreterIssue("Send element cannot have namelist attribute and content child", send, InterpreterIssue::USCXML_ISSUE_WARNING));
@@ -735,15 +808,15 @@ NEXT_SET:
}
}
- for (size_t i = 0; i < cancels.size(); i++) {
- Element<std::string> cancel = Element<std::string>(cancels[i]);
+ for (auto iter = cancels.begin(); iter != cancels.end(); iter++) {
+ DOMElement* cancel = *iter;
if (HAS_ATTR(cancel, "sendid") && HAS_ATTR(cancel, "sendidexpr")) {
issues.push_back(InterpreterIssue("Cancel element cannot have both sendid and eventexpr sendidexpr", cancel, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < invokes.size(); i++) {
- Element<std::string> invoke = Element<std::string>(invokes[i]);
+ for (auto iter = invokes.begin(); iter != invokes.end(); iter++) {
+ DOMElement* invoke = *iter;
if (HAS_ATTR(invoke, "type") && HAS_ATTR(invoke, "typeexpr")) {
issues.push_back(InterpreterIssue("Invoke element cannot have both type and typeexpr attribute", invoke, InterpreterIssue::USCXML_ISSUE_WARNING));
}
@@ -753,18 +826,18 @@ NEXT_SET:
if (HAS_ATTR(invoke, "id") && HAS_ATTR(invoke, "idlocation")) {
issues.push_back(InterpreterIssue("Invoke element cannot have both id and idlocation attribute", invoke, InterpreterIssue::USCXML_ISSUE_WARNING));
}
- if (HAS_ATTR(invoke, "namelist") && DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", invoke, false).size() > 0) {
+ if (HAS_ATTR(invoke, "namelist") && DOMUtils::filterChildElements(XML_PREFIX(invoke).str() + "param", invoke, false).size() > 0) {
issues.push_back(InterpreterIssue("Invoke element cannot have namelist attribute and param child", invoke, InterpreterIssue::USCXML_ISSUE_WARNING));
}
- if (HAS_ATTR(invoke, "src") && DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", invoke, false).size() > 0) {
+ if (HAS_ATTR(invoke, "src") && DOMUtils::filterChildElements(XML_PREFIX(invoke).str() + "content", invoke, false).size() > 0) {
issues.push_back(InterpreterIssue("Invoke element cannot have src attribute and content child", invoke, InterpreterIssue::USCXML_ISSUE_WARNING));
}
}
- for (size_t i = 0; i < doneDatas.size(); i++) {
- Element<std::string> donedata = Element<std::string>(doneDatas[i]);
- if (DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", donedata, false).size() > 0 &&
- DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", donedata, false).size() > 0) {
+ for (auto iter = doneDatas.begin(); iter != doneDatas.end(); iter++) {
+ DOMElement* donedata = *iter;
+ if (DOMUtils::filterChildElements(XML_PREFIX(donedata).str() + "content", donedata, false).size() > 0 &&
+ DOMUtils::filterChildElements(XML_PREFIX(donedata).str() + "param", donedata, false).size() > 0) {
issues.push_back(InterpreterIssue("Donedata element cannot have param child and content child", donedata, InterpreterIssue::USCXML_ISSUE_WARNING));
}
@@ -798,15 +871,15 @@ NEXT_SET:
// test all scripts for valid syntax
{
- for (size_t i = 0; i < scripts.size(); i++) {
- Element<std::string> script = Element<std::string>(scripts[i]);
+ for (auto iter = scripts.begin(); iter != scripts.end(); iter++) {
+ DOMElement* script = *iter;
- if (script.hasChildNodes()) {
+ if (script->hasChildNodes()) {
// search for the text node with the actual script
std::string scriptContent;
- for (Node<std::string> child = script.getFirstChild(); child; child = child.getNextSibling()) {
- if (child.getNodeType() == Node_base::TEXT_NODE || child.getNodeType() == Node_base::CDATA_SECTION_NODE)
- scriptContent += child.getNodeValue();
+ for (DOMNode* child = script->getFirstChild(); child; child = child->getNextSibling()) {
+ if (child->getNodeType() == DOMNode::TEXT_NODE || child->getNodeType() == DOMNode::CDATA_SECTION_NODE)
+ scriptContent += (std::string)X(child->getNodeValue());
}
if (!_dataModel.isValidSyntax(scriptContent)) {
@@ -818,13 +891,13 @@ NEXT_SET:
// test the various attributes with datamodel expressions for valid syntax
{
- NodeSet<std::string> withCondAttrs;
- withCondAttrs.push_back(transitions);
- withCondAttrs.push_back(ifs);
- withCondAttrs.push_back(elseIfs);
+ std::list<DOMElement*> withCondAttrs;
+ withCondAttrs.insert(withCondAttrs.end(), transitions.begin(), transitions.end());
+ withCondAttrs.insert(withCondAttrs.end(), ifs.begin(), ifs.end());
+ withCondAttrs.insert(withCondAttrs.end(), elseIfs.begin(), elseIfs.end());
- for (size_t i = 0; i < withCondAttrs.size(); i++) {
- Element<std::string> condAttr = Element<std::string>(withCondAttrs[i]);
+ for (auto iter = withCondAttrs.begin(); iter != withCondAttrs.end(); iter++) {
+ DOMElement* condAttr = *iter;
if (HAS_ATTR(condAttr, "cond")) {
if (!_dataModel.isValidSyntax(ATTR(condAttr, "cond"))) {
issues.push_back(InterpreterIssue("Syntax error in cond attribute", condAttr, InterpreterIssue::USCXML_ISSUE_WARNING));
@@ -835,17 +908,17 @@ NEXT_SET:
}
{
- NodeSet<std::string> withExprAttrs;
- withExprAttrs.push_back(logs);
- withExprAttrs.push_back(datas);
- withExprAttrs.push_back(assigns);
- withExprAttrs.push_back(contents);
- withExprAttrs.push_back(params);
-
- for (size_t i = 0; i < withExprAttrs.size(); i++) {
- Element<std::string> withExprAttr = Element<std::string>(withExprAttrs[i]);
+ std::list<DOMElement*> withExprAttrs;
+ withExprAttrs.insert(withExprAttrs.end(), logs.begin(), logs.end());
+ withExprAttrs.insert(withExprAttrs.end(), datas.begin(), datas.end());
+ withExprAttrs.insert(withExprAttrs.end(), assigns.begin(), assigns.end());
+ withExprAttrs.insert(withExprAttrs.end(), contents.begin(), contents.end());
+ withExprAttrs.insert(withExprAttrs.end(), params.begin(), params.end());
+
+ for (auto iter = withExprAttrs.begin(); iter != withExprAttrs.end(); iter++) {
+ DOMElement* withExprAttr = *iter;
if (HAS_ATTR(withExprAttr, "expr")) {
- if (InterpreterImpl::isMember(withExprAttr, datas) || InterpreterImpl::isMember(withExprAttr, assigns)) {
+ if (DOMUtils::isMember(withExprAttr, datas) || DOMUtils::isMember(withExprAttr, assigns)) {
if (!_dataModel.isValidSyntax("foo = " + ATTR(withExprAttr, "expr"))) { // TODO: this is ECMAScripty!
issues.push_back(InterpreterIssue("Syntax error in expr attribute", withExprAttr, InterpreterIssue::USCXML_ISSUE_WARNING));
continue;
@@ -861,8 +934,8 @@ NEXT_SET:
}
{
- for (size_t i = 0; i < foreachs.size(); i++) {
- Element<std::string> foreach = Element<std::string>(foreachs[i]);
+ for (auto iter = foreachs.begin(); iter != foreachs.end(); iter++) {
+ DOMElement* foreach = *iter;
if (HAS_ATTR(foreach, "array")) {
if (!_dataModel.isValidSyntax(ATTR(foreach, "array"))) {
issues.push_back(InterpreterIssue("Syntax error in array attribute", foreach, InterpreterIssue::USCXML_ISSUE_WARNING));
@@ -882,8 +955,8 @@ NEXT_SET:
}
{
- for (size_t i = 0; i < sends.size(); i++) {
- Element<std::string> send = Element<std::string>(sends[i]);
+ for (auto iter = sends.begin(); iter != sends.end(); iter++) {
+ DOMElement* send = *iter;
if (HAS_ATTR(send, "eventexpr")) {
if (!_dataModel.isValidSyntax(ATTR(send, "eventexpr"))) {
issues.push_back(InterpreterIssue("Syntax error in eventexpr attribute", send, InterpreterIssue::USCXML_ISSUE_WARNING));
@@ -914,8 +987,8 @@ NEXT_SET:
}
{
- for (size_t i = 0; i < invokes.size(); i++) {
- Element<std::string> invoke = Element<std::string>(invokes[i]);
+ for (auto iter = invokes.begin(); iter != invokes.end(); iter++) {
+ DOMElement* invoke = *iter;
if (HAS_ATTR(invoke, "typeexpr")) {
if (!_dataModel.isValidSyntax(ATTR(invoke, "typeexpr"))) {
issues.push_back(InterpreterIssue("Syntax error in typeexpr attribute", invoke, InterpreterIssue::USCXML_ISSUE_WARNING));
@@ -938,8 +1011,8 @@ NEXT_SET:
}
{
- for (size_t i = 0; i < cancels.size(); i++) {
- Element<std::string> cancel = Element<std::string>(cancels[i]);
+ for (auto iter = cancels.begin(); iter != cancels.end(); iter++) {
+ DOMElement* cancel = *iter;
if (HAS_ATTR(cancel, "sendidexpr")) {
if (!_dataModel.isValidSyntax(ATTR(cancel, "sendidexpr"))) {
issues.push_back(InterpreterIssue("Syntax error in sendidexpr attribute", cancel, InterpreterIssue::USCXML_ISSUE_WARNING));
@@ -955,5 +1028,29 @@ NEXT_SET:
return issues;
}
+std::ostream& operator<< (std::ostream& os, const InterpreterIssue& issue) {
+ switch (issue.severity) {
+ case InterpreterIssue::USCXML_ISSUE_FATAL:
+ os << "Issue (FATAL) ";
+ break;
+ case InterpreterIssue::USCXML_ISSUE_WARNING:
+ os << "Issue (WARNING) ";
+ break;
+ case InterpreterIssue::USCXML_ISSUE_INFO:
+ os << "Issue (INFO) ";
+ break;
+ default:
+ break;
+ }
+
+ if (issue.xPath.size() > 0) {
+ os << "at " << issue.xPath << ": ";
+ } else {
+ os << ": ";
+ }
+ os << issue.message;
+ return os;
+}
+
} \ No newline at end of file
diff --git a/src/uscxml/debug/InterpreterIssue.h b/src/uscxml/debug/InterpreterIssue.h
index 61b3b6a..f72a7a4 100644
--- a/src/uscxml/debug/InterpreterIssue.h
+++ b/src/uscxml/debug/InterpreterIssue.h
@@ -23,7 +23,7 @@
#include "uscxml/Common.h"
#include <list>
#include <iostream>
-#include <DOM/Node.hpp>
+#include <xercesc/dom/DOMNode.hpp>
namespace uscxml {
@@ -37,17 +37,17 @@ public:
USCXML_ISSUE_INFO
};
- InterpreterIssue(const std::string& msg, Arabica::DOM::Node<std::string> node, IssueSeverity severity, const std::string& specRef = "");
+ InterpreterIssue(const std::string& msg, xercesc::DOMNode* node, IssueSeverity severity, const std::string& specRef = "");
std::string xPath;
std::string message;
- Arabica::DOM::Node<std::string> node;
+ xercesc::DOMNode* node;
IssueSeverity severity;
std::string specRef;
private:
static std::list<InterpreterIssue> forInterpreter(InterpreterImpl* interpreter);
- friend class InterpreterImpl;
+ friend class Interpreter;
};
USCXML_API std::ostream& operator<< (std::ostream& os, const InterpreterIssue& issue);
diff --git a/src/uscxml/debug/SCXMLDotWriter.cpp b/src/uscxml/debug/SCXMLDotWriter.cpp
deleted file mode 100644
index 56de37a..0000000
--- a/src/uscxml/debug/SCXMLDotWriter.cpp
+++ /dev/null
@@ -1,888 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/Common.h"
-#include "uscxml/UUID.h"
-#include "SCXMLDotWriter.h"
-#include "../transform/FlatStateIdentifier.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <boost/algorithm/string.hpp> // replace_all
-#include <iomanip>
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-SCXMLDotWriter::SCXMLDotWriter() {
- _iteration = 0;
- _indentation = 0;
-}
-
-SCXMLDotWriter::SCXMLDotWriter(Interpreter interpreter,
- const std::list<SCXMLDotWriter::StateAnchor>& stateAnchors,
- const Element<std::string>& transition) {
- _interpreter = interpreter;
- _xmlNSPrefix = _interpreter.getNameSpaceInfo().xmlNSPrefix;
- _transition = transition;
- _anchors = stateAnchors;
-
- NodeList<std::string > scxmlElems = interpreter.getDocument().getElementsByTagName("scxml");
- _scxml = (Element<std::string>)scxmlElems.item(0);
- _isFlat = HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat"));
-
- if (_anchors.size() == 0) {
- StateAnchor anchor;
- anchor.element = _scxml;
- _anchors.push_back(anchor);
- }
-
- for (std::list<StateAnchor>::iterator anchIter = _anchors.begin(); anchIter != _anchors.end(); anchIter++) {
- if (!anchIter->element)
- anchIter->element = _scxml;
- if (anchIter->childDepth >= 0 && anchIter->transDepth == -1)
- anchIter->transDepth = anchIter->childDepth;
-
- _portType = anchIter->type;
- assembleGraph(anchIter->element, anchIter->childDepth, anchIter->transDepth + 1);
- }
-
- _iteration = 0;
- _indentation = 0;
-}
-
-SCXMLDotWriter::~SCXMLDotWriter() {
-
-}
-
-void SCXMLDotWriter::onStableConfiguration(Interpreter interpreter) {
- std::ostringstream fileSS;
- fileSS << interpreter.getName() << "." << std::setw(6) << std::setfill('0') << _iteration++ << ".dot";
- toDot(fileSS.str(), interpreter);
-}
-
-void SCXMLDotWriter::afterCompletion(Interpreter interpreter) {
- std::ostringstream fileSS;
- fileSS << interpreter.getName() << "." << std::setw(6) << std::setfill('0') << _iteration++ << ".dot";
- toDot(fileSS.str(), interpreter);
-}
-
-void SCXMLDotWriter::beforeMicroStep(Interpreter interpreter) {
-// std::ostringstream fileSS;
-// fileSS << interpreter.getName() << "." << std::setw(6) << std::setfill('0') << _iteration++ << ".dot";
-// toDot(fileSS.str(), interpreter);
-}
-
-void SCXMLDotWriter::beforeTakingTransition(Interpreter interpreter,
- const Element<std::string>& transition,
- bool moreComing) {
- std::ostringstream fileSS;
- fileSS << interpreter.getName() << "." << std::setw(6) << std::setfill('0') << _iteration++ << ".dot";
- toDot(fileSS.str(), interpreter, transition);
-}
-
-std::string SCXMLDotWriter::getPrefix() {
- std::string prefix = "";
- for (size_t i = 0; i < _indentation; i++)
- prefix += " ";
- return prefix;
-}
-
-void SCXMLDotWriter::writeTo(std::ostream& os) {
- os << "digraph {" << std::endl;
- os << " rankdir=LR;" << std::endl;
- os << " fontsize=10;" << std::endl;
- // outfile << " splines=ortho;" << std::endl;
- // outfile << " splines=false;" << std::endl;
- // outfile << " nodesep=1.0;" << std::endl;
-
- _indentation++;
- writeStateElement(os, _scxml);
-
- // write edges at end of file
- for(std::set<DotEdge>::iterator edgeIter = _edges.begin(); edgeIter != _edges.end(); edgeIter++) {
- if (edgeIter->from == edgeIter->to)
- continue;
- if (_histories.find(edgeIter->to) != _histories.end()) {
- if (_histories.find(edgeIter->to)->second.from == _histories.find(edgeIter->to)->second.to)
- continue;
- }
-
- os << getPrefix() << "\"" << portEscape(edgeIter->from) << "\"";
- if (edgeIter->fromPort.size() > 0) {
- os << std::string(":\"") + portEscape(edgeIter->fromPort) + "\":e";
- } else {
- os << ":__name";
- }
- os << " -> ";
-
- if (_histories.find(edgeIter->to) != _histories.end()) {
- os << getPrefix() << "\"" << portEscape(_histories.find(edgeIter->to)->second.to) << "\"";
- if (_histories.find(edgeIter->to)->second.toPort.size() > 0) {
- os << std::string(":\"") + portEscape(_histories.find(edgeIter->to)->second.toPort) + "\"";
- } else {
- os << ":__name";
- }
-
- } else {
- os << getPrefix() << "\"" << portEscape(edgeIter->to) << "\"";
- if (edgeIter->toPort.size() > 0) {
- os << std::string(":\"") + portEscape(edgeIter->toPort) + "\"";
- } else {
- os << ":__name";
- }
- }
-
- if (edgeIter->type == EDGE_INITAL) {
- os << ":nw [style=\"dashed\", color=\"black\"]";
- } else {
- os << " [color=\"black\"]";
- }
- os << std::endl;
-
- }
-
- _indentation--;
-
- os << "}" << std::endl;
-
-}
-
-void SCXMLDotWriter::toDot(const std::string& filename,
- Interpreter interpreter,
- const std::list<SCXMLDotWriter::StateAnchor>& stateAnchors,
- const Element<std::string>& transition) {
-
- std::ofstream outfile(filename.c_str());
- SCXMLDotWriter writer(interpreter, stateAnchors, transition);
- writer.writeTo(outfile);
-
-}
-
-/**
- * Walk the subset of the graph that is reachable and remember the nodes
- */
-void SCXMLDotWriter::assembleGraph(const Element<std::string>& state, int32_t childDepth, int32_t transDepth) {
- std::string nodeId = idForNode(state);
-
- // this node is neither included per child, nor per transition
- if (childDepth <= 0 && transDepth <= 0) {
- return;
- }
-
- // been here
- if (_graph.find(nodeId) != _graph.end())
- return;
-
- _graph[nodeId].node = state;
- _graph[nodeId].portType = _portType;
-
-
- if (childDepth == 0 && transDepth == 0) {
- _graph[nodeId].isBorder = true;
- }
-
-
- NodeSet<std::string> childElems = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, state);
- for (size_t i = 0; i < childElems.size(); i++) {
- Element<std::string> childElem(childElems[i]);
-
- // remember histories we passed
- if (iequals(TAGNAME(childElem), "history")) {
- _histories[ATTR(childElem, "id")].to = ATTR(state, "id");
- _histories[ATTR(childElem, "id")].toPort = ATTR(childElem, "id");
- }
-
- // follow transitions
- if (iequals(TAGNAME(childElem), "transition")) {
- _graph[nodeId].transitions.push_back(childElem);
- NodeSet<std::string> targetStates = _interpreter.getImpl()->getTargetStates(childElem);
- for (size_t j = 0; j < targetStates.size(); j++) {
- std::string remoteNodeId = idForNode(targetStates[j]);
- _graph[nodeId].targets.insert(std::make_pair(remoteNodeId, childElem));
-
- // recurse along the transition targets, no weight from child depth
- assembleGraph((Element<std::string>)targetStates[j], 0, transDepth - 1);
- }
- if (targetStates.size() == 0)
- _graph[nodeId].targets.insert(std::make_pair(nodeId, childElem));
-
- std::list<std::string> eventNames;
- if (HAS_ATTR(childElem, "event"))
- eventNames = tokenize(ATTR(childElem, "event"));
- if (eventNames.size() == 0)
- _graph[nodeId].events.insert(std::make_pair("", childElem));
- for (std::list<std::string>::iterator evIter = eventNames.begin(); evIter != eventNames.end(); evIter++) {
- _graph[nodeId].events.insert(std::make_pair(*evIter, childElem));
- }
- }
-
- // follow childs
- if (InterpreterImpl::isState(Element<std::string>(childElem))) {
- if (_interpreter.getImpl()->isInitial(Element<std::string>(childElem))) {
- // add to initial states if it is initial
- _graph[nodeId].initialchilds.insert(idForNode(childElem));
- } else if (_interpreter.getImpl()->isParallel(Element<std::string>(state))) {
- // add to initial states if we are parallel
- _graph[nodeId].initialchilds.insert(idForNode(childElem));
- }
- // in any case, it is a child state
- _graph[nodeId].childs.insert(idForNode(childElem));
-
- // recurse (do we really need to?)
- assembleGraph(childElem, childDepth - 1, transDepth);
- }
-
- }
-}
-
-
-/**
- * Walk the complete graph and draw reachable subset
- */
-void SCXMLDotWriter::writeStateElement(std::ostream& os, const Element<std::string>& stateElem) {
- std::string stateId = idForNode(stateElem);
-
- if (_knownIds.find(stateId) != _knownIds.end())
- return;
- _knownIds.insert(stateId);
-
- std::list<Node<std::string> > invisParents;
- bool isVisible = (_graph.find(stateId) != _graph.end());
-
- bool subgraph = InterpreterImpl::isCompound(stateElem) || InterpreterImpl::isParallel(stateElem);
- bool fatherIsParallel = (stateElem.getParentNode() &&
- stateElem.getParentNode().getNodeType() == Node_base::ELEMENT_NODE &&
- InterpreterImpl::isParallel(Element<std::string>(stateElem.getParentNode())));
-
- if (subgraph) {
- _indentation++;
- os << std::endl;
- os << getPrefix() << "subgraph \"cluster_" << portEscape(stateId) << "\" {" << std::endl;
- _indentation++;
- os << getPrefix() << "fontsize=14" << std::endl;
- os << getPrefix() << "label=<" << nameForNode(stateElem) << ">" << std::endl;
- // os << getPrefix() << "rank=\"same\"" << std::endl;
- os << getPrefix() << "labeljust=l" << std::endl;
-
- os << getPrefix() << (fatherIsParallel ? "style=dashed" : "style=solid") << std::endl;
-
- // os << getPrefix() << "ranksep=\"equally\"" << std::endl;
-
- }
-
- if (isVisible) {
- // this state is visible!
- const DotState& dotState = _graph.find(stateId)->second;
-
- // is this a subgraph?
-
- os << std::endl;
- os << getPrefix() << "\"" << portEscape(stateId) << "\" [" << std::endl;
- _indentation++;
-
- os << getPrefix() << "fontsize=10," << std::endl;
- os << getPrefix() << "shape=plaintext," << std::endl;
- os << getPrefix() << (fatherIsParallel ? "style=dashed," : "style=solid,") << std::endl;
-
- // is the current state in the basic configuration?
- if (InterpreterImpl::isMember(stateElem, _interpreter.getBasicConfiguration()))
- os << getPrefix() << "color=red, penwidth=3," << std::endl;
-
- // is the current state in the basic configuration?
- if (dotState.isBorder)
- os << getPrefix() << "color=blue," << std::endl;
-
- // is this state final?
- if (_interpreter.getImpl()->isFinal(stateElem)) {
- os << getPrefix() << "shape=doublecircle," << std::endl;
- os << getPrefix() << "color=black," << std::endl;
- os << getPrefix() << "penwidth=2," << std::endl;
- os << getPrefix() << "label=< <table cellborder=\"0\" border=\"0\"><tr><td balign=\"left\">" << nameForNode(stateElem) << "</td></tr></table>>" << std::endl;
- _indentation--;
- os << getPrefix() << "];" << std::endl;
-
- return;
- }
-
- // is the state initial?
- bool isInitial = _interpreter.getImpl()->isInitial(stateElem);
- // if (isInitial)
- // os << getPrefix() << "style=filled, fillcolor=lightgrey, " << std::endl;
-
- DotState::mmap_s_e_t::const_iterator destIterF, destIterB;
- //std::list<std::string> outPorts; // count unique keys
-
- int nrOutPorts = 0;
-
- switch (dotState.portType) {
- case PORT_TARGET: // outports are per target
- for(DotState::mmap_s_e_t::const_iterator it = dotState.targets.begin(), end = dotState.targets.end();
- it != end;
- it = dotState.targets.upper_bound(it->first)) {
- nrOutPorts++;
- }
- break;
- case PORT_EVENT: // outports are per event
- for(DotState::mmap_s_e_t::const_iterator it = dotState.events.begin(), end = dotState.events.end();
- it != end;
- it = dotState.events.upper_bound(it->first)) {
- nrOutPorts++;
- }
- break;
- case PORT_TRANSITION:
- nrOutPorts = dotState.transitions.size();
-// for (size_t i = 0; i < dotState.transitions.size(); i++) {
-// outPorts.push_back(idForNode(dotState.transitions[i]));
-// }
- break;
- }
-
- os << getPrefix() << "label = < " << std::endl;
-
- /*
- <table cellborder="1" border="0" cellspacing="0" cellpadding="2" style="rounded">
- <tr><td port="name" rowspan="4"><b>step</b></td></tr>
- <tr><td port="foo.error.port" align="right">foo.error.port</td></tr>
- <tr><td port="bar" align="right">bar</td></tr>
- <tr><td port="baz" align="right">baz</td></tr>
- </table>
- */
-
- std::string details = getDetailedLabel(stateElem);
- std::string stateLabel = nameForNode(stateElem);
- int stateLines = 0;
-
- std::string::size_type start = 0;
- while ((start = stateLabel.find("<br", start)) != std::string::npos) {
- ++stateLines;
- start += 3;
- }
-
- os << "<table " << (isInitial ? "bgcolor=\"orange\" " : "") << "valign=\"top\" align=\"left\" cellborder=\"1\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\" >" << std::endl;
- os << " <tr><td port=\"__name\" balign=\"left\" valign=\"top\" align=\"left\" rowspan=\"" << nrOutPorts + 1 << "\">" << stateLabel << "</td></tr>" << std::endl;
-
- switch (dotState.portType) {
- case PORT_TARGET: // outports are per target
- writePerTargetPorts(os, dotState, stateLines);
- break;
- case PORT_EVENT: // outports are per event
- writePerEventPorts(os, dotState, stateLines);
- break;
- case PORT_TRANSITION:
- writePerTransitionPorts(os, dotState, stateLines);
- break;
- }
-
-
- // write details of the state
- if (details.size() > 0) {
- os << " <tr><td balign=\"left\" colspan=\"" << (nrOutPorts == 0 ? 1 : 2) << "\">" << std::endl;
- os << details << std::endl;
- os << " </td></tr>" << std::endl;
- }
-
- // write history states
- NodeSet<std::string> histories = DOMUtils::filterChildElements(_xmlNSPrefix + "history", stateElem);
- for (size_t i = 0; i < histories.size(); i++) {
- os << " <tr><td port=\"" << portEscape(ATTR_CAST(histories[i], "id")) << "\" balign=\"left\" colspan=\"" << (nrOutPorts == 0 ? 1 : 2) << "\"><b>history: </b>" << ATTR_CAST(histories[i], "id") << "</td></tr>" << std::endl;
-
- }
-
- os << "</table>" << std::endl << getPrefix() << ">" << std::endl;
-
- _indentation--;
- os << getPrefix() << "];" << std::endl;
-
- for (std::set<std::string>::iterator initIter = dotState.initialchilds.begin(); initIter != dotState.initialchilds.end(); initIter++) {
- std::string destId = *initIter;
- DotEdge edge(stateId, destId);
- edge.type = EDGE_INITAL;
- if (_graph.find(destId) != _graph.end())
- _edges.insert(edge);
- }
-
- }
-
- // recurse into children and search others to draw
- NodeSet<std::string> childElems = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, stateElem);
- for (size_t i = 0; i < childElems.size(); i++) {
- Element<std::string> childElem(childElems[i]);
- if (InterpreterImpl::isState(Element<std::string>(childElem))) {
- writeStateElement(os, childElem);
- }
- }
-
- if (subgraph) {
- _indentation--;
- os << getPrefix() << "} #" << stateId << std::endl;
- _indentation--;
- }
-}
-
-void SCXMLDotWriter::writePerTransitionPorts(std::ostream& os, const DotState& dotState, int stateLines) {
- // TODO: Not implemented
-}
-
-void SCXMLDotWriter::writePerEventPorts(std::ostream& os, const DotState& dotState, int stateLines) {
- // std::multimap<std::string, Arabica::DOM::Element<std::string> > events; // key is event name, value is transitions that react
-
- std::string stateId = idForNode(dotState.node);
- DotState::mmap_s_e_t::const_iterator destIterF, destIterB;
-
- for(DotState::mmap_s_e_t::const_iterator it = dotState.events.begin(), end = dotState.events.end();
- it != end;
- it = dotState.events.upper_bound(it->first)) {
- os << " <tr><td port=\"" << portEscape(it->first) << "\" align=\"right\">" << it->first << "</td></tr>" << std::endl;
- }
-
-}
-
-std::string SCXMLDotWriter::htmlLabelForId(const std::string& stateId, int minRows) {
- FlatStateIdentifier flatId(stateId);
-
- std::list<std::string>::const_iterator listIter;
- std::stringstream labelSS;
- std::string seperator;
-
- labelSS << "<b>active: </b>";
- labelSS << "{";
- for (listIter = flatId.getActive().begin(); listIter != flatId.getActive().end(); listIter++) {
- labelSS << seperator << *listIter;
- seperator = ", ";
- }
- labelSS << "}";
-
- if (flatId.getVisited().size() > 0) {
- minRows--;
-
- labelSS << "<br /><b>init: </b>";
-
- labelSS << "{";
- seperator = "";
- for (listIter = flatId.getVisited().begin(); listIter != flatId.getVisited().end(); listIter++) {
- labelSS << seperator << *listIter;
- seperator = ", ";
- }
- labelSS << "}";
- }
-
- if (flatId.getHistory().size() > 0) {
- minRows--;
-
- seperator = "";
- std::string histSeperator = "<br /> ";
-
- labelSS << "<br /><b>history: </b>";
-
- std::map<std::string, std::list<std::string> >::const_iterator histIter;
- for (histIter = flatId.getHistory().begin(); histIter != flatId.getHistory().end(); histIter++) {
- labelSS << histSeperator << histIter->first << ": {";
-
- for (listIter = histIter->second.begin(); listIter != histIter->second.end(); listIter++) {
- labelSS << seperator << *listIter;
- seperator = ", ";
- }
- labelSS << "}";
- seperator = "";
- }
- }
- return labelSS.str();
-}
-
-
-void SCXMLDotWriter::writePerTargetPorts(std::ostream& os, const DotState& dotState, int stateLines) {
- // std::multimap<std::string, Arabica::DOM::Element<std::string> > targets; // key is remote node, transition is element
-
- int nrOutports = 0;
- std::string stateId = idForNode(dotState.node);
-
- typedef DotState::mmap_s_e_t iter_t;
-
- // we need to count outports first for vertical padding
- for(iter_t::const_iterator targetIter = dotState.targets.begin(), end = dotState.targets.end();
- targetIter != end;
- targetIter = dotState.targets.upper_bound(targetIter->first)) {
- nrOutports++;
- }
-
- for(iter_t::const_iterator targetIter = dotState.targets.begin(), end = dotState.targets.end();
- targetIter != end;
- targetIter = dotState.targets.upper_bound(targetIter->first)) {
-
- // gather all events that activate the transition
- std::string targetId = targetIter->first;
-
- std::set<std::string> eventNames;
-
- DotEdge edge(stateId, targetId);
- edge.fromPort = targetId;
-
- std::pair <iter_t::const_iterator, iter_t::const_iterator> targetKeyRange = dotState.targets.equal_range(targetId);
- for (iter_t::const_iterator transIter = targetKeyRange.first; transIter != targetKeyRange.second; ++transIter) {
- const Element<std::string>& transElem = transIter->second;
-
- std::list<std::string> events = tokenize(ATTR(transElem, "event"));
- eventNames.insert(events.begin(), events.end());
-
- if (events.size() == 0) {
- // spontaneous transition
- eventNames.insert("&#35;");
- edge.type = EDGE_SPONTANEOUS;
- }
- }
-
- if (_graph.find(targetId) != _graph.end())
- _edges.insert(edge);
-
- std::stringstream outPortSS;
- outPortSS << (_isFlat ? htmlLabelForId(targetId) : "<b>" + targetId + "</b>" );
-
- if (_isFlat) {
- outPortSS << "<br /><b>events: </b>{";
- } else {
- outPortSS << "<br />{";
- }
-
- std::string seperator;
- for (std::set<std::string>::const_iterator eventIter = eventNames.begin(); eventIter != eventNames.end(); eventIter++) {
- outPortSS << seperator << *eventIter << std::endl;
- seperator = ", ";
- }
- outPortSS << "}";
-
- if (nrOutports == 1) {
- int missing = stateLines - nrOutports;
- while (_isFlat && missing-- >= 1) {
- outPortSS << "<br /> ";
- }
- }
-
- os << " <tr><td port=\"" << portEscape(targetId) << "\" balign=\"left\" align=\"left\">" << outPortSS.str() << "</td></tr>" << std::endl;
-
- }
-}
-
-std::string SCXMLDotWriter::getDetailedLabel(const Element<std::string>& elem, int indentation) {
-
- /*
- <table>
- <tr>
- <td colspan="2">onEntry</td>
- </tr>
- <tr>
- <td>Details</td>
- <td bgcolor="#eee">
- Nested Content
- </td>
- </tr>
- </table>
- */
-
- std::list<struct ElemDetails> content;
-
- NodeList<std::string > childElems = elem.getChildNodes();
- for (size_t i = 0; i < childElems.getLength(); i++) {
- if (childElems.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Element<std::string> elem = Element<std::string>(childElems.item(i));
-
- if (InterpreterImpl::isState(elem) ||
- iequals(TAGNAME(elem), "transition") ||
- iequals(TAGNAME(elem), "initial") ||
- false)
- continue;
-
- struct ElemDetails details;
- details.name = "<b>" + TAGNAME(elem) + ":</b>";
-
- if (iequals(TAGNAME(elem), "history")) {
- continue;
- }
-
- // provide details for special elements here
-
- // param ---------
- if (iequals(TAGNAME(elem), "param")) {
- if (HAS_ATTR(elem, "name"))
- details.name += " " + ATTR(elem, "name") + " = ";
- if (HAS_ATTR(elem, "expr"))
- details.name += ATTR(elem, "expr");
- if (HAS_ATTR(elem, "location"))
- details.name += ATTR(elem, "location");
- }
-
- // data ---------
- if (iequals(TAGNAME(elem), "data")) {
- if (HAS_ATTR(elem, "id"))
- details.name += " " + ATTR(elem, "id");
- if (HAS_ATTR(elem, "src"))
- details.name += ATTR(elem, "src");
- if (HAS_ATTR(elem, "expr"))
- details.name += " = " + ATTR(elem, "expr");
- NodeList<std::string > grandChildElems = elem.getChildNodes();
- for (size_t j = 0; j < grandChildElems.getLength(); j++) {
- if (grandChildElems.item(j).getNodeType() == Node_base::TEXT_NODE) {
- details.name += dotEscape(grandChildElems.item(j).getNodeValue());
- }
- }
- }
-
- // invoke ---------
- if (iequals(TAGNAME(elem), "invoke")) {
- if (HAS_ATTR(elem, "type"))
- details.name += "<br />type = " + ATTR(elem, "type");
- if (HAS_ATTR(elem, "typeexpr"))
- details.name += "<br />type = " + ATTR(elem, "typeexpr");
- if (HAS_ATTR(elem, "src"))
- details.name += "<br />src = " + ATTR(elem, "src");
- if (HAS_ATTR(elem, "srcexpr"))
- details.name += "<br />src = " + ATTR(elem, "srcexpr");
- if (HAS_ATTR(elem, "id"))
- details.name += "<br />id = " + ATTR(elem, "id");
- if (HAS_ATTR(elem, "idlocation"))
- details.name += "<br />id = " + ATTR(elem, "idlocation");
- }
-
- // send ---------
- if (iequals(TAGNAME(elem), "raise")) {
- if (HAS_ATTR(elem, "event "))
- details.name += "<br />event = " + ATTR(elem, "event");
- }
-
- // send ---------
- if (iequals(TAGNAME(elem), "send")) {
- if (HAS_ATTR(elem, "id"))
- details.name += "<br />id = " + ATTR(elem, "id");
- if (HAS_ATTR(elem, "type"))
- details.name += "<br />type = " + ATTR(elem, "type");
- if (HAS_ATTR(elem, "typeexpr"))
- details.name += "<br />type = " + ATTR(elem, "typeexpr");
- if (HAS_ATTR(elem, "event"))
- details.name += "<br />event = " + ATTR(elem, "event");
- if (HAS_ATTR(elem, "eventexpr"))
- details.name += "<br />event = " + ATTR(elem, "eventexpr");
- if (HAS_ATTR(elem, "target"))
- details.name += "<br />target = " + ATTR(elem, "target");
- if (HAS_ATTR(elem, "targetexpr"))
- details.name += "<br />target = " + ATTR(elem, "targetexpr");
- if (HAS_ATTR(elem, "delay"))
- details.name += "<br />delay = " + ATTR(elem, "delay");
- if (HAS_ATTR(elem, "delayexpr"))
- details.name += "<br />delay = " + ATTR(elem, "delayexpr");
- }
-
- // cancel ---------
- if (iequals(TAGNAME(elem), "cancel")) {
- if (HAS_ATTR(elem, "sendid"))
- details.name += " " + ATTR(elem, "sendid");
- }
-
- // script ---------
- if (iequals(TAGNAME(elem), "script")) {
- details.name += " ";
- if (HAS_ATTR(elem, "src"))
- details.name += ATTR(elem, "src");
- NodeList<std::string > grandChildElems = childElems.item(i).getChildNodes();
- for (size_t j = 0; j < grandChildElems.getLength(); j++) {
- if (grandChildElems.item(j).getNodeType() == Node_base::TEXT_NODE) {
- details.name += dotEscape(grandChildElems.item(j).getNodeValue());
- }
- }
- }
-
- // if ---------
- if (iequals(TAGNAME(elem), "if")) {
- if (HAS_ATTR(elem, "cond"))
- details.name += " cond = " + dotEscape(ATTR(elem, "cond"));
- }
-
- // elseif ---------
- if (iequals(TAGNAME(elem), "elseif")) {
- if (HAS_ATTR(elem, "cond"))
- details.name += " cond = " + dotEscape(ATTR(elem, "cond"));
- }
-
- // log ---------
- if (iequals(TAGNAME(elem), "log")) {
- details.name += " ";
- if (HAS_ATTR(elem, "label"))
- details.name += ATTR(elem, "label") + " = ";
- if (HAS_ATTR(elem, "expr"))
- details.name += ATTR(elem, "expr");
- }
-
- // foreach ---------
- if (iequals(TAGNAME(elem), "foreach")) {
- if (HAS_ATTR(elem, "item"))
- details.name += "<br />&nbsp;&nbsp;item = " + ATTR(elem, "item");
- if (HAS_ATTR(elem, "array"))
- details.name += "<br />&nbsp;&nbsp;array = " + ATTR(elem, "array");
- if (HAS_ATTR(elem, "index"))
- details.name += "<br />&nbsp;&nbsp;index = " + ATTR(elem, "index");
- }
-
- // recurse
- details.content = getDetailedLabel((Element<std::string>)childElems.item(i), indentation + 1);
- content.push_back(details);
- }
-
- std::stringstream ssContent;
-
- if (content.size() > 0) {
- ssContent << "<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\" bgcolor=\"#" << colorForIndent(indentation + 1) << "\">";
-
- std::list<struct ElemDetails>::iterator contentIter = content.begin();
- while(contentIter != content.end()) {
- ssContent << "<tr>";
-// ssContent << "<td align=\"left\" colspan=\"2\">" << contentIter->name << "</td>";
- ssContent << "<td balign=\"left\" align=\"left\">" << contentIter->name << "</td>";
- ssContent << "</tr>";
-
- if (contentIter->content.size() > 0) {
- ssContent << "<tr>";
-// ssContent << "<td>" << contentIter->details << "</td>";
- ssContent << "<td bgcolor=\"#" << colorForIndent(indentation + 1) << "\">" << contentIter->content << "</td>";
- ssContent << "</tr>";
- }
- contentIter++;
-
- }
- ssContent << "</table>";
- }
- return ssContent.str();
-}
-
-std::string SCXMLDotWriter::portEscape(const std::string& text) {
- std::string escaped(text);
- boost::replace_all(escaped, ".", "-");
- boost::replace_all(escaped, "{", "-");
- boost::replace_all(escaped, "}", "-");
- boost::replace_all(escaped, ":", "-");
- return escaped;
-}
-
-std::string SCXMLDotWriter::dotEscape(const std::string& text) {
- std::string escaped(text);
- boost::replace_all(escaped, " ", "&nbsp;");
- boost::replace_all(escaped, "\t", "&nbsp;&nbsp;&nbsp;");
- boost::replace_all(escaped, "<", "&lt;");
- boost::replace_all(escaped, ">", "&gt;");
- boost::replace_all(escaped, "\"", "&quot;");
- boost::replace_all(escaped, "\n", "<br />");
-
- return escaped;
-}
-
-std::string SCXMLDotWriter::colorForIndent(int indent) {
- int color = 255 - (16 * indent);
- std::stringstream ss;
- ss << std::hex << color;
- ss << std::hex << color;
- ss << std::hex << color;
- return ss.str();
-}
-
-std::string SCXMLDotWriter::nameForNode(const Node<std::string>& node) {
- std::string elemName;
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {
- Element<std::string> elem = (Element<std::string>)node;
-
- if (InterpreterImpl::isFinal(elem) && _isFlat) {
- // ignore visited and history with final elements
- FlatStateIdentifier flatId(elem.getAttribute("id"));
- return "<b>" + flatId.getActive().front() + "</b>";
- }
-
- if (elem.hasAttribute("id") && _isFlat) {
- elemName = htmlLabelForId(elem.getAttribute("id"));
- if (elemName.size() > 0)
- return elemName;
- } else if (elem.getTagName() == "scxml") {
- if (elem.hasAttribute("name") && !UUID::isUUID(elem.getAttribute("name"))) {
- elemName += elem.getAttribute("name");
- } else if (elem.hasAttribute("id") && !UUID::isUUID(elem.getAttribute("id"))) {
- elemName += elem.getAttribute("id");
- }
- } else if (InterpreterImpl::isCompound(elem)) {
- elemName = "<i>Compound: </i>" + elem.getAttribute("id");
- } else if (InterpreterImpl::isParallel(elem)) {
- elemName = "<i>Parallel: </i>" + elem.getAttribute("id");
- } else if (elem.hasAttribute("id")) {
- elemName += elem.getAttribute("id");
- }
- }
-
- if (elemName.size() == 0)
- elemName = boost::lexical_cast<std::string>(node.getLocalName());
-
- return "<b>" + elemName + "</b>";
-
-}
-
-std::string SCXMLDotWriter::idForNode(const Node<std::string>& node) {
- std::string elemId;
-
- // try to get the id as the name or id attribute
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {
- Element<std::string> elem = (Element<std::string>)node;
-
-// if (InterpreterImpl::isFinal(elem) && _isFlat) {
-// // ignore visited and history with final elements
-// FlatStateIdentifier flatId(elem.getAttribute("id"));
-//
-// std::stringstream activeSS;
-// activeSS << "active-";
-// for (std::list<std::string>::const_iterator activeIter = flatId.getActive().begin(); activeIter != flatId.getActive().end(); activeIter++) {
-// activeSS << *activeIter << "-";
-// }
-// return activeSS.str();
-// }
-
- if (elem.hasAttribute("name")) {
- elemId = elem.getAttribute("name");
- } else if (elem.hasAttribute("id")) {
- elemId = elem.getAttribute("id");
- }
- }
-
- // no luck, create id from position in tree
- if (elemId.size() == 0) {
- Node<std::string> tmpParent = node;
- Node<std::string> tmpIndex;
- do {
- if (tmpParent.getNodeType() != Node_base::ELEMENT_NODE)
- continue;
-
- tmpIndex = tmpParent;
- int index = 0;
-
- while((tmpIndex = tmpIndex.getPreviousSibling()))
- index++;
-
- std::stringstream ssElemId;
- ssElemId << TAGNAME_CAST(tmpParent) << index << ".";
- elemId = ssElemId.str() + elemId;
- } while ((tmpParent = tmpParent.getParentNode()));
-// elemId = ssElemId.str();
- }
- return elemId;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/debug/SCXMLDotWriter.h b/src/uscxml/debug/SCXMLDotWriter.h
deleted file mode 100644
index f6c8b3d..0000000
--- a/src/uscxml/debug/SCXMLDotWriter.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SCXMLDOTWRITER_H_AOP0OHXX
-#define SCXMLDOTWRITER_H_AOP0OHXX
-
-#include "uscxml/Interpreter.h"
-#include <DOM/Document.hpp>
-#include <XPath/XPath.hpp>
-#include <fstream>
-#include <set>
-
-#undef max
-#include <limits>
-
-namespace uscxml {
-
-class Interpreter;
-
-
-
-/**
- * This writer, added as a monitor will output .dot files.
- *
- * # create a set of pdfs form the dot files
- * $ dot -Tpdf -O *.dot
- * or
- * $ find . -name "*.dot" -exec dot -Tpdf -O {} \;
- *
- * # create a movie from the pdfs
- * $ dot -Tgif -O *.dot
- * or
- * $ find . -name "*.dot" -exec dot -Tgif -O {} \;
- *
- * $ ffmpeg -r 3 -i <NAME>.%06d.dot.gif -r 25 movie.mpg
- * $ convert -delay 20 *.gif animated.gif
- *
- * # unflatten can be used to create more compact graphs
- * find . -name "*.dot" -exec unflatten -f -l2 -o {}.flat.dot {} \;
- */
-class USCXML_API SCXMLDotWriter : public InterpreterMonitor {
-public:
-
- enum PortType {
- PORT_TARGET,
- PORT_EVENT,
- PORT_TRANSITION
- };
-
- struct StateAnchor {
- StateAnchor() : childDepth(std::numeric_limits<int32_t>::max()), transDepth(std::numeric_limits<int32_t>::max()), type(PORT_TARGET) {}
- Arabica::DOM::Element<std::string> element;
- int32_t childDepth;
- int32_t transDepth;
-
- PortType type;
-
- operator bool() const {
- return childDepth != -1 || transDepth != -1 || element;
- }
- };
-
- struct ElemDetails {
- std::string name;
- std::string details;
- std::string content;
- };
-
- struct DotState {
- DotState() : isBorder(false), portType(PORT_TARGET) {}
- Arabica::DOM::Element<std::string> node;
- Arabica::XPath::NodeSet<std::string> transitions;
- std::multimap<std::string, Arabica::DOM::Element<std::string> > targets; // key is remote node, transition is element
- std::multimap<std::string, Arabica::DOM::Element<std::string> > events; // key is event name, value is transitions that react
-
- bool isBorder;
- PortType portType;
-
- std::set<std::string> childs;
- std::set<std::string> initialchilds;
-
- typedef std::multimap<std::string, Arabica::DOM::Element<std::string> > mmap_s_e_t;
- };
-
- enum EdgeType {
- EDGE_INITAL,
- EDGE_TRANSIION,
- EDGE_SPONTANEOUS
- };
-
- struct DotEdge {
- DotEdge() : type(EDGE_TRANSIION) {}
- DotEdge(const std::string& from, const std::string& to) : type(EDGE_TRANSIION), from(from), to(to) {
- }
-
- bool operator< (const DotEdge& other) const {
- return from + fromPort + to + toPort > other.from + other.fromPort + other.to + other.toPort;
- }
-
- EdgeType type;
- std::string from;
- std::string fromCompass;
- std::string fromPort;
- std::string to;
- std::string toPort;
- std::string toCompass;
- };
-
- SCXMLDotWriter();
- ~SCXMLDotWriter();
-
- virtual void onStableConfiguration(Interpreter interpreter);
- virtual void afterCompletion(Interpreter interpreter);
- virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
- virtual void beforeMicroStep(Interpreter interpreter);
-
- static std::string htmlLabelForId(const std::string& stateId, int minRows = 0);
-
- static void toDot(const std::string& filename,
- Interpreter interpreter,
- const Arabica::DOM::Element<std::string>& transition = Arabica::DOM::Element<std::string>()) {
- std::list<SCXMLDotWriter::StateAnchor> emptyAnchors = std::list<SCXMLDotWriter::StateAnchor>();
- toDot(filename, interpreter, emptyAnchors, transition);
- }
-
-
- static void toDot(const std::string& filename,
- Interpreter interpreter,
- const std::list<SCXMLDotWriter::StateAnchor>& stateAnchors,
- const Arabica::DOM::Element<std::string>& transition = Arabica::DOM::Element<std::string>());
-
- void writeTo(std::ostream& os);
-
- std::string getDetailedLabel(const Arabica::DOM::Element<std::string>& elem, int indentation = 0);
- std::string colorForIndent(int indent);
-
- std::string idForNode(const Arabica::DOM::Node<std::string>& node);
- std::string nameForNode(const Arabica::DOM::Node<std::string>& node);
- std::string getPrefix();
-
- static std::string dotEscape(const std::string& text);
- static std::string portEscape(const std::string& text);
-
-protected:
-
- SCXMLDotWriter(Interpreter interpreter,
- const std::list<SCXMLDotWriter::StateAnchor>& stateAnchors,
- const Arabica::DOM::Element<std::string>& transition);
-
- void assembleGraph(const Arabica::DOM::Element<std::string>& start,
- int32_t childDepth = std::numeric_limits<int32_t>::max(),
- int32_t transDepth = std::numeric_limits<int32_t>::max());
- void writeStateElement(std::ostream& os, const Arabica::DOM::Element<std::string>& state);
-
- void writePerTransitionPorts(std::ostream& os, const DotState& dotState, int stateLines = 0);
- void writePerEventPorts(std::ostream& os, const DotState& dotState, int stateLines = 0);
- void writePerTargetPorts(std::ostream& os, const DotState& dotState, int stateLines = 0);
-
- void writeUnknownNode(std::ostream& os, const std::string& targetId);
-
- int _iteration;
- std::set<std::string> _knownIds;
- std::set<std::string> _unknownNodes;
- int _indentation;
-
- std::map<std::string, DotState> _graph;
- std::set<DotEdge> _edges;
-
- // these are only set in ephemeral instances per monitor call
- Arabica::DOM::Element<std::string> _transition;
- Arabica::DOM::Element<std::string> _scxml;
- Interpreter _interpreter;
- bool _isFlat;
-
- std::string _xmlNSPrefix;
- std::list<StateAnchor> _anchors;
- std::map<std::string, DotEdge> _histories;
-
- PortType _portType;
-
-};
-
-}
-
-#endif /* end of include guard: SCXMLDOTWRITER_H_AOP0OHXX */
diff --git a/src/uscxml/dom/DOMUtils.cpp b/src/uscxml/dom/DOMUtils.cpp
deleted file mode 100644
index 137d0ef..0000000
--- a/src/uscxml/dom/DOMUtils.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/Common.h"
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/Convenience.h"
-
-#include <glog/logging.h>
-#include <boost/algorithm/string.hpp>
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-bool DOMUtils::attributeIsTrue(const::std::string& value) {
- return stringIsTrue(value.c_str());
-}
-
-std::string DOMUtils::idForNode(const Arabica::DOM::Node<std::string>& node) {
- std::string nodeId;
- std::string seperator;
- Arabica::DOM::Node<std::string> curr = node;
- while(curr) {
- switch (curr.getNodeType()) {
- case Arabica::DOM::Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string> elem = Arabica::DOM::Element<std::string>(curr);
- if (HAS_ATTR(elem, "id") && !UUID::isUUID(ATTR(elem, "id"))) {
- std::string elementId = ATTR(elem, "id");
- boost::replace_all(elementId, ".", "_");
- boost::replace_all(elementId, ",", "_");
- nodeId.insert(0, elementId + seperator);
- seperator = "_";
- return nodeId;
- } else {
- Arabica::DOM::Node<std::string> sibling = curr.getPreviousSibling();
- int index = 0;
- while(sibling) {
- if (sibling.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) {
- if (iequals(TAGNAME_CAST(sibling), TAGNAME(elem))) {
- index++;
- }
- }
- sibling = sibling.getPreviousSibling();
- }
- nodeId.insert(0, TAGNAME(elem) + toStr(index) + seperator);
- seperator = "_";
- }
- break;
- }
- case Arabica::DOM::Node_base::DOCUMENT_NODE:
- return nodeId;
- }
-
- curr = curr.getParentNode();
- }
- return nodeId;
-}
-
-std::string DOMUtils::xPathForNode(const Arabica::DOM::Node<std::string>& node, const std::string& ns) {
- std::string xPath;
- std::string nsPrefix;
-
- if (ns.size() > 0) {
- nsPrefix = ns + ":";
- }
-
- if (!node || node.getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE)
- return xPath;
-
- Arabica::DOM::Node<std::string> curr = node;
- while(curr) {
- switch (curr.getNodeType()) {
- case Arabica::DOM::Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string> elem = Arabica::DOM::Element<std::string>(curr);
- if (HAS_ATTR(elem, "id") && !UUID::isUUID(ATTR(elem, "id"))) {
- // we assume ids to be unique and return immediately
- if (ns == "*") {
- xPath.insert(0, "//*[local-name() = \"" + TAGNAME(elem) + "\"][@id=\"" + ATTR(elem, "id") + "\"]");
- } else {
- xPath.insert(0, "//" + nsPrefix + TAGNAME(elem) + "[@id=\"" + ATTR(elem, "id") + "\"]");
- }
- return xPath;
- } else {
- // check previous siblings to count our index
- Arabica::DOM::Node<std::string> sibling = curr.getPreviousSibling();
- int index = 1; // xpath indices start at 1
- while(sibling) {
- if (sibling.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) {
- if (iequals(TAGNAME_CAST(sibling), TAGNAME(elem))) {
- index++;
- }
- }
- sibling = sibling.getPreviousSibling();
- }
- if (ns == "*") {
- xPath.insert(0, "/*[local-name() = \"" + TAGNAME(elem) + "\"][" + toStr(index) + "]");
- } else {
- xPath.insert(0, "/" + nsPrefix + TAGNAME(elem) + "[" + toStr(index) + "]");
- }
- }
- break;
- }
- case Arabica::DOM::Node_base::DOCUMENT_NODE:
- return xPath;
- default:
- LOG(ERROR) << "Only nodes of type element supported for now";
- return "";
- break;
- }
- curr = curr.getParentNode();
- }
- return xPath;
-}
-
-NodeSet<std::string> DOMUtils::inPostFixOrder(const std::set<std::string>& elements,
- const Element<std::string>& root,
- const bool includeEmbeddedDoc) {
- NodeSet<std::string> nodes;
- inPostFixOrder(elements, root, includeEmbeddedDoc, nodes);
- return nodes;
-}
-
-void DOMUtils::inPostFixOrder(const std::set<std::string>& elements,
- const Element<std::string>& root,
- const bool includeEmbeddedDoc,
- NodeSet<std::string>& nodes) {
- NodeList<std::string> children = root.getChildNodes();
- for (size_t i = 0; i < children.getLength(); i++) {
- if (children.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Arabica::DOM::Element<std::string> childElem(children.item(i));
- if (!includeEmbeddedDoc && LOCALNAME(childElem) == "scxml")
- continue;
- inPostFixOrder(elements, childElem, includeEmbeddedDoc, nodes);
-
- }
- for (size_t i = 0; i < children.getLength(); i++) {
- if (children.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Arabica::DOM::Element<std::string> childElem(children.item(i));
- if (!includeEmbeddedDoc && LOCALNAME(childElem) == "scxml")
- continue;
-
- if (elements.find(TAGNAME(childElem)) != elements.end()) {
- nodes.push_back(childElem);
- }
- }
-}
-
-NodeSet<std::string> DOMUtils::inDocumentOrder(const std::set<std::string>& elements,
- const Element<std::string>& root,
- const bool includeEmbeddedDoc) {
- NodeSet<std::string> nodes;
- inDocumentOrder(elements, root, includeEmbeddedDoc, nodes);
- return nodes;
-}
-
-void DOMUtils::inDocumentOrder(const std::set<std::string>& elements,
- const Element<std::string>& root,
- const bool includeEmbeddedDoc,
- NodeSet<std::string>& nodes) {
- if (elements.find(TAGNAME(root)) != elements.end()) {
- nodes.push_back(root);
- }
-
- NodeList<std::string> children = root.getChildNodes();
- for (size_t i = 0; i < children.getLength(); i++) {
- if (children.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- if (!includeEmbeddedDoc && LOCALNAME_CAST(children.item(i)) == "scxml")
- continue;
- Arabica::DOM::Element<std::string> childElem(children.item(i));
- inDocumentOrder(elements, childElem, includeEmbeddedDoc, nodes);
- }
-}
-
-std::list<Arabica::DOM::Node<std::string> > DOMUtils::getElementsByType(const Arabica::DOM::Node<std::string>& root, Arabica::DOM::Node_base::Type type) {
- std::list<Arabica::DOM::Node<std::string> > result;
- std::list<Arabica::DOM::Node<std::string> > stack;
- std::list<Arabica::DOM::Node<std::string> >::iterator stackIter;
-
- if (!root)
- return result;
-
- stack.push_back(root);
- while(stack.size() > 0) {
-// for(stackIter = stack.begin(); stackIter != stack.end(); stackIter++) {
-// std::cout << stackIter->getNodeType() << " " << stackIter->getLocalName() << " " << stackIter->getNodeValue() << std::endl;
-// }
-// std::cout << std::endl;
-
- Arabica::DOM::Node<std::string> currNode = stack.back();
- if (currNode.hasChildNodes()) {
- stack.push_back(currNode.getFirstChild());
- continue;
- }
-
- // roll back stack and pop everyone without next sibling
- do {
- currNode = stack.back();
- if (currNode.getNodeType() == type)
- result.push_back(currNode);
- stack.pop_back();
- if (currNode.getNextSibling()) {
- stack.push_back(currNode.getNextSibling());
- break;
- }
- } while(stack.size() > 0);
- }
- return result;
-}
-
-
-NodeSet<std::string> DOMUtils::filterChildElements(const std::string& tagName, const NodeSet<std::string>& nodeSet, bool recurse) {
- NodeSet<std::string> filteredChildElems;
- for (unsigned int i = 0; i < nodeSet.size(); i++) {
- filteredChildElems.push_back(filterChildElements(tagName, nodeSet[i], recurse));
- }
- return filteredChildElems;
-}
-
-NodeSet<std::string> DOMUtils::filterChildElements(const std::string& tagName, const Node<std::string>& node, bool recurse) {
- NodeSet<std::string> filteredChildElems;
-
- if (!node)
- return filteredChildElems;
-
- NodeList<std::string> childs = node.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- // std::cerr << TAGNAME(childs.item(i)) << std::endl;
- if(iequals(TAGNAME_CAST(childs.item(i)), tagName)) {
- filteredChildElems.push_back(childs.item(i));
- }
- if (recurse) {
- filteredChildElems.push_back(filterChildElements(tagName, childs.item(i), recurse));
- }
- }
- return filteredChildElems;
-}
-
-
-NodeSet<std::string> DOMUtils::filterChildType(const Node_base::Type type, const NodeSet<std::string>& nodeSet, bool recurse) {
- NodeSet<std::string> filteredChildType;
- for (unsigned int i = 0; i < nodeSet.size(); i++) {
- filteredChildType.push_back(filterChildType(type, nodeSet[i], recurse));
- }
- return filteredChildType;
-}
-
-NodeSet<std::string> DOMUtils::filterChildType(const Node_base::Type type, const Node<std::string>& node, bool recurse) {
- NodeSet<std::string> filteredChildTypes;
-
- if (!node)
- return filteredChildTypes;
-
- NodeList<std::string> childs = node.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() == type)
- filteredChildTypes.push_back(childs.item(i));
- if (recurse) {
- filteredChildTypes.push_back(filterChildType(type, childs.item(i), recurse));
- }
- }
- return filteredChildTypes;
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/dom/DOMUtils.h b/src/uscxml/dom/DOMUtils.h
deleted file mode 100644
index 5c61f6d..0000000
--- a/src/uscxml/dom/DOMUtils.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef DOMUTILS_H_WK0WAEA7
-#define DOMUTILS_H_WK0WAEA7
-
-#include "uscxml/Common.h"
-#include <vector>
-#include <iostream>
-#include <DOM/Document.hpp>
-#include <DOM/io/Stream.hpp> // operator<< for nodes
-#include <XPath/XPath.hpp>
-
-#define TAGNAME_CAST(elem) ((Arabica::DOM::Element<std::string>)elem).getTagName()
-#define LOCALNAME_CAST(elem) ((Arabica::DOM::Element<std::string>)elem).getLocalName()
-#define ATTR_CAST(elem, attr) ((Arabica::DOM::Element<std::string>)elem).getAttribute(attr)
-#define ATTR_NODE_CAST(elem, attr) ((Arabica::DOM::Element<std::string>)elem).getAttributeNode(attr)
-#define HAS_ATTR_CAST(elem, attr) ((Arabica::DOM::Element<std::string>)elem).hasAttribute(attr)
-
-#define TAGNAME(elem) elem.getTagName()
-#define LOCALNAME(elem) elem.getLocalName()
-#define ATTR(elem, attr) elem.getAttribute(attr)
-#define ATTR_NODE(elem, attr) elem.getAttributeNode(attr)
-#define HAS_ATTR(elem, attr) elem.hasAttribute(attr)
-
-namespace uscxml {
-
-class USCXML_API DOMUtils {
-public:
-
- static std::string xPathForNode(const Arabica::DOM::Node<std::string>& node, const std::string& ns = "");
- static std::list<Arabica::DOM::Node<std::string> > getElementsByType(const Arabica::DOM::Node<std::string>& root, Arabica::DOM::Node_base::Type type);
- static std::string idForNode(const Arabica::DOM::Node<std::string>& node);
- // deprecated, use stringIsTrue from Convenience.h instead
- DEPRECATED static bool attributeIsTrue(const::std::string& value);
-
- static Arabica::XPath::NodeSet<std::string> inPostFixOrder(const std::string& element,
- const Arabica::DOM::Element<std::string>& root,
- const bool includeEmbeddedDoc = false) {
- std::set<std::string> elements;
- elements.insert(element);
- return inPostFixOrder(elements, root, includeEmbeddedDoc);
- }
-
- static Arabica::XPath::NodeSet<std::string> inPostFixOrder(const std::set<std::string>& elements,
- const Arabica::DOM::Element<std::string>& root,
- const bool includeEmbeddedDoc = false);
-
- static Arabica::XPath::NodeSet<std::string> inDocumentOrder(const std::string& element,
- const Arabica::DOM::Element<std::string>& root,
- const bool includeEmbeddedDoc = false) {
- std::set<std::string> elements;
- elements.insert(element);
- return inDocumentOrder(elements, root, includeEmbeddedDoc);
- }
-
- static Arabica::XPath::NodeSet<std::string> inDocumentOrder(const std::set<std::string>& elements,
- const Arabica::DOM::Element<std::string>& root,
- const bool includeEmbeddedDoc = false);
-
- static Arabica::XPath::NodeSet<std::string> filterChildElements(const std::string& tagname,
- const Arabica::DOM::Node<std::string>& node,
- bool recurse = false);
-
- static Arabica::XPath::NodeSet<std::string> filterChildElements(const std::string& tagName,
- const Arabica::XPath::NodeSet<std::string>& nodeSet,
- bool recurse = false);
-
- static Arabica::XPath::NodeSet<std::string> filterChildType(const Arabica::DOM::Node_base::Type type,
- const Arabica::DOM::Node<std::string>& node,
- bool recurse = false);
-
- static Arabica::XPath::NodeSet<std::string> filterChildType(const Arabica::DOM::Node_base::Type type,
- const Arabica::XPath::NodeSet<std::string>& nodeSet,
- bool recurse = false);
-
-protected:
- static void inPostFixOrder(const std::set<std::string>& elements,
- const Arabica::DOM::Element<std::string>& root,
- const bool includeEmbeddedDoc,
- Arabica::XPath::NodeSet<std::string>& nodes);
-
- static void inDocumentOrder(const std::set<std::string>& elements,
- const Arabica::DOM::Element<std::string>& root,
- const bool includeEmbeddedDoc,
- Arabica::XPath::NodeSet<std::string>& nodes);
-
-
-};
-
-
-}
-
-
-#endif /* end of include guard: DOMUTILS_H_WK0WAEA7 */
diff --git a/src/uscxml/dom/NameSpacingParser.cpp b/src/uscxml/dom/NameSpacingParser.cpp
deleted file mode 100644
index 0e26b55..0000000
--- a/src/uscxml/dom/NameSpacingParser.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/dom/NameSpacingParser.h"
-#include <uscxml/Convenience.h>
-#include <glog/logging.h>
-#include <SAX/helpers/InputSourceResolver.hpp>
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-NameSpacingParser NameSpacingParser::fromFile(const std::string& file) {
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setSystemId(file);
- return fromInputSource(inputSource);
-}
-
-NameSpacingParser NameSpacingParser::fromXML(const std::string& xml) {
- std::stringstream* ss = new std::stringstream();
- (*ss) << xml;
- // we need an auto_ptr for arabica to assume ownership
- std::auto_ptr<std::istream> ssPtr(ss);
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setByteStream(ssPtr);
- return fromInputSource(inputSource);
-}
-
-NameSpacingParser NameSpacingParser::fromInputSource(Arabica::SAX::InputSource<std::string>& source) {
- NameSpacingParser parser;
- if(!parser.parse(source) || !parser.getDocument().hasChildNodes()) {
- if(parser._errorHandler.errorsReported()) {
-// LOG(ERROR) << "could not parse input:";
-// LOG(ERROR) << parser._errorHandler.errors() << std::endl;
- } else {
- Arabica::SAX::InputSourceResolver resolver(source, Arabica::default_string_adaptor<std::string>());
- if (!resolver.resolve()) {
- LOG(ERROR) << source.getSystemId() << ": no such file";
- }
- }
- }
- return parser;
-}
-
-NameSpacingParser::NameSpacingParser() {
- setErrorHandler(_errorHandler);
-}
-
-void NameSpacingParser::startPrefixMapping(const std::string& prefix, const std::string& uri) {
- nameSpace.insert(std::make_pair(uri, prefix));
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/dom/NameSpacingParser.h b/src/uscxml/dom/NameSpacingParser.h
deleted file mode 100644
index 1aa85a2..0000000
--- a/src/uscxml/dom/NameSpacingParser.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * @file
- * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef NAMESPACINGPARSER_H_BD6902F6
-#define NAMESPACINGPARSER_H_BD6902F6
-
-#include "uscxml/Common.h"
-#include <iostream>
-#include <XPath/XPath.hpp>
-#include <DOM/io/Stream.hpp> // operator<< for nodes
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-#include <SAX/helpers/DefaultHandler.hpp>
-#include <SAX/helpers/CatchErrorHandler.hpp>
-
-namespace uscxml {
-
-class ScriptEntityResolver : public Arabica::SAX::EntityResolver<std::string> {
- virtual InputSourceT resolveEntity(const std::string& publicId, const std::string& systemId) {
- Arabica::SAX::InputSource<std::string> is;
- return is;
- }
-};
-
-class USCXML_API NameSpacingParser : public Arabica::SAX2DOM::Parser<std::string> {
-public:
- NameSpacingParser();
- NameSpacingParser(const NameSpacingParser& other) {}
- static NameSpacingParser fromFile(const std::string& file);
- static NameSpacingParser fromXML(const std::string& xml);
- static NameSpacingParser fromInputSource(Arabica::SAX::InputSource<std::string>& source);
-
- void startPrefixMapping(const std::string& prefix, const std::string& uri);
-
- std::map<std::string, std::string> nameSpace;
-
- virtual bool errorsReported() {
- return _errorHandler.errorsReported();
- }
-
- virtual const std::string& errors() {
- return _errorHandler.errors();
- }
-
-private:
- Arabica::SAX::CatchErrorHandler<std::string> _errorHandler;
-};
-
-}
-
-
-#endif /* end of include guard: NAMESPACINGPARSER_H_BD6902F6 */
diff --git a/src/uscxml/interpreter/ContentExecutorImpl.cpp b/src/uscxml/interpreter/ContentExecutorImpl.cpp
new file mode 100644
index 0000000..6a06bec
--- /dev/null
+++ b/src/uscxml/interpreter/ContentExecutorImpl.cpp
@@ -0,0 +1,649 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include "ContentExecutorImpl.h"
+#include "uscxml/util/String.h"
+#include "uscxml/util/Predicates.h"
+#include "uscxml/util/UUID.h"
+#include "uscxml/util/URL.h"
+#include "uscxml/messages/Data.h"
+
+#include <xercesc/parsers/XercesDOMParser.hpp>
+#include <xercesc/sax/HandlerBase.hpp>
+#include <xercesc/framework/MemBufInputSource.hpp>
+
+#include "easylogging++.h"
+
+namespace uscxml {
+
+using namespace xercesc;
+
+void BasicContentExecutorImpl::processRaise(xercesc::DOMElement* content) {
+ Event raised(ATTR(content, "event"));
+ _callbacks->enqueueInternal(raised);
+}
+
+void BasicContentExecutorImpl::processSend(xercesc::DOMElement* element) {
+ Event sendEvent;
+ std::string target;
+ std::string type = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"; // default
+ uint32_t delayMs = 0;
+
+ // test 331
+ sendEvent.eventType = Event::EXTERNAL;
+
+ // test 228
+ std::string invokeId = _callbacks->getInvokeId();
+ if (invokeId.size() > 0) {
+ sendEvent.invokeid = invokeId;
+ }
+
+ try {
+ // event
+ if (HAS_ATTR(element, "eventexpr")) {
+ sendEvent.name = _callbacks->evalAsData(ATTR(element, "eventexpr")).atom;
+ } else if (HAS_ATTR(element, "event")) {
+ sendEvent.name = ATTR(element, "event");
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element eventexpr", element);
+ }
+
+ try {
+ // target
+ if (HAS_ATTR(element, "targetexpr")) {
+ target = _callbacks->evalAsData(ATTR(element, "targetexpr")).atom;
+ } else if (HAS_ATTR(element, "target")) {
+ target = ATTR(element, "target");
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element targetexpr", element);
+ }
+
+ try {
+ // type
+ if (HAS_ATTR(element, "typeexpr")) {
+ type = _callbacks->evalAsData(ATTR(element, "typeexpr")).atom;
+ } else if (HAS_ATTR(element, "type")) {
+ type = ATTR(element, "type");
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element typeexpr", element);
+ }
+
+ try {
+ // id
+ if (HAS_ATTR(element, "id")) {
+ sendEvent.sendid = ATTR(element, "id");
+ } else {
+ /*
+ * The ids for <send> and <invoke> are subtly different. In a conformant
+ * SCXML document, they must be unique within the session, but in the case
+ * where the author does not provide them, the processor must generate a
+ * new unique ID not at load time but each time the element is executed.
+ * Furthermore the attribute 'idlocation' can be used to capture this
+ * automatically generated id. Finally note that the automatically generated
+ * id for <invoke> has a special format. See 6.4.1 Attribute Details for
+ * details. The SCXML processor may generate all other ids in any format,
+ * as long as they are unique.
+ */
+
+ /**
+ *
+ * If 'idlocation' is present, the SCXML Processor must generate an id when
+ * the parent <send> element is evaluated and store it in this location.
+ * See 3.14 IDs for details.
+ *
+ */
+ sendEvent.sendid = ATTR(getParentState(element), "id") + "." + UUID::getUUID();
+ if (HAS_ATTR(element, "idlocation")) {
+ _callbacks->assign(ATTR(element, "idlocation"), Data(sendEvent.sendid, Data::VERBATIM));
+ } else {
+ sendEvent.hideSendId = true;
+ }
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element idlocation", element);
+ }
+
+ try {
+ // delay
+ std::string delay;
+ if (HAS_ATTR(element, "delayexpr")) {
+ delay = _callbacks->evalAsData(ATTR(element, "delayexpr"));
+ } else if (HAS_ATTR(element, "delay")) {
+ delay = ATTR(element, "delay");
+ }
+ if (delay.size() > 0) {
+ NumAttr delayAttr(delay);
+ if (iequals(delayAttr.unit, "ms")) {
+ delayMs = strTo<uint32_t>(delayAttr.value);
+ } else if (iequals(delayAttr.unit, "s")) {
+ delayMs = strTo<double>(delayAttr.value) * 1000;
+ } else if (delayAttr.unit.length() == 0) { // unit less delay is interpreted as milliseconds
+ delayMs = strTo<uint32_t>(delayAttr.value);
+ } else {
+ LOG(ERROR) << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'";
+ }
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element delayexpr", element);
+ }
+
+ try {
+ // namelist
+ processNameLists(sendEvent.namelist, element);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element namelist", element);
+ }
+
+
+ try {
+ // params
+ processParams(sendEvent.params, element);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element param expr", element);
+ }
+
+ try {
+ // content
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(element).str() + "content", element);
+ if (contents.size() > 0) {
+ sendEvent.data = elementAsData(contents.front());
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element content", element);
+ }
+
+ // if (sendReq->dom) {
+ // std::stringstream ss;
+ // ss << sendReq->dom;
+ // sendReq->xml = ss.str();
+ // _dataModel.replaceExpressions(sendReq->xml);
+ // }
+
+ // assert(_sendIds.find(sendReq->sendid) == _sendIds.end());
+ // _sendIds[sendReq->sendid] = std::make_pair(this, sendReq);
+
+ try {
+ _callbacks->checkValidSendType(type, target);
+ } catch (ErrorEvent e) {
+ e.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(element), uscxml::Data::VERBATIM);
+ // test 332
+ e.sendid = sendEvent.sendid;
+ throw e;
+ }
+ _callbacks->enqueue(type, target, delayMs, sendEvent);
+
+}
+
+void BasicContentExecutorImpl::processCancel(xercesc::DOMElement* content) {
+ std::string sendid;
+ if (HAS_ATTR(content, "sendid")) {
+ sendid = ATTR(content, "sendid");
+ } else if (HAS_ATTR(content, "sendidexpr")) {
+ sendid = _callbacks->evalAsData(ATTR(content, "sendidexpr")).atom;
+ } else {
+ ERROR_EXECUTION_THROW2("Cancel element has neither sendid nor sendidexpr attribute", content);
+
+ }
+ _callbacks->cancelDelayed(sendid);
+}
+
+void BasicContentExecutorImpl::processIf(xercesc::DOMElement* content) {
+ bool blockIsTrue = _callbacks->isTrue(ATTR(content, "cond"));
+
+ DOMNodeList* children = content->getChildNodes();
+ for (unsigned int i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+
+ DOMElement* childElem = dynamic_cast<DOMElement*>(children->item(i));
+
+ if (iequals(TAGNAME(childElem), XML_PREFIX(content).str() + "elseif")) {
+ if (blockIsTrue) {
+ // last block was true, break here
+ break;
+ }
+ blockIsTrue = _callbacks->isTrue(ATTR(childElem, "cond"));
+ continue;
+ }
+ if (iequals(TAGNAME(childElem), XML_PREFIX(content).str() + "else")) {
+ if (blockIsTrue) {
+ // last block was true, break here
+ break;
+ }
+ blockIsTrue = true;
+ continue;
+ }
+
+ // current block is true
+ if (blockIsTrue) {
+ // we do now that the prefix of content is correct
+ process(childElem, XML_PREFIX(content));
+ }
+ }
+}
+
+void BasicContentExecutorImpl::processAssign(xercesc::DOMElement* content) {
+ std::string location = ATTR(content, "location");
+ _callbacks->assign(location, elementAsData(content));
+}
+
+void BasicContentExecutorImpl::processForeach(xercesc::DOMElement* content) {
+ std::string array = ATTR(content, "array");
+ std::string item = ATTR(content, "item");
+ std::string index = (HAS_ATTR(content, "index") ? ATTR(content, "index") : "");
+
+ uint32_t iterations = 0;
+ iterations = _callbacks->getLength(array);
+
+ for (uint32_t iteration = 0; iteration < iterations; iteration++) {
+ _callbacks->setForeach(item, array, index, iteration);
+
+ DOMNodeList* children = content->getChildNodes();
+ for (unsigned int i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ process(dynamic_cast<DOMElement*>(children->item(i)), XML_PREFIX(content));
+ }
+ }
+}
+
+void BasicContentExecutorImpl::processLog(xercesc::DOMElement* content) {
+ std::string label = ATTR(content, "label");
+ std::string expr = ATTR(content, "expr");
+
+ Data d = _callbacks->evalAsData(expr);
+ if (label.size() > 0) {
+ std::cout << label << ": ";
+ }
+ std::cout << d << std::endl;
+}
+
+void BasicContentExecutorImpl::processScript(xercesc::DOMElement* content) {
+ // download as necessary
+ std::string scriptContent(X(content->getTextContent()));
+ _callbacks->evalAsData(scriptContent);
+
+}
+
+void BasicContentExecutorImpl::process(xercesc::DOMElement* block, const X& xmlPrefix) {
+ std::string tagName = TAGNAME(block);
+
+
+ if (iequals(tagName, xmlPrefix.str() + "onentry") ||
+ iequals(tagName, xmlPrefix.str() + "onexit") ||
+ iequals(tagName, xmlPrefix.str() + "transition")) {
+
+ DOMNodeList* children = block->getChildNodes();
+ try {
+ for(auto i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ // process any child eleents
+ process(dynamic_cast<DOMElement*>(children->item(i)), xmlPrefix);
+ }
+ } catch (Event e) {
+ // there has been an error in an executable content block
+ // we do not care - parent scope has to handle it!
+ throw e;
+ }
+ return;
+ }
+
+ if (iequals(tagName, xmlPrefix.str() + "finalize")) {
+ std::list<DOMNode*> childElems = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, block, false);
+ if(childElems.size() > 0) {
+ for(auto elemIter = childElems.begin(); elemIter != childElems.end(); elemIter++) {
+ process(static_cast<DOMElement*>(*elemIter), xmlPrefix);
+ }
+ } else {
+ // issue 67 - empty finalize element
+ DOMNode* parent = block->getParentNode();
+ if (parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
+ DOMElement* invokeElem = static_cast<DOMElement*>(parent);
+ if (iequals(X(invokeElem->getTagName()).str(), xmlPrefix.str() + "invoke")) {
+ // we are the empth finalize element of an invoke
+ // Specification 6.5.2: http://www.w3.org/TR/scxml/#N110EF
+
+ const Event& event = _callbacks->getCurrentEvent();
+ std::list<std::string> names = tokenize(ATTR(invokeElem, "namelist"));
+ for (std::list<std::string>::iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
+ if (event.namelist.find(*nameIter) != event.namelist.end()) {
+ // scxml i/o proc keeps a dedicated namelist
+ _callbacks->assign(*nameIter, event.namelist.at(*nameIter));
+ } else if (event.data.compound.find(*nameIter) != event.data.compound.end()) {
+ // this is where it would end up with non scxml i/o processors
+ _callbacks->assign(*nameIter, event.data.compound.at(*nameIter));
+ }
+ }
+ }
+ }
+
+ }
+ return;
+ }
+
+ try {
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeExecutingContent, block);
+
+ if (false) {
+ } else if (iequals(tagName, xmlPrefix.str() + "raise")) {
+ processRaise(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "send")) {
+ processSend(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "cancel")) {
+ processCancel(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "if")) {
+ processIf(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "assign")) {
+ processAssign(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "foreach")) {
+ processForeach(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "log")) {
+ processLog(block);
+ } else if (iequals(tagName, xmlPrefix.str() + "script")) {
+ processScript(block);
+ } else {
+ LOG(ERROR) << tagName;
+ assert(false);
+ }
+ } catch (ErrorEvent exc) {
+
+ Event e(exc);
+ _callbacks->enqueueInternal(e);
+ LOG(ERROR) << exc << std::endl;
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), afterExecutingContent, block);
+
+ throw e; // will be catched in microstepper
+
+ }
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), afterExecutingContent, block);
+
+}
+
+void BasicContentExecutorImpl::invoke(xercesc::DOMElement* element) {
+ std::string type;
+ std::string source;
+ bool autoForward = false;
+ Event invokeEvent;
+
+ // type
+ if (HAS_ATTR(element, "typeexpr")) {
+ type = _callbacks->evalAsData(ATTR(element, "typeexpr")).atom;
+ } else if (HAS_ATTR(element, "type")) {
+ type = ATTR(element, "type");
+ } else {
+ // test 422
+ type = "http://www.w3.org/TR/scxml/";
+ }
+
+ // src
+ if (HAS_ATTR(element, "srcexpr")) {
+ source = _callbacks->evalAsData(ATTR(element, "srcexpr")).atom;
+ } else if (HAS_ATTR(element, "src")) {
+ source = ATTR(element, "src");
+ }
+ if (source.length() > 0) {
+ // absolutize url
+ }
+
+ // id
+ try {
+ if (HAS_ATTR(element, "id")) {
+ invokeEvent.invokeid = ATTR(element, "id");
+ } else {
+ invokeEvent.invokeid = ATTR(getParentState(element), "id") + "." + UUID::getUUID();
+ if (HAS_ATTR(element, "idlocation")) {
+ _callbacks->assign(ATTR(element, "idlocation"), Data(invokeEvent.invokeid, Data::VERBATIM));
+ }
+ }
+ // we need the invokeid to uninvoke - TODO: This is leaking!
+ char* invokeId = (char*)malloc(invokeEvent.invokeid.size() + 1);
+ memcpy(invokeId, invokeEvent.invokeid.c_str(), invokeEvent.invokeid.size());
+ invokeId[invokeEvent.invokeid.size()] = 0;
+
+ element->setUserData(X("invokeid"), (void*)invokeId, NULL);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in invoke element idlocation", element);
+ }
+
+ try {
+ // namelist
+ processNameLists(invokeEvent.namelist, element);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element namelist", element);
+ }
+
+
+ try {
+ // params
+ processParams(invokeEvent.params, element);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element param expr", element);
+ }
+
+ try {
+ // content
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(element).str() + "content", element);
+ if (contents.size() > 0) {
+ Data d = elementAsData(contents.front());
+ if (d.type == Data::INTERPRETED && d.atom.size() > 0) {
+ // immediately evaluate!
+ invokeEvent.data = _callbacks->evalAsData(d.atom);
+ } else {
+ invokeEvent.data = d;
+ }
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in send element content", element);
+ }
+
+ // autoforward
+ if (HAS_ATTR(element, "autoforward")) {
+ if (iequals(ATTR(element, "autoforward"), "true")) {
+ autoForward = true;
+ }
+ }
+
+ // finalize
+ DOMElement* finalize = NULL;
+ std::list<DOMElement*> finalizes = DOMUtils::filterChildElements(XML_PREFIX(element).str() + "finalize", element);
+ if (finalizes.size() > 0) {
+ finalize = finalizes.front();
+ }
+
+ USCXML_MONITOR_CALLBACK2(_callbacks->getMonitor(), beforeUninvoking, element, invokeEvent.invokeid);
+ _callbacks->invoke(type, source, autoForward, finalize, invokeEvent);
+ USCXML_MONITOR_CALLBACK2(_callbacks->getMonitor(), afterUninvoking, element, invokeEvent.invokeid);
+}
+
+void BasicContentExecutorImpl::uninvoke(xercesc::DOMElement* invoke) {
+ // TODO: DANGER This is the real danger here
+ char* invokeId = (char*)invoke->getUserData(X("invokeid"));
+ assert(invokeId != NULL);
+
+ USCXML_MONITOR_CALLBACK2(_callbacks->getMonitor(), beforeUninvoking, invoke, invokeId);
+ _callbacks->uninvoke(invokeId);
+ USCXML_MONITOR_CALLBACK2(_callbacks->getMonitor(), afterUninvoking, invoke, invokeId);
+
+ free(invokeId);
+}
+
+void BasicContentExecutorImpl::raiseDoneEvent(xercesc::DOMElement* state, xercesc::DOMElement* doneData) {
+
+ Event doneEvent;
+ doneEvent.name = "done.state.";
+ doneEvent.name += HAS_ATTR(state, "id") ? ATTR(state, "id") : DOMUtils::idForNode(state);
+
+ if (doneData != NULL) {
+ try {
+ try {
+ // namelist
+ processNameLists(doneEvent.namelist, doneData);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in donedata element namelist", doneData);
+ }
+
+
+ try {
+ // params
+ processParams(doneEvent.params, doneData);
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in donedata element param expr", doneData);
+ }
+
+ try {
+ // content
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(doneData).str() + "content", doneData);
+ if (contents.size() > 0) {
+ doneEvent.data = elementAsData(contents.front());
+ }
+ } catch (Event e) {
+ ERROR_EXECUTION_THROW2("Syntax error in donedata element content", doneData);
+ }
+
+ } catch (ErrorEvent exc) {
+ // clean out data test488 (needed?)
+ doneEvent.data = Data();
+
+ Event e(exc);
+ _callbacks->enqueueInternal(e);
+ // std::cout << exc << std::endl;
+ // throw e;
+ }
+ }
+
+ _callbacks->enqueueInternal(doneEvent);
+
+}
+
+void BasicContentExecutorImpl::processNameLists(std::map<std::string, Data>& nameMap, DOMElement* element) {
+ if (HAS_ATTR(element, "namelist")) {
+ std::list<std::string> names = tokenize(ATTR(element, "namelist"));
+ for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
+ nameMap[*nameIter] = _callbacks->evalAsData(*nameIter);
+ }
+ }
+}
+
+void BasicContentExecutorImpl::processParams(std::multimap<std::string, Data>& paramMap, DOMElement* element) {
+ std::list<DOMElement*> params = DOMUtils::filterChildElements(XML_PREFIX(element).str() + "param", element);
+ for (auto paramIter = params.begin(); paramIter != params.end(); paramIter++) {
+ std::string name = ATTR(*paramIter, "name");
+ Data d;
+ if (HAS_ATTR(*paramIter, "expr")) {
+ d = _callbacks->evalAsData(ATTR(*paramIter, "expr"));
+ } else if (HAS_ATTR(*paramIter, "location")) {
+ d = _callbacks->evalAsData(ATTR(*paramIter, "location"));
+ } else {
+ d = elementAsData(*paramIter);
+ }
+ paramMap.insert(make_pair(name, d));
+ }
+}
+
+Data BasicContentExecutorImpl::elementAsData(xercesc::DOMElement* element) {
+ if (HAS_ATTR(element, "expr")) {
+// return _callbacks->evalAsData(ATTR(element, "expr"));
+ if (LOCALNAME(element) == "content") {
+ // test 528
+ return _callbacks->evalAsData(ATTR(element, "expr"));
+ } else {
+ // test 326
+ return Data(ATTR(element, "expr"), Data::INTERPRETED);
+ }
+ }
+
+ if (HAS_ATTR(element, "src")) {
+ // remote content from URL
+
+ // test 446, test 552, test 558
+ std::string src = ATTR(element, "src");
+ URL url(ATTR(element, "src"));
+ if (!url.isAbsolute()) {
+ url = URL::resolve(url, _callbacks->getBaseURL());
+ }
+
+ std::string content = url.getInContent();
+
+ // make an attempt to parse as XML
+ try {
+ xercesc::XercesDOMParser* parser = new xercesc::XercesDOMParser();
+ parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
+ parser->setDoNamespaces(true);
+ parser->useScanner(xercesc::XMLUni::fgWFXMLScanner);
+
+ xercesc::ErrorHandler* errHandler = new xercesc::HandlerBase();
+ parser->setErrorHandler(errHandler);
+
+ std::string tmp = url;
+ xercesc::MemBufInputSource is((XMLByte*)content.c_str(), content.size(), X("fake"));
+
+ parser->parse(is);
+
+ Data d;
+ xercesc::DOMDocument* doc = parser->adoptDocument();
+ d.adoptedDoc = std::make_shared<xercesc::DOMDocument*>(doc);
+ d.node = doc->getDocumentElement();
+ return d;
+
+ } catch (...) {
+ // just ignore and return as an interpreted string below
+ }
+ try {
+ Data d = _callbacks->getAsData(content);
+ if (!d.empty())
+ return d;
+ } catch(...) {}
+
+ return Data(spaceNormalize(content), Data::VERBATIM);
+
+ } else {
+ // local content in document
+
+ std::list<DOMNode*> elementChildren = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, element);
+ if (elementChildren.size() == 1) {
+ return Data(elementChildren.front());
+ } else if (elementChildren.size() > 1) {
+ return Data(element);
+ }
+
+ std::list<DOMNode*> textChildren = DOMUtils::filterChildType(DOMNode::TEXT_NODE, element);
+ if (textChildren.size() > 0) {
+ std::stringstream contentSS;
+ for (auto textIter = textChildren.begin(); textIter != textChildren.end(); textIter++) {
+ contentSS << X((*textIter)->getNodeValue());
+ }
+ try {
+ Data d = _callbacks->getAsData(contentSS.str());
+ if (!d.empty())
+ return d;
+ } catch(...) {}
+
+ return Data(spaceNormalize(contentSS.str()), Data::VERBATIM);
+ }
+ }
+
+ LOG(WARNING) << "Element " << DOMUtils::xPathForNode(element) << " did not yield any data";
+ return Data();
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h
new file mode 100644
index 0000000..c0d28a2
--- /dev/null
+++ b/src/uscxml/interpreter/ContentExecutorImpl.h
@@ -0,0 +1,143 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+
+#ifndef CONTENTEXECUTORIMPL_H_13F2884F
+#define CONTENTEXECUTORIMPL_H_13F2884F
+
+#include "uscxml/Common.h"
+#include "uscxml/util/DOM.h"
+#include "uscxml/messages/Data.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/interpreter/InterpreterMonitor.h"
+#include <xercesc/dom/DOM.hpp>
+#include <string>
+
+namespace uscxml {
+
+class USCXML_API ContentExecutorCallbacks {
+public:
+ virtual void enqueueInternal(const Event& event) = 0;
+ virtual void enqueueExternal(const Event& event) = 0;
+ virtual void enqueueExternalDelayed(const Event& event, size_t delayMs, const std::string& eventUUID) = 0;
+ virtual void cancelDelayed(const std::string& eventId) = 0;
+
+ virtual bool isTrue(const std::string& expr) = 0;
+ virtual size_t getLength(const std::string& expr) = 0;
+
+ virtual void setForeach(const std::string& item,
+ const std::string& array,
+ const std::string& index,
+ uint32_t iteration) = 0;
+
+ virtual Data evalAsData(const std::string& expr) = 0;
+ virtual Data getAsData(const std::string& expr) = 0;
+ virtual void assign(const std::string& location, const Data& data) = 0;
+
+
+ virtual std::string getInvokeId() = 0;
+ virtual std::string getBaseURL() = 0;
+ virtual bool checkValidSendType(const std::string& type, const std::string& target) = 0;
+ virtual void enqueue(const std::string& type, const std::string& target, size_t delayMs, const Event& sendEvent) = 0;
+ virtual void invoke(const std::string& type, const std::string& src, bool autoForward, xercesc::DOMElement* finalize, const Event& invokeEvent) = 0;
+ virtual void uninvoke(const std::string& invokeId) = 0;
+
+ virtual const Event& getCurrentEvent() = 0;
+
+ /** Monitoring */
+ virtual InterpreterMonitor* getMonitor() = 0;
+
+};
+
+class USCXML_API ContentExecutorImpl {
+public:
+ ContentExecutorImpl(ContentExecutorCallbacks* callbacks) : _callbacks(callbacks) {}
+
+ virtual void process(xercesc::DOMElement* block, const X& xmlPrefix) = 0;
+
+ virtual void invoke(xercesc::DOMElement* invoke) = 0;
+ virtual void uninvoke(xercesc::DOMElement* invoke) = 0;
+
+ virtual void raiseDoneEvent(xercesc::DOMElement* state, xercesc::DOMElement* doneData) = 0;
+ virtual Data elementAsData(xercesc::DOMElement* element) = 0;
+
+protected:
+ ContentExecutorCallbacks* _callbacks;
+
+};
+
+class USCXML_API BasicContentExecutorImpl : public ContentExecutorImpl {
+public:
+ BasicContentExecutorImpl(ContentExecutorCallbacks* callbacks) : ContentExecutorImpl(callbacks) {}
+ virtual ~BasicContentExecutorImpl() {}
+
+ void processRaise(xercesc::DOMElement* content);
+ void processSend(xercesc::DOMElement* element);
+ void processCancel(xercesc::DOMElement* content);
+ void processIf(xercesc::DOMElement* content);
+ void processAssign(xercesc::DOMElement* content);
+ void processForeach(xercesc::DOMElement* content);
+ void processLog(xercesc::DOMElement* content);
+ void processScript(xercesc::DOMElement* content);
+
+ virtual void process(xercesc::DOMElement* block, const X& xmlPrefix);
+
+ virtual void invoke(xercesc::DOMElement* invoke);
+ virtual void uninvoke(xercesc::DOMElement* invoke);
+ virtual void raiseDoneEvent(xercesc::DOMElement* state, xercesc::DOMElement* doneData);
+
+ virtual Data elementAsData(xercesc::DOMElement* element);
+
+protected:
+ void processNameLists(std::map<std::string, Data>& nameMap, xercesc::DOMElement* element);
+ void processParams(std::multimap<std::string, Data>& paramMap, xercesc::DOMElement* element);
+
+};
+
+class USCXML_API ContentExecutor {
+public:
+ PIMPL_OPERATORS(ContentExecutor)
+
+ virtual void process(xercesc::DOMElement* block, const X& xmlPrefix) {
+ _impl->process(block, xmlPrefix);
+ }
+
+ virtual void invoke(xercesc::DOMElement* invoke) {
+ _impl->invoke(invoke);
+ }
+
+ virtual void uninvoke(xercesc::DOMElement* invoke) {
+ _impl->uninvoke(invoke);
+ }
+
+ virtual Data elementAsData(xercesc::DOMElement* element) {
+ return _impl->elementAsData(element);
+ }
+
+ virtual void raiseDoneEvent(xercesc::DOMElement* state, xercesc::DOMElement* doneData) {
+ return _impl->raiseDoneEvent(state, doneData);
+ }
+
+protected:
+ std::shared_ptr<ContentExecutorImpl> _impl;
+};
+
+}
+
+#endif /* end of include guard: CONTENTEXECUTORIMPL_H_13F2884F */
diff --git a/src/uscxml/interpreter/EventQueueImpl.cpp b/src/uscxml/interpreter/EventQueueImpl.cpp
new file mode 100644
index 0000000..345da69
--- /dev/null
+++ b/src/uscxml/interpreter/EventQueueImpl.cpp
@@ -0,0 +1,189 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include "EventQueueImpl.h"
+#include <event2/util.h> // for evutil_socket_t
+#include <event2/thread.h>
+#include <assert.h>
+
+#include <easylogging++.h>
+
+namespace uscxml {
+
+EventQueueImpl::EventQueueImpl() {
+}
+EventQueueImpl::~EventQueueImpl() {
+}
+
+Event EventQueueImpl::dequeue(bool blocking) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ if (blocking) {
+ while (_queue.empty()) {
+ _cond.wait(_mutex);
+ }
+ }
+ if (_queue.size() > 0) {
+ Event event = _queue.front();
+ _queue.pop_front();
+// LOG(ERROR) << event.name;
+ return event;
+ }
+ return Event();
+
+}
+
+void EventQueueImpl::enqueue(const Event& event) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ _queue.push_back(event);
+ _cond.notify_all();
+}
+
+static void dummyCallback(evutil_socket_t fd, short what, void *arg) {
+ timeval tv;
+ tv.tv_sec = 365 * 24 * 3600;
+ tv.tv_usec = 0;
+ event *ev = *(event **)arg;
+ evtimer_add(ev, &tv);
+}
+
+DelayedEventQueueImpl::DelayedEventQueueImpl(DelayedEventQueueCallbacks* callbacks) {
+ _callbacks = callbacks;
+#ifndef _WIN32
+ evthread_use_pthreads();
+#else
+ evthread_use_windows_threads();
+#endif
+ _eventLoop = event_base_new();
+
+ // see here: https://github.com/named-data/ndn.cxx/blob/master/scheduler/scheduler.cc
+ // and here: https://www.mail-archive.com/libevent-users@seul.org/msg01676.html
+ timeval tv;
+ tv.tv_sec = 365 * 24 * 3600;
+ tv.tv_usec = 0;
+ _dummyEvent = evtimer_new(_eventLoop, dummyCallback, &_dummyEvent);
+ evtimer_add(_dummyEvent, &tv);
+
+ _thread = NULL;
+ _isStarted = false;
+ start();
+}
+
+DelayedEventQueueImpl::~DelayedEventQueueImpl() {
+ stop();
+ evtimer_del(_dummyEvent);
+ event_free(_dummyEvent);
+ event_base_free(_eventLoop);
+}
+
+void DelayedEventQueueImpl::timerCallback(evutil_socket_t fd, short what, void *arg) {
+ struct callbackData *data = (struct callbackData*)arg;
+ std::lock_guard<std::recursive_mutex> lock(data->eventQueue->_mutex);
+
+ if (data->eventQueue->_callbackData.find(data->eventUUID) == data->eventQueue->_callbackData.end())
+ return;
+
+ event_free(data->event);
+ data->eventQueue->_callbacks->eventReady(data->userData, data->eventUUID);
+ data->eventQueue->_callbackData.erase(data->eventUUID);
+}
+
+void DelayedEventQueueImpl::enqueueDelayed(const Event& event, size_t delayMs, const std::string& eventUUID) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+ if(_callbackData.find(eventUUID) != _callbackData.end()) {
+ cancelDelayed(eventUUID);
+ }
+
+ _callbackData[eventUUID].eventUUID = eventUUID;
+ _callbackData[eventUUID].userData = event;
+ _callbackData[eventUUID].eventQueue = this;
+
+ struct timeval delay = {static_cast<int32_t>(delayMs / 1000), static_cast<int32_t>((delayMs % 1000) * 1000)};
+ struct event* e = event_new(_eventLoop, -1, 0, timerCallback, &_callbackData[eventUUID]);
+
+ _callbackData[eventUUID].event = e;
+
+ event_add(e, &delay);
+}
+
+void DelayedEventQueueImpl::cancelAllDelayed() {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+
+ while(_callbackData.size() > 0) {
+ std::pair<std::string, callbackData> item = *_callbackData.begin();
+ Event data = item.second.userData;
+ event_del(item.second.event);
+ event_free(item.second.event);
+ _callbackData.erase(item.first);
+ }
+
+}
+
+void DelayedEventQueueImpl::cancelDelayed(const std::string& eventId) {
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
+
+ if(_callbackData.find(eventId) != _callbackData.end()) {
+ event_del(_callbackData[eventId].event);
+ event_free(_callbackData[eventId].event);
+ _callbackData.erase(eventId);
+ }
+}
+
+void DelayedEventQueueImpl::run(void* instance) {
+ DelayedEventQueueImpl* INSTANCE = (DelayedEventQueueImpl*)instance;
+ int result;
+ while(INSTANCE->_isStarted) {
+ /**
+ * EVLOOP_NO_EXIT_ON_EMPTY was removed in libevent2.1 - we are
+ * using the event in the far future approach to get blocking
+ * behavior back (see comments in contructor)
+ */
+
+ // #ifndef EVLOOP_NO_EXIT_ON_EMPTY
+// result = event_base_dispatch(INSTANCE->_eventLoop);
+ // #else
+ // TODO: this is polling when no events are enqueued
+ result = event_base_loop(INSTANCE->_eventLoop, EVLOOP_ONCE);
+// assert(false); // NON-BLOCKING?!
+ //#endif
+ (void)result;
+ }
+}
+
+void DelayedEventQueueImpl::start() {
+ if (_isStarted) {
+ return;
+ }
+ _isStarted = true;
+ _thread = new std::thread(DelayedEventQueueImpl::run, this);
+}
+
+void DelayedEventQueueImpl::stop() {
+ if (_isStarted) {
+ _isStarted = false;
+ event_base_loopbreak(_eventLoop);
+ cancelAllDelayed();
+ }
+ if (_thread) {
+ _thread->join();
+ delete _thread;
+ _thread = NULL;
+ }
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/interpreter/EventQueueImpl.h b/src/uscxml/interpreter/EventQueueImpl.h
new file mode 100644
index 0000000..10543c9
--- /dev/null
+++ b/src/uscxml/interpreter/EventQueueImpl.h
@@ -0,0 +1,125 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef EVENTSOURCE_H_775AB206
+#define EVENTSOURCE_H_775AB206
+
+#include "uscxml/Common.h"
+#include "uscxml/messages/Event.h"
+#include <string>
+#include <map>
+#include <list>
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+
+#include <event2/event.h>
+
+
+namespace uscxml {
+
+class USCXML_API EventQueueImpl {
+public:
+ EventQueueImpl();
+ virtual ~EventQueueImpl();
+ virtual Event dequeue(bool blocking);
+ virtual void enqueue(const Event& event);
+
+protected:
+ std::list<Event> _queue;
+ std::recursive_mutex _mutex;
+ std::condition_variable_any _cond;
+
+};
+
+class USCXML_API DelayedEventQueueCallbacks {
+public:
+ virtual void eventReady(Event& event, const std::string& eventId) = 0;
+};
+
+class USCXML_API DelayedEventQueueImpl : public EventQueueImpl {
+public:
+ DelayedEventQueueImpl(DelayedEventQueueCallbacks* callbacks);
+ virtual ~DelayedEventQueueImpl();
+ virtual void enqueueDelayed(const Event& event, size_t delayMs, const std::string& eventUUID);
+ virtual void cancelDelayed(const std::string& eventId);
+ virtual void cancelAllDelayed();
+
+protected:
+ struct callbackData {
+ Event userData;
+ std::string eventUUID;
+ bool persist;
+ struct event *event;
+ DelayedEventQueueImpl* eventQueue;
+ };
+
+ bool _isStarted;
+ std::thread* _thread;
+
+ std::map<std::string, callbackData> _callbackData;
+ struct event_base* _eventLoop;
+ struct event* _dummyEvent;
+
+ static void run(void* instance);
+ void start();
+ void stop();
+
+ static void timerCallback(evutil_socket_t fd, short what, void *arg);
+ DelayedEventQueueCallbacks* _callbacks;
+};
+
+class USCXML_API EventQueue {
+public:
+ PIMPL_OPERATORS(EventQueue)
+
+ virtual Event dequeue(bool blocking) {
+ return _impl->dequeue(blocking);
+ }
+ virtual void enqueue(const Event& event) {
+ return _impl->enqueue(event);
+ }
+
+protected:
+ std::shared_ptr<EventQueueImpl> _impl;
+
+};
+
+class USCXML_API DelayedEventQueue : public EventQueue {
+public:
+ PIMPL_OPERATORS2(DelayedEventQueue, EventQueue)
+
+ void enqueueDelayed(const Event& event, size_t delayMs, const std::string& eventUUID) {
+ _impl->enqueueDelayed(event, delayMs, eventUUID);
+ }
+ void cancelDelayed(const std::string& eventUUID) {
+ return _impl->cancelDelayed(eventUUID);
+ }
+
+ void cancelAllDelayed() {
+ return _impl->cancelAllDelayed();
+ }
+
+protected:
+ std::shared_ptr<DelayedEventQueueImpl> _impl;
+};
+
+}
+
+#endif /* end of include guard: EVENTSOURCE_H_775AB206 */
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
deleted file mode 100644
index 6084641..0000000
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ /dev/null
@@ -1,573 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "InterpreterDraft6.h"
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#include <glog/logging.h>
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-
-#define VERBOSE 0
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-// see: http://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation
-
-
-Arabica::XPath::NodeSet<std::string> InterpreterDraft6::removeConflictingTransitions(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- Arabica::XPath::NodeSet<std::string> filteredTransitions;
- for (unsigned int i = 0; i < enabledTransitions.size(); i++) {
- Element<std::string> t(enabledTransitions[i]);
- if (!isTargetless(t)) {
- for (unsigned int j = 0; j < filteredTransitions.size(); j++) {
- if (j == i)
- continue;
- Element<std::string> t2(filteredTransitions[j]);
- if (isPreemptingTransition(t2, t)) {
-#if 0
- std::cout << "#####" << std::endl << "Transition " << std::endl
- << t2 << std::endl << " preempts " << std::endl << t << std::endl << "#####" << std::endl;
-#endif
- goto LOOP;
- }
- }
- }
-#if 0
- std::cout << "----" << "Enabling Transition " << std::endl << t << std::endl;
-#endif
-
- filteredTransitions.push_back(t);
-LOOP:
- ;
- }
- return filteredTransitions;
-}
-
-
-
-/**
- * Is t1 preempting t2?
- */
-bool InterpreterDraft6::isPreemptingTransition(const Element<std::string>& t1, const Element<std::string>& t2) {
- assert(t1);
- assert(t2);
-
-#if 0
- std::cout << "Checking preemption: " << std::endl << t1 << std::endl << t2 << std::endl;
-#endif
-
- if (t1 == t2)
- return false;
- if (isTargetless(t1))
- return false; // targetless transitions do not preempt any other transitions
- if (isWithinParallel(t1) && isCrossingBounds(t2))
- return true; // transitions within a single child of <parallel> preempt transitions that cross child boundaries
- if (isCrossingBounds(t1))
- return true; // transitions that cross child boundaries preempt all other transitions
-
- return false;
-}
-
-bool InterpreterDraft6::isCrossingBounds(const Element<std::string>& transition) {
- if (!isTargetless(transition) && !isWithinParallel(transition))
- return true;
- return false;
-}
-
-bool InterpreterDraft6::isWithinParallel(const Element<std::string>& transition) {
- if (isTargetless(transition))
- return false;
-
- if (_transWithinParallel.find(transition) != _transWithinParallel.end())
- return _transWithinParallel[transition];
-
- Node<std::string> source;
- if (HAS_ATTR(transition, "type") && iequals(ATTR(transition, "type"), "internal")) {
- source = getSourceState(transition);
- } else {
- source = getSourceState(transition).getParentNode();
- }
- NodeSet<std::string> targets = getTargetStates(transition);
- targets.push_back(source);
-
- Node<std::string> lcpa = findLCPA(targets);
- _transWithinParallel[transition] = lcpa;
-
- return _transWithinParallel[transition];
-}
-
-Node<std::string> InterpreterDraft6::findLCPA(const Arabica::XPath::NodeSet<std::string>& states) {
- Arabica::XPath::NodeSet<std::string> ancestors = getProperAncestors(states[0], Node<std::string>());
- Node<std::string> ancestor;
- for (size_t i = 0; i < ancestors.size(); i++) {
- if (!isParallel(Element<std::string>(ancestors[i])))
- continue;
- for (size_t j = 0; j < states.size(); j++) {
- if (!isDescendant(states[j], ancestors[i]) && (states[j] != ancestors[i]))
- goto NEXT_ANCESTOR;
- }
- ancestor = ancestors[i];
- break;
-NEXT_ANCESTOR:
- ;
- }
- return ancestor;
-}
-
-
-
-void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- NodeSet<std::string> statesToExit;
-
-#if VERBOSE
- std::cout << _name << ": Enabled exit transitions: " << std::endl;
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- std::cout << enabledTransitions[i] << std::endl;
- }
- std::cout << std::endl;
-#endif
-
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- Element<std::string> t = ((Element<std::string>)enabledTransitions[i]);
- if (!isTargetless(t)) {
- Node<std::string> ancestor;
- Node<std::string> source = getSourceState(t);
-// std::cout << t << std::endl << TAGNAME(t) << std::endl;
- NodeSet<std::string> tStates = getTargetStates(t);
- bool isInternal = (HAS_ATTR(t, "type") && iequals(ATTR(t, "type"), "internal")); // external is default
- bool allDescendants = true;
- for (size_t j = 0; j < tStates.size(); j++) {
- if (!isDescendant(tStates[j], source)) {
- allDescendants = false;
- break;
- }
- }
- if (isInternal && allDescendants && isCompound(Element<std::string>(source))) {
- ancestor = source;
- } else {
- NodeSet<std::string> tmpStates;
- tmpStates.push_back(source);
- tmpStates.insert(tmpStates.end(), tStates.begin(), tStates.end());
-#if 0
- std::cout << _name << ": tmpStates: ";
- for (size_t i = 0; i < tmpStates.size(); i++) {
- std::cout << ATTR(tmpStates[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
- ancestor = findLCCA(tmpStates);
- }
-#if 0
- std::cout << _name << ": Ancestor: " << ATTR(ancestor, "id") << std::endl;;
-#endif
- for (size_t j = 0; j < _configuration.size(); j++) {
- if (isDescendant(_configuration[j], ancestor))
- statesToExit.push_back(_configuration[j]);
- }
- }
- }
- // remove statesToExit from _statesToInvoke
- std::list<Node<std::string> > tmp;
- for (size_t i = 0; i < _statesToInvoke.size(); i++) {
- if (!isMember(_statesToInvoke[i], statesToExit)) {
- tmp.push_back(_statesToInvoke[i]);
- }
- }
- _statesToInvoke = NodeSet<std::string>();
- _statesToInvoke.insert(_statesToInvoke.end(), tmp.begin(), tmp.end());
-
- statesToExit.forward(false);
- statesToExit.sort();
-
-#if 0
- std::cout << _name << ": States to exit: ";
- for (size_t i = 0; i < statesToExit.size(); i++) {
- std::cout << LOCALNAME(statesToExit[i]) << ":" << ATTR(statesToExit[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t i = 0; i < statesToExit.size(); i++) {
- NodeSet<std::string> histories = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", statesToExit[i]);
- for (size_t j = 0; j < histories.size(); j++) {
- Element<std::string> historyElem = (Element<std::string>)histories[j];
- std::string historyType = (historyElem.hasAttribute("type") ? historyElem.getAttribute("type") : "shallow");
- NodeSet<std::string> historyNodes;
- for (size_t k = 0; k < _configuration.size(); k++) {
- if (iequals(historyType, "deep")) {
- if (isAtomic(Element<std::string>(_configuration[k])) && isDescendant(_configuration[k], statesToExit[i]))
- historyNodes.push_back(_configuration[k]);
- } else {
- if (_configuration[k].getParentNode() == statesToExit[i])
- historyNodes.push_back(_configuration[k]);
- }
- }
- _historyValue[historyElem.getAttribute("id")] = historyNodes;
-#if VERBOSE
- std::cout << _name << ": History node " << ATTR(historyElem, "id") << " contains: ";
- for (size_t i = 0; i < historyNodes.size(); i++) {
- std::cout << ATTR_CAST(historyNodes[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- }
- }
-
- for (size_t i = 0; i < statesToExit.size(); i++) {
- USCXML_MONITOR_CALLBACK3(beforeExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size()))
-
- NodeSet<std::string> onExits = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onExit", statesToExit[i]);
- for (size_t j = 0; j < onExits.size(); j++) {
- Element<std::string> onExitElem = (Element<std::string>)onExits[j];
- executeContent(onExitElem);
- }
-
- USCXML_MONITOR_CALLBACK3(afterExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size()))
-
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", statesToExit[i]);
- for (size_t j = 0; j < invokes.size(); j++) {
- Element<std::string> invokeElem = (Element<std::string>)invokes[j];
- if (HAS_ATTR(invokeElem, "persist") && stringIsTrue(ATTR(invokeElem, "persist"))) {
- // extension for flattened SCXML documents, we will need an explicit uninvoke element
- } else {
- cancelInvoke(invokeElem);
- }
- }
-
- // remove statesToExit[i] from _configuration - test409
- tmp.clear();
- for (size_t j = 0; j < _configuration.size(); j++) {
- if (_configuration[j] != statesToExit[i]) {
- tmp.push_back(_configuration[j]);
- }
- }
- _configuration = NodeSet<std::string>();
- _configuration.insert(_configuration.end(), tmp.begin(), tmp.end());
- }
-}
-
-void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- NodeSet<std::string> statesToEnter;
- NodeSet<std::string> statesForDefaultEntry;
- // initialize the temporary table for default content in history states
- NodeSet<std::string> defaultHistoryContent;
-
-#if VERBOSE
- std::cout << _name << ": Enabled enter transitions: " << std::endl;
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- std::cout << "\t" << enabledTransitions[i] << std::endl;
- }
- std::cout << std::endl;
-#endif
-
- for (size_t i = 0; i < enabledTransitions.size(); i++) {
- Element<std::string> transition = ((Element<std::string>)enabledTransitions[i]);
- if (!isTargetless(transition)) {
- std::string transitionType = (iequals(transition.getAttribute("type"), "internal") ? "internal" : "external");
- NodeSet<std::string> tStates = getTargetStates(transition);
-
-#if VERBOSE
- std::cout << _name << ": Target States: ";
- for (size_t i = 0; i < tStates.size(); i++) {
- std::cout << ATTR_CAST(tStates[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- Node<std::string> ancestor;
- Node<std::string> source = getSourceState(transition);
-#if VERBOSE
- std::cout << _name << ": Source States: " << ATTR_CAST(source, "id") << std::endl;
-#endif
- assert(source);
-
- bool allDescendants = true;
- for (size_t j = 0; j < tStates.size(); j++) {
- if (!isDescendant(tStates[j], source)) {
- allDescendants = false;
- break;
- }
- }
- if (iequals(transitionType, "internal") &&
- isCompound(Element<std::string>(source)) &&
- allDescendants) {
- ancestor = source;
- } else {
- NodeSet<std::string> tmpStates;
- tmpStates.push_back(source);
- tmpStates.insert(tmpStates.end(), tStates.begin(), tStates.end());
-
- ancestor = findLCCA(tmpStates);
- }
-
-#if VERBOSE
- std::cout << _name << ": Ancestor: " << ATTR_CAST(ancestor, "id") << std::endl;
-#endif
-
- for (size_t j = 0; j < tStates.size(); j++) {
- addStatesToEnter(Element<std::string>(tStates[j]), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
-
-#if VERBOSE
- std::cout << _name << ": States to enter: ";
- for (size_t i = 0; i < statesToEnter.size(); i++) {
- std::cout << LOCALNAME(statesToEnter[i]) << ":" << ATTR_CAST(statesToEnter[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t j = 0; j < tStates.size(); j++) {
- NodeSet<std::string> ancestors = getProperAncestors(tStates[j], ancestor);
-
-#if VERBOSE
- std::cout << _name << ": Proper Ancestors of " << ATTR_CAST(tStates[j], "id") << " and " << ATTR_CAST(ancestor, "id") << ": ";
- for (size_t i = 0; i < ancestors.size(); i++) {
- std::cout << ATTR_CAST(ancestors[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t k = 0; k < ancestors.size(); k++) {
- statesToEnter.push_back(ancestors[k]);
- if(isParallel(Element<std::string>(ancestors[k]))) {
- NodeSet<std::string> childs = getChildStates(ancestors[k]);
- for (size_t l = 0; l < childs.size(); l++) {
- bool someIsDescendant = false;
- for (size_t m = 0; m < statesToEnter.size(); m++) {
- if (isDescendant(statesToEnter[m], childs[l])) {
- someIsDescendant = true;
- break;
- }
- }
- if (!someIsDescendant) {
- addStatesToEnter(Element<std::string>(childs[l]), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
- }
- }
- }
- }
- }
- }
- statesToEnter.to_document_order();
-
-#if VERBOSE
- std::cout << _name << ": States to enter: ";
- for (size_t i = 0; i < statesToEnter.size(); i++) {
- std::cout << ATTR_CAST(statesToEnter[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t i = 0; i < statesToEnter.size(); i++) {
- Element<std::string> stateElem = (Element<std::string>)statesToEnter[i];
-
- // extension for flattened interpreters
- for (unsigned int k = 0; k < statesToEnter.size(); k++) {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", statesToEnter[k]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- Element<std::string> invokeElem = Element<std::string>(invokes[j]);
- if (HAS_ATTR(invokeElem, "persist") && stringIsTrue(ATTR(invokeElem, "persist"))) {
- invoke(invokeElem);
- }
- }
- }
-
- USCXML_MONITOR_CALLBACK3(beforeEnteringState, stateElem, (i + 1 < statesToEnter.size()))
-
- // extension for flattened SCXML documents, we will need an explicit uninvoke element
- NodeSet<std::string> uninvokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "uninvoke", statesToEnter[i]);
- for (size_t j = 0; j < uninvokes.size(); j++) {
- Element<std::string> uninvokeElem = (Element<std::string>)uninvokes[j];
- cancelInvoke(uninvokeElem);
- }
-
- _configuration.push_back(stateElem);
- _statesToInvoke.push_back(stateElem);
-
- if (_binding == LATE && !isMember(stateElem, _alreadyEntered)) {
- NodeSet<std::string> dataModelElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", stateElem);
- if(dataModelElems.size() > 0 && _dataModel) {
- Arabica::XPath::NodeSet<std::string> dataElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", dataModelElems[0]);
- for (size_t j = 0; j < dataElems.size(); j++) {
- if (dataElems[j].getNodeType() == Node_base::ELEMENT_NODE)
- initializeData(Element<std::string>(dataElems[j]));
- }
- }
- _alreadyEntered.push_back(stateElem);
- }
- // execute onentry executable content
- NodeSet<std::string> onEntryElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onEntry", stateElem);
- executeContent(onEntryElems, false);
-
- USCXML_MONITOR_CALLBACK3(afterEnteringState, stateElem, (i + 1 < statesToEnter.size()))
-
- if (isMember(stateElem, statesForDefaultEntry)) {
- // execute initial transition content for compound states
- Arabica::XPath::NodeSet<std::string> transitions = _xpath.evaluate("" + _nsInfo.xpathPrefix + "initial/" + _nsInfo.xpathPrefix + "transition", stateElem).asNodeSet();
- for (size_t j = 0; j < transitions.size(); j++) {
- executeContent(Element<std::string>(transitions[j]));
- }
- }
-
-#if 0
- // not working yet
- if (isMember(stateElem, defaultHistoryContent)) {
- // execute history transition
- Arabica::XPath::NodeSet<std::string> transitions = _xpath.evaluate("" + _nsInfo.xpathPrefix + "history/" + _nsInfo.xpathPrefix + "transition", stateElem).asNodeSet();
- for (size_t j = 0; j < transitions.size(); j++) {
- executeContent(transitions[j]);
- }
- }
-#endif
- if (isFinal(stateElem)) {
-
- Arabica::DOM::Element<std::string> doneData;
- Arabica::XPath::NodeSet<std::string> doneDatas = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "donedata", stateElem);
- if (doneDatas.size() > 0) {
- // only process first donedata element
- doneData = Element<std::string>(doneDatas[0]);
- }
-
- internalDoneSend(stateElem, doneData);
- Node<std::string> parent = stateElem.getParentNode();
-
- if (parent.getNodeType() == Node_base::ELEMENT_NODE &&
- parent.getParentNode().getNodeType() == Node_base::ELEMENT_NODE &&
- isParallel(Element<std::string>(parent.getParentNode()))) {
- Element<std::string> grandParent = (Element<std::string>)parent.getParentNode();
-
- Arabica::XPath::NodeSet<std::string> childs = getChildStates(grandParent);
- bool inFinalState = true;
- for (size_t j = 0; j < childs.size(); j++) {
- if (!isInFinalState(Element<std::string>(childs[j]))) {
- inFinalState = false;
- break;
- }
- }
- if (inFinalState) {
- internalDoneSend(Element<std::string>(parent), Arabica::DOM::Element<std::string>());
- }
- }
- }
- }
- for (size_t i = 0; i < _configuration.size(); i++) {
- Element<std::string> stateElem = (Element<std::string>)_configuration[i];
- if (isFinal(stateElem) && parentIsScxmlState(stateElem)) {
- _topLevelFinalReached = true;
- }
- }
-}
-
-void InterpreterDraft6::addStatesToEnter(const Element<std::string>& state,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- Arabica::XPath::NodeSet<std::string>& defaultHistoryContent) {
- std::string stateId = ((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 (size_t i = 0; i < historyValue.size(); i++) {
- std::cout << ATTR_CAST(historyValue[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t i = 0; i < historyValue.size(); i++) {
- addStatesToEnter(Element<std::string>(historyValue[i]), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- NodeSet<std::string> ancestors = getProperAncestors(historyValue[i], state);
-
-#if VERBOSE
- std::cout << "Proper Ancestors: ";
- for (size_t j = 0; j < ancestors.size(); j++) {
- std::cout << ATTR_CAST(ancestors[j], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t j = 0; j < ancestors.size(); j++) {
- statesToEnter.push_back(ancestors[j]);
- }
- }
- } else {
- defaultHistoryContent.push_back(getParentState(state));
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state);
- for (size_t i = 0; i < transitions.size(); i++) {
- NodeSet<std::string> targets = getTargetStates(Element<std::string>(transitions[i]));
- for (size_t j = 0; j < targets.size(); j++) {
- addStatesToEnter(Element<std::string>(targets[j]), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
-
- // Modifications from chris nuernberger
- NodeSet<std::string> ancestors = getProperAncestors(targets[j], state);
- for (size_t k = 0; k < ancestors.size(); k++) {
- statesToEnter.push_back(ancestors[k]);
- }
- }
- }
- }
- } else {
- statesToEnter.push_back(state);
- if (isCompound(state)) {
- statesForDefaultEntry.push_back(state);
-
- NodeSet<std::string> tStates = getInitialStates(state);
- for (size_t i = 0; i < tStates.size(); i++) {
- addStatesToEnter(Element<std::string>(tStates[i]), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
-
- // addStatesToEnter(getInitialState(state), statesToEnter, statesForDefaultEntry);
- // NodeSet<std::string> tStates = getTargetStates(getInitialState(state));
-
- } else if(isParallel(state)) {
- NodeSet<std::string> childStates = getChildStates(state);
- for (size_t i = 0; i < childStates.size(); i++) {
- addStatesToEnter(Element<std::string>(childStates[i]), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
- }
- }
-}
-
-void InterpreterDraft6::handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event) {
- InterpreterImpl::handleDOMEvent(event);
-
- // remove modified states from cache
- if (event.getType().compare("DOMAttrModified") == 0) // we do not care about attributes
- return;
- Node<std::string> target = Arabica::DOM::Node<std::string>(event.getTarget());
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", target, true);
- for (size_t i = 0; i < transitions.size(); i++) {
- const Element<std::string> transElem = Element<std::string>(transitions[i]);
- if (_transWithinParallel.find(transElem) != _transWithinParallel.end())
- _transWithinParallel.erase(transElem);
- }
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/interpreter/InterpreterDraft6.h b/src/uscxml/interpreter/InterpreterDraft6.h
deleted file mode 100644
index 6a1275b..0000000
--- a/src/uscxml/interpreter/InterpreterDraft6.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef INTERPRETERDRAFT6_H_JAXK9FE1
-#define INTERPRETERDRAFT6_H_JAXK9FE1
-
-#include "uscxml/Interpreter.h"
-
-namespace uscxml {
-
-class USCXML_API InterpreterDraft6 : public InterpreterImpl {
-public:
- virtual ~InterpreterDraft6() {};
-
-protected:
-
- void enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- void addStatesToEnter(const Arabica::DOM::Element<std::string>& state,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- Arabica::XPath::NodeSet<std::string>& defaultHistoryContent);
-
- void exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
-
- Arabica::XPath::NodeSet<std::string> removeConflictingTransitions(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- bool isPreemptingTransition(const Arabica::DOM::Element<std::string>& t1, const Arabica::DOM::Element<std::string>& t2);
-
- bool isCrossingBounds(const Arabica::DOM::Element<std::string>& transition);
- bool isWithinParallel(const Arabica::DOM::Element<std::string>& transition);
- Arabica::DOM::Node<std::string> findLCPA(const Arabica::XPath::NodeSet<std::string>& states);
-
- std::map<Arabica::DOM::Element<std::string>, bool> _transWithinParallel; // this is costly to calculate
-
- virtual void handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event);
-
-};
-
-}
-
-#endif /* end of include guard: INTERPRETERDRAFT6_H_JAXK9FE1 */
diff --git a/src/uscxml/interpreter/InterpreterFast.cpp b/src/uscxml/interpreter/InterpreterFast.cpp
deleted file mode 100644
index ab5dce0..0000000
--- a/src/uscxml/interpreter/InterpreterFast.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file
- * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "InterpreterFast.h"
-
-#include "uscxml/Factory.h"
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#include <glog/logging.h>
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-
-void InterpreterFast::handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event) {
- InterpreterImpl::handleDOMEvent(event);
-
- if (event.getType().compare("DOMAttrModified") == 0) // we do not care about attributes
- return;
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/interpreter/InterpreterFast.h b/src/uscxml/interpreter/InterpreterFast.h
deleted file mode 100644
index 5838dc0..0000000
--- a/src/uscxml/interpreter/InterpreterFast.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @file
- * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef INTERPRETERFAST_H_224A5F07
-#define INTERPRETERFAST_H_224A5F07
-
-#include "uscxml/Interpreter.h"
-
-namespace uscxml {
-
-class InterpreterFast : public InterpreterImpl {
-protected:
- virtual void setupSets();
- virtual void handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event);
-
-private:
-
- /* TODO: use post-order and document-order per STL comparator (sorted std::set?) */
-
- std::vector<Arabica::XPath::NodeSet<std::string> > _states;
- std::vector<Arabica::XPath::NodeSet<std::string> > _transitions;
-
- std::vector<std::vector<bool> > _conflictingTransitions;
- std::vector<std::vector<bool> > _exitSets;
- std::vector<std::vector<bool> > _targetSets;
-
-};
-
-}
-
-#endif /* end of include guard: INTERPRETERFAST_H_224A5F07 */
diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp
new file mode 100644
index 0000000..ba75ab8
--- /dev/null
+++ b/src/uscxml/interpreter/InterpreterImpl.cpp
@@ -0,0 +1,361 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include "uscxml/Common.h"
+#include "uscxml/util/UUID.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/util/String.h"
+#include "uscxml/util/Predicates.h"
+
+#include "easylogging++.h"
+
+#include <iostream>
+
+#include <assert.h>
+#include <algorithm>
+#include <memory>
+#include <mutex>
+
+#include "uscxml/interpreter/MicroStepFast.h"
+
+#define VERBOSE 0
+
+namespace uscxml {
+
+using namespace xercesc;
+
+std::map<std::string, std::weak_ptr<InterpreterImpl> > InterpreterImpl::_instances;
+std::recursive_mutex InterpreterImpl::_instanceMutex;
+
+std::map<std::string, std::weak_ptr<InterpreterImpl> > InterpreterImpl::getInstances() {
+ std::lock_guard<std::recursive_mutex> lock(_instanceMutex);
+ std::map<std::string, std::weak_ptr<InterpreterImpl> >::iterator instIter = _instances.begin();
+ while(instIter != _instances.end()) {
+ if (!instIter->second.lock()) {
+ _instances.erase(instIter++);
+ } else {
+ instIter++;
+ }
+ }
+ return _instances;
+}
+
+void InterpreterImpl::addInstance(std::shared_ptr<InterpreterImpl> interpreterImpl) {
+ std::lock_guard<std::recursive_mutex> lock(_instanceMutex);
+ assert(_instances.find(interpreterImpl->getSessionId()) == _instances.end());
+ _instances[interpreterImpl->getSessionId()] = interpreterImpl;
+}
+
+InterpreterImpl::InterpreterImpl() : _isInitialized(false), _document(NULL), _scxml(NULL), _state(USCXML_INSTANTIATED), _monitor(NULL) {
+ try {
+ xercesc::XMLPlatformUtils::Initialize();
+ } catch (const xercesc::XMLException& toCatch) {
+ ERROR_PLATFORM_THROW("Cannot initialize XercesC: " + X(toCatch.getMessage()).str());
+ }
+
+ _sessionId = UUID::getUUID();
+ _factory = Factory::getInstance();
+}
+
+
+InterpreterImpl::~InterpreterImpl() {
+ if (_delayQueue)
+ _delayQueue.cancelAllDelayed();
+ if (_document)
+ delete _document;
+ {
+ std::lock_guard<std::recursive_mutex> lock(_instanceMutex);
+ _instances.erase(getSessionId());
+ }
+}
+
+void InterpreterImpl::cancel() {
+ _microStepper.markAsCancelled();
+ Event unblock;
+ enqueueExternal(unblock);
+}
+
+
+void InterpreterImpl::setupDOM() {
+
+ if (!_document) {
+ ERROR_PLATFORM_THROW("Interpreter has no XML document");
+ }
+
+ if (!_scxml) {
+ // find scxml element
+ DOMNodeList* scxmls = NULL;
+
+ // proper namespace
+ scxmls = _document->getElementsByTagNameNS(X("http://www.w3.org/2005/07/scxml"), X("scxml"));
+ if (scxmls->getLength() > 0)
+ goto SCXML_STOP_SEARCH;
+
+ // no namespace
+ scxmls = _document->getElementsByTagName(X("scxml"));
+ if (scxmls->getLength() > 0)
+ goto SCXML_STOP_SEARCH;
+
+SCXML_STOP_SEARCH:
+ if (scxmls->getLength() == 0) {
+ ERROR_PLATFORM_THROW("Cannot find SCXML element in DOM");
+ return;
+ }
+
+ _scxml = dynamic_cast<DOMElement*>(scxmls->item(0));
+
+ _xmlPrefix = _scxml->getPrefix();
+ _xmlNS = _scxml->getNamespaceURI();
+ if (_xmlPrefix) {
+ _xmlPrefix = std::string(_xmlPrefix) + ":";
+ }
+ if (HAS_ATTR(_scxml, "name")) {
+ _name = ATTR(_scxml, "name");
+ } else {
+ _name = _baseURL.pathComponents().back();
+ }
+
+ _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
+
+ }
+
+}
+
+void InterpreterImpl::init() {
+
+ if (_isInitialized)
+ return;
+
+ setupDOM();
+
+ // register io processors
+ std::map<std::string, IOProcessorImpl*> ioProcs = _factory->getIOProcessors();
+ for (auto ioProcIter = ioProcs.begin(); ioProcIter != ioProcs.end(); ioProcIter++) {
+
+ // do not override if already set
+ if (_ioProcs.find(ioProcIter->first) != _ioProcs.end()) {
+ ioProcIter++;
+ continue;
+ }
+
+ // this might throw error.execution
+ _ioProcs[ioProcIter->first] = _factory->createIOProcessor(ioProcIter->first, this);
+
+ // register aliases
+ std::list<std::string> names = _ioProcs[ioProcIter->first].getNames();
+ for (auto nameIter = names.begin(); nameIter != names.end(); nameIter++) {
+ // do not override
+ if (!iequals(*nameIter, ioProcIter->first) && _ioProcs.find(*nameIter) == _ioProcs.end()) {
+ _ioProcs[*nameIter] = _ioProcs[ioProcIter->first];
+ }
+ }
+
+ }
+
+ if (!_microStepper) {
+ _microStepper = MicroStep(std::shared_ptr<MicroStepImpl>(new MicroStepFast(this)));
+ }
+ _microStepper.init(_scxml);
+
+ if (!_dataModel) {
+ _dataModel = _factory->createDataModel(HAS_ATTR(_scxml, "datamodel") ? ATTR(_scxml, "datamodel") : "null", this);
+ }
+ if (!_execContent) {
+ _execContent = ContentExecutor(std::shared_ptr<ContentExecutorImpl>(new BasicContentExecutorImpl(this)));
+ }
+
+ if (!_externalQueue) {
+ _externalQueue = EventQueue(std::shared_ptr<EventQueueImpl>(new EventQueueImpl()));
+ }
+ if (!_internalQueue) {
+ _internalQueue = EventQueue(std::shared_ptr<EventQueueImpl>(new EventQueueImpl()));
+ }
+ if (!_delayQueue) {
+ _delayQueue = DelayedEventQueue(std::shared_ptr<DelayedEventQueueImpl>(new DelayedEventQueueImpl(this)));
+ }
+
+ _isInitialized = true;
+}
+
+void InterpreterImpl::initData(xercesc::DOMElement* root) {
+ std::string id = ATTR(root, "id");
+ Data d;
+ try {
+ if (Event::getParam(_invokeReq.params, id, d)) {
+ _dataModel.init(id, d);
+ } else if (_invokeReq.namelist.find(id) != _invokeReq.namelist.end()) {
+ _dataModel.init(id, _invokeReq.namelist[id]);
+ } else {
+ _dataModel.init(id, _execContent.elementAsData(root));
+ }
+ } catch(ErrorEvent e) {
+ // test 277
+ enqueueInternal(e);
+ }
+}
+
+void InterpreterImpl::assign(const std::string& location, const Data& data) {
+ _dataModel.assign(location, data);
+}
+
+bool InterpreterImpl::isMatched(const Event& event, const std::string& eventDesc) {
+ return nameMatch(eventDesc, event.name);
+}
+
+bool InterpreterImpl::isTrue(const std::string& expr) {
+ try {
+ return _dataModel.evalAsBool(expr);
+ } catch (ErrorEvent e) {
+ // test 244: deliver error execution
+
+ LOG(ERROR) << e;
+
+ // test 344
+ enqueueInternal(e);
+ // test 245: undefined is false
+ return false;
+
+ }
+}
+
+
+bool InterpreterImpl::checkValidSendType(const std::string& type, const std::string& target) {
+
+ // this is the responsibility of the calling method
+ assert(type.size() > 0);
+
+ if (_ioProcs.find(type) == _ioProcs.end()) {
+ ERROR_EXECUTION_THROW("Type '" + type + "' not supported for sending");
+ }
+
+ if (!_ioProcs[type].isValidTarget(target)) {
+ ERROR_COMMUNICATION_THROW("Target '" + target + "' not supported in send");
+ }
+
+ return true;
+}
+
+Event InterpreterImpl::dequeueExternal(bool blocking) {
+ _currEvent = _externalQueue.dequeue(blocking);
+ if (_currEvent) {
+ _dataModel.setEvent(_currEvent);
+
+// LOG(ERROR) << e.name;
+
+ // test 233
+ if (_currEvent.invokeid.size() > 0 &&
+ _invokers.find(_currEvent.invokeid) != _invokers.end() &&
+ _invokers[_currEvent.invokeid].getFinalize() != NULL) {
+ _execContent.process(_invokers[_currEvent.invokeid].getFinalize(), _xmlPrefix);
+ }
+
+ for (auto invIter = _invokers.begin(); invIter != _invokers.end(); invIter++) {
+ // test 229
+ if (_autoForwarders.find(invIter->first) != _autoForwarders.end()) {
+ invIter->second.eventFromSCXML(_currEvent);
+ }
+ }
+ }
+ return _currEvent;
+}
+
+void InterpreterImpl::enqueue(const std::string& type, const std::string& target, size_t delayMs, const Event& sendEvent) {
+ std::lock_guard<std::recursive_mutex> lock(_delayMutex);
+
+ assert(sendEvent.uuid.length() > 0);
+ assert(_delayedEventTargets.find(sendEvent.uuid) == _delayedEventTargets.end());
+
+ _delayedEventTargets[sendEvent.uuid] = std::tuple<std::string, std::string, std::string>(sendEvent.sendid, type, target);
+ if (delayMs == 0) {
+ Event copy(sendEvent);
+ return eventReady(copy, sendEvent.uuid);
+ } else {
+ return _delayQueue.enqueueDelayed(sendEvent, delayMs, sendEvent.uuid);
+ }
+}
+
+void InterpreterImpl::cancelDelayed(const std::string& sendId) {
+ std::lock_guard<std::recursive_mutex> lock(_delayMutex);
+
+ // we need to find the uuids for the given sendid
+ for (auto evIter = _delayedEventTargets.begin(); evIter != _delayedEventTargets.end();) {
+ // inline deletion for maps: http://stackoverflow.com/a/263958/990120
+ if (std::get<0>(evIter->second) == sendId) {
+ _delayQueue.cancelDelayed(evIter->first);
+ evIter = _delayedEventTargets.erase(evIter);
+ } else {
+ evIter++;
+ }
+ }
+}
+
+void InterpreterImpl::eventReady(Event& sendEvent, const std::string& eventUUID) {
+ std::lock_guard<std::recursive_mutex> lock(_delayMutex);
+
+ // we only arrive here after the delay already passed!
+ assert(_delayedEventTargets.find(eventUUID) != _delayedEventTargets.end());
+
+ std::string type = std::get<1>(_delayedEventTargets[eventUUID]);
+ std::string target = std::get<2>(_delayedEventTargets[eventUUID]);
+
+ // test 172
+ if (type.size() == 0) {
+ type = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor";
+ }
+
+ _delayedEventTargets.erase(eventUUID);
+
+ if (_ioProcs.find(type) != _ioProcs.end()) {
+ _ioProcs[type].eventFromSCXML(target, sendEvent);
+ } else {
+ ERROR_PLATFORM_THROW("No IO processor " + type + " known");
+ }
+}
+
+void InterpreterImpl::invoke(const std::string& type, const std::string& src, bool autoForward, xercesc::DOMElement* finalize, const Event& invokeEvent) {
+
+ std::string tmp;
+ if (src.size() > 0) {
+ URL url(src);
+ if (!url.isAbsolute()) {
+ url = URL::resolve(url, _baseURL);
+ }
+ tmp = (std::string)url;
+ }
+
+ std::shared_ptr<InvokerImpl> invokerImpl = _factory->createInvoker(type, this);
+ invokerImpl->setFinalize(finalize);
+ _invokers[invokeEvent.invokeid] = invokerImpl;
+ _invokers[invokeEvent.invokeid].invoke(tmp, invokeEvent);
+
+ if (autoForward) {
+ _autoForwarders.insert(invokeEvent.invokeid);
+ }
+}
+
+void InterpreterImpl::uninvoke(const std::string& invokeId) {
+ if (_invokers.find(invokeId) != _invokers.end()) {
+ _invokers[invokeId].uninvoke();
+ _autoForwarders.erase(invokeId);
+ }
+
+}
+
+}
diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h
new file mode 100644
index 0000000..7c64779
--- /dev/null
+++ b/src/uscxml/interpreter/InterpreterImpl.h
@@ -0,0 +1,290 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef INTERPRETERIMPL_H_29D5BEBA
+#define INTERPRETERIMPL_H_29D5BEBA
+
+#include <memory>
+#include <mutex>
+#include <list>
+#include <map>
+#include <string>
+
+#include "uscxml/Common.h"
+#include "uscxml/util/URL.h"
+#include "uscxml/plugins/Factory.h"
+#include "uscxml/plugins/DataModel.h"
+#include "uscxml/interpreter/MicroStepImpl.h"
+#include "uscxml/interpreter/ContentExecutorImpl.h"
+#include "uscxml/interpreter/EventQueueImpl.h"
+#include "uscxml/util/DOM.h"
+#include <xercesc/dom/DOM.hpp>
+
+namespace uscxml {
+
+class InterpreterMonitor;
+class InterpreterIssue;
+
+class USCXML_API ActionLanguage {
+public:
+ MicroStep microStepper;
+ DataModel dataModel;
+ ContentExecutor execContent;
+};
+
+class USCXML_API InterpreterImpl :
+ public MicroStepCallbacks,
+ public DataModelCallbacks,
+ public ContentExecutorCallbacks,
+ public DelayedEventQueueCallbacks
+// public std::enable_shared_from_this<InterpreterImpl>
+{
+public:
+ enum Binding {
+ EARLY = 0,
+ LATE = 1
+ };
+
+ InterpreterImpl();
+ virtual ~InterpreterImpl();
+
+ void cloneFrom(InterpreterImpl* other);
+ void cloneFrom(std::shared_ptr<InterpreterImpl> other);
+
+ virtual InterpreterState step(bool blocking) {
+ if (!_isInitialized) {
+ init();
+ _state = USCXML_INITIALIZED;
+ } else {
+ _state = _microStepper.step(blocking);
+ }
+ return _state;
+ }
+
+ virtual void reset() {///< Reset state machine
+ _microStepper.reset();
+ _isInitialized = false;
+ _state = USCXML_INSTANTIATED;
+// _dataModel.reset();
+// _eventQueue.reset();
+// _contentExecutor.reset();
+ }
+
+ virtual void cancel(); ///< Cancel and finalize state machine
+
+ InterpreterState getState() {
+ return _state;
+ }
+
+ std::list<xercesc::DOMElement*> getConfiguration() {
+ return _microStepper.getConfiguration();
+ }
+
+ void setMonitor(InterpreterMonitor* monitor) {
+ _monitor = monitor;
+ }
+
+ /**
+ MicrostepCallbacks
+ */
+ virtual Event dequeueInternal() {
+ _currEvent = _internalQueue.dequeue(false);
+ if (_currEvent)
+ _dataModel.setEvent(_currEvent);
+ return _currEvent;
+ }
+ virtual Event dequeueExternal(bool blocking);
+ virtual bool isTrue(const std::string& expr);
+
+ virtual void raiseDoneEvent(xercesc::DOMElement* state, xercesc::DOMElement* doneData) {
+ _execContent.raiseDoneEvent(state, doneData);
+ }
+
+ virtual void process(xercesc::DOMElement* block) {
+ _execContent.process(block, _xmlPrefix);
+ }
+
+ virtual bool isMatched(const Event& event, const std::string& eventDesc);
+ virtual void initData(xercesc::DOMElement* element);
+
+ virtual void invoke(xercesc::DOMElement* invoke) {
+ _execContent.invoke(invoke);
+ }
+
+ virtual void uninvoke(xercesc::DOMElement* invoke) {
+ _execContent.uninvoke(invoke);
+ }
+
+ virtual InterpreterMonitor* getMonitor() {
+ return _monitor;
+ }
+
+ /**
+ DataModelCallbacks
+ */
+ virtual const std::string& getName() {
+ return _name;
+ }
+ virtual const std::string& getSessionId() {
+ return _sessionId;
+ }
+ virtual const std::map<std::string, IOProcessor>& getIOProcessors() {
+ return _ioProcs;
+ }
+ virtual const std::map<std::string, Invoker>& getInvokers() {
+ return _invokers;
+ }
+
+ virtual bool isInState(const std::string& stateId) {
+ return _microStepper.isInState(stateId);
+ }
+ virtual xercesc::DOMDocument* getDocument() const {
+ return _document;
+ }
+
+ /**
+ ContentExecutorCallbacks
+ */
+
+ virtual void enqueueInternal(const Event& event) {
+ return _internalQueue.enqueue(event);
+ }
+ virtual void enqueueExternal(const Event& event) {
+ return _externalQueue.enqueue(event);
+ }
+ virtual void enqueueExternalDelayed(const Event& event, size_t delayMs, const std::string& eventUUID) {
+ return _delayQueue.enqueueDelayed(event, delayMs, eventUUID);
+ }
+ virtual void cancelDelayed(const std::string& eventId);
+
+ virtual size_t getLength(const std::string& expr) {
+ return _dataModel.getLength(expr);
+ }
+
+ virtual void setForeach(const std::string& item,
+ const std::string& array,
+ const std::string& index,
+ uint32_t iteration) {
+ return _dataModel.setForeach(item, array, index, iteration);
+ }
+ virtual Data evalAsData(const std::string& expr) {
+ return _dataModel.evalAsData(expr);
+ }
+
+ virtual Data getAsData(const std::string& expr) {
+ return _dataModel.getAsData(expr);
+ }
+
+ virtual void assign(const std::string& location, const Data& data);
+
+ virtual std::string getInvokeId() {
+ return _invokeId;
+ }
+ virtual std::string getBaseURL() {
+ return _baseURL;
+ }
+
+ virtual bool checkValidSendType(const std::string& type, const std::string& target);
+ virtual void invoke(const std::string& type, const std::string& src, bool autoForward, xercesc::DOMElement* finalize, const Event& invokeEvent);
+ virtual void uninvoke(const std::string& invokeId);
+ virtual void enqueue(const std::string& type, const std::string& target, size_t delayMs, const Event& sendEvent);
+
+ virtual const Event& getCurrentEvent() {
+ return _currEvent;
+ }
+
+ /**
+ DelayedEventQueueCallbacks
+ */
+
+ virtual void eventReady(Event& event, const std::string& eventUUID);
+
+ /** --- */
+
+ void setActionLanguage(const ActionLanguage& al) {
+ _execContent = al.execContent;
+ _microStepper = al.microStepper;
+ _dataModel = al.dataModel;
+ }
+
+ static std::map<std::string, std::weak_ptr<InterpreterImpl> > getInstances();
+
+ virtual xercesc::DOMDocument* getDocument() {
+ return _document;
+ }
+
+protected:
+ static void addInstance(std::shared_ptr<InterpreterImpl> instance);
+
+ Binding _binding;
+
+ std::string _sessionId;
+ std::string _name;
+ std::string _invokeId; // TODO: Never set!
+
+ bool _isInitialized;
+ xercesc::DOMDocument* _document;
+ xercesc::DOMElement* _scxml;
+
+ std::map<std::string, std::tuple<std::string, std::string, std::string> > _delayedEventTargets;
+
+ virtual void init();
+
+ static std::map<std::string, std::weak_ptr<InterpreterImpl> > _instances;
+ static std::recursive_mutex _instanceMutex;
+ std::recursive_mutex _delayMutex;
+
+ friend class Interpreter;
+ friend class InterpreterIssue;
+ friend class TransformerImpl;
+ friend class USCXMLInvoker;
+ friend class SCXMLIOProcessor;
+
+ X _xmlPrefix;
+ X _xmlNS;
+ Factory* _factory;
+
+ URL _baseURL;
+
+ MicroStep _microStepper;
+ DataModel _dataModel;
+ ContentExecutor _execContent;
+
+ InterpreterState _state;
+
+ EventQueue _internalQueue;
+ EventQueue _externalQueue;
+ EventQueue _parentQueue;
+ DelayedEventQueue _delayQueue;
+
+ Event _currEvent;
+ Event _invokeReq;
+
+ std::map<std::string, IOProcessor> _ioProcs;
+ std::map<std::string, Invoker> _invokers;
+ std::set<std::string> _autoForwarders;
+ InterpreterMonitor* _monitor;
+
+private:
+ void setupDOM();
+};
+
+}
+
+#endif /* end of include guard: INTERPRETERIMPL_H_29D5BEBA */
diff --git a/src/uscxml/interpreter/InterpreterMonitor.h b/src/uscxml/interpreter/InterpreterMonitor.h
new file mode 100644
index 0000000..6ebdb35
--- /dev/null
+++ b/src/uscxml/interpreter/InterpreterMonitor.h
@@ -0,0 +1,95 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef INTERPRETERMONITOR_H_4BA77097
+#define INTERPRETERMONITOR_H_4BA77097
+
+#include "uscxml/Common.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/debug/InterpreterIssue.h"
+
+#include <mutex>
+
+#define USCXML_MONITOR_CATCH(callback) \
+catch (Event e) { LOG(ERROR) << "Syntax error when calling " #callback " on monitors: " << std::endl << e << std::endl; } \
+catch (std::bad_weak_ptr e) { LOG(ERROR) << "Unclean shutdown " << std::endl; } \
+catch (...) { LOG(ERROR) << "An exception occurred when calling " #callback " on monitors"; } \
+if (_state == USCXML_DESTROYED) { throw std::bad_weak_ptr(); }
+
+#define USCXML_MONITOR_CALLBACK(callback, function) \
+if (callback) { callback->function(); }
+
+#define USCXML_MONITOR_CALLBACK1(callback, function, arg1) \
+if (callback) { callback->function(arg1); }
+
+#define USCXML_MONITOR_CALLBACK2(callback, function, arg1, arg2) \
+if (callback) { callback->function(arg1, arg2); }
+
+namespace uscxml {
+
+class USCXML_API InterpreterMonitor {
+public:
+ InterpreterMonitor() : _copyToInvokers(false) {}
+ virtual ~InterpreterMonitor() {}
+
+ virtual void beforeProcessingEvent(const Event& event) {}
+ virtual void beforeMicroStep() {}
+
+ virtual void beforeExitingState(const xercesc::DOMElement* state) {}
+ virtual void afterExitingState(const xercesc::DOMElement* state) {}
+
+ virtual void beforeExecutingContent(const xercesc::DOMElement* execContent) {}
+ virtual void afterExecutingContent(const xercesc::DOMElement* execContent) {}
+
+ virtual void beforeUninvoking(const xercesc::DOMElement* invokeElem, const std::string& invokeid) {}
+ virtual void afterUninvoking(const xercesc::DOMElement* invokeElem, const std::string& invokeid) {}
+
+ virtual void beforeTakingTransition(const xercesc::DOMElement* transition) {}
+ virtual void afterTakingTransition(const xercesc::DOMElement* transition) {}
+
+ virtual void beforeEnteringState(const xercesc::DOMElement* state) {}
+ virtual void afterEnteringState(const xercesc::DOMElement* state) {}
+
+ virtual void beforeInvoking(const xercesc::DOMElement* invokeElem, const std::string& invokeid) {}
+ virtual void afterInvoking(const xercesc::DOMElement* invokeElem, const std::string& invokeid) {}
+
+ virtual void afterMicroStep() {}
+ virtual void onStableConfiguration() {}
+
+ virtual void beforeCompletion() {}
+ virtual void afterCompletion() {}
+
+ virtual void reportIssue(const InterpreterIssue& issue) {}
+
+ void copyToInvokers(bool copy) {
+ _copyToInvokers = copy;
+ }
+
+ bool copyToInvokers() {
+ return _copyToInvokers;
+ }
+
+protected:
+ bool _copyToInvokers;
+
+};
+
+}
+
+#endif /* end of include guard: INTERPRETERMONITOR_H_4BA77097 */
diff --git a/src/uscxml/interpreter/InterpreterRC.cpp b/src/uscxml/interpreter/InterpreterRC.cpp
deleted file mode 100644
index b594c18..0000000
--- a/src/uscxml/interpreter/InterpreterRC.cpp
+++ /dev/null
@@ -1,661 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "InterpreterRC.h"
-
-#include "uscxml/Factory.h"
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#include <glog/logging.h>
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-
-#define VERBOSE 0
-#define VERBOSE_STATE_SELECTION 0
-#define VERBOSE_FIND_LCCA 0
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-#if 1
-size_t padding = 0;
-std::string getPadding() {
- std::string pad = "";
- for (size_t i = 0; i < padding; i++) {
- pad += " ";
- }
- return pad;
-}
-#endif
-
-Arabica::XPath::NodeSet<std::string> InterpreterRC::removeConflictingTransitions(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- Arabica::XPath::NodeSet<std::string> filteredTransitions;
- for (unsigned int i = 0; i < enabledTransitions.size(); i++) {
- Element<std::string> t1(enabledTransitions[i]);
- bool t1Preempted = false;
- Arabica::XPath::NodeSet<std::string> transitionsToRemove;
-
- for (unsigned int j = 0; j < filteredTransitions.size(); j++) {
- Element<std::string> t2(filteredTransitions[j]);
- if (hasIntersection(computeExitSet(t1), computeExitSet(t2))) {
- if (isDescendant(getSourceState(t1), getSourceState(t2))) {
- transitionsToRemove.push_back(t2);
- } else {
- t1Preempted = true;
- break;
- }
- }
- }
-
- if (!t1Preempted) {
- // remove transitionsToRemove from DOMUtils::filteredTransitions
- std::list<Node<std::string> > tmp;
- for (size_t i = 0; i < filteredTransitions.size(); i++) {
- if (!isMember(filteredTransitions[i], transitionsToRemove)) {
- tmp.push_back(filteredTransitions[i]);
- }
- }
- filteredTransitions = NodeSet<std::string>();
- filteredTransitions.insert(filteredTransitions.end(), tmp.begin(), tmp.end());
-
- filteredTransitions.push_back(t1);
- }
- }
- return filteredTransitions;
-}
-
-bool InterpreterRC::hasIntersection(const Arabica::XPath::NodeSet<std::string>& nodeSet1, const Arabica::XPath::NodeSet<std::string>& nodeSet2) {
- for (unsigned int i = 0; i < nodeSet1.size(); i++) {
- for (unsigned int j = 0; j < nodeSet2.size(); j++) {
- if (nodeSet1[i] == nodeSet2[j])
- return true;
- }
- }
- return false;
-}
-
-
-void InterpreterRC::exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- NodeSet<std::string> statesToExit = computeExitSet(enabledTransitions);
-
-#if VERBOSE_STATE_SELECTION
- std::cout << "exitStates: ";
- for (size_t i = 0; i < statesToExit.size(); i++) {
- std::cout << ATTR_CAST(statesToExit[i], "id") << " ";
- }
- std::cout << std::endl;
-#endif
-
- // remove statesToExit from _statesToInvoke
- std::list<Node<std::string> > tmp;
- for (size_t i = 0; i < _statesToInvoke.size(); i++) {
- if (!isMember(_statesToInvoke[i], statesToExit)) {
- tmp.push_back(_statesToInvoke[i]);
- }
- }
- _statesToInvoke = NodeSet<std::string>();
- _statesToInvoke.insert(_statesToInvoke.end(), tmp.begin(), tmp.end());
-
- statesToExit.forward(false);
- statesToExit.sort();
-
-
- for (size_t i = 0; i < statesToExit.size(); i++) {
- NodeSet<std::string> histories = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", statesToExit[i]);
- for (size_t j = 0; j < histories.size(); j++) {
- Element<std::string> historyElem = (Element<std::string>)histories[j];
- std::string historyType = (historyElem.hasAttribute("type") ? historyElem.getAttribute("type") : "shallow");
- NodeSet<std::string> historyNodes;
- for (size_t k = 0; k < _configuration.size(); k++) {
- if (iequals(historyType, "deep")) {
- if (isAtomic(Element<std::string>(_configuration[k])) && isDescendant(_configuration[k], statesToExit[i]))
- historyNodes.push_back(_configuration[k]);
- } else {
- if (_configuration[k].getParentNode() == statesToExit[i])
- historyNodes.push_back(_configuration[k]);
- }
- }
- _historyValue[historyElem.getAttribute("id")] = historyNodes;
- }
- }
-
- for (size_t i = 0; i < statesToExit.size(); i++) {
- USCXML_MONITOR_CALLBACK3(beforeExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size()))
-
- NodeSet<std::string> onExits = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onExit", statesToExit[i]);
- for (size_t j = 0; j < onExits.size(); j++) {
- Element<std::string> onExitElem = (Element<std::string>)onExits[j];
- executeContent(onExitElem);
- }
-
- USCXML_MONITOR_CALLBACK3(afterExitingState, Element<std::string>(statesToExit[i]), (i + 1 < statesToExit.size()))
-
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", statesToExit[i]);
- for (size_t j = 0; j < invokes.size(); j++) {
- Element<std::string> invokeElem = (Element<std::string>)invokes[j];
- if (HAS_ATTR(invokeElem, "persist") && stringIsTrue(ATTR(invokeElem, "persist"))) {
- } else {
- cancelInvoke(invokeElem);
- }
- }
-
- // remove statesToExit[i] from _configuration - test409
- tmp.clear();
- for (size_t j = 0; j < _configuration.size(); j++) {
- if (_configuration[j] != statesToExit[i]) {
- tmp.push_back(_configuration[j]);
- }
- }
- _configuration = NodeSet<std::string>();
- _configuration.insert(_configuration.end(), tmp.begin(), tmp.end());
- }
-}
-
-/*
-function computeExitSet(transitions)
- statesToExit = new OrderedSet
- for t in transitions:
- if(t.target):
- domain = getTransitionDomain(t)
- for s in configuration:
- if isDescendant(s,domain):
- statesToExit.add(s)
- return statesToExit
-*/
-Arabica::XPath::NodeSet<std::string> InterpreterRC::computeExitSet(const Arabica::XPath::NodeSet<std::string>& transitions) {
-
- NodeSet<std::string> statesToExit;
- for (unsigned int i = 0; i < transitions.size(); i++) {
- Element<std::string> t(transitions[i]);
- if (!isTargetless(t)) {
- Arabica::DOM::Node<std::string> domain = getTransitionDomain(t);
- if (!domain)
- continue;
- for (unsigned int j = 0; j < _configuration.size(); j++) {
- const Node<std::string>& s = _configuration[j];
- if (isDescendant(s, domain)) {
- statesToExit.push_back(s);
- }
- }
- }
- }
-#if VERBOSE
- std::cout << "computeExitSet: ";
- for (size_t i = 0; i < statesToExit.size(); i++) {
- std::cout << ATTR_CAST(statesToExit[i], "id") << " ";
- }
- std::cout << std::endl;
-#endif
-
- return statesToExit;
-}
-
-Arabica::XPath::NodeSet<std::string> InterpreterRC::computeExitSet(const Arabica::DOM::Node<std::string>& transition) {
-// if (_exitSet.find(transition) != _exitSet.end()) // speed up removeConflicting
-// return _exitSet[transition];
-
- Arabica::XPath::NodeSet<std::string> transitions;
- transitions.push_back(transition);
-
- Arabica::XPath::NodeSet<std::string> exitSet = computeExitSet(transitions);
- //_exitSet[transition] = exitSet;
-
-#if 0
- std::cerr << "Exit set for transition '" << transition << "': " << std::endl;
- for (size_t i = 0; i < exitSet.size(); i++) {
- std::cerr << ATTR_CAST(exitSet[i], "id") << std::endl << "----" << std::endl;
- }
- std::cerr << std::endl;
-#endif
- return exitSet;
-}
-
-void InterpreterRC::enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- NodeSet<std::string> statesToEnter;
- NodeSet<std::string> statesForDefaultEntry;
- // initialize the temporary table for default content in history states
- std::map<std::string, Arabica::DOM::Node<std::string> > defaultHistoryContent;
-
- computeEntrySet(enabledTransitions, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- statesToEnter.to_document_order();
-
-#if VERBOSE_STATE_SELECTION
- std::cout << "enterStates: ";
- for (size_t i = 0; i < statesToEnter.size(); i++) {
- std::cout << ATTR_CAST(statesToEnter[i], "id") << " ";
- }
- std::cout << std::endl;
-#endif
-
- for (size_t i = 0; i < statesToEnter.size(); i++) {
- Element<std::string> s = (Element<std::string>)statesToEnter[i];
-
- USCXML_MONITOR_CALLBACK3(beforeEnteringState, s, i + 1 < statesToEnter.size())
-
- _configuration.push_back(s);
- _statesToInvoke.push_back(s);
-
- if (_binding == LATE && !isMember(s, _alreadyEntered)) {
- NodeSet<std::string> dataModelElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", s);
- if(dataModelElems.size() > 0 && _dataModel) {
- Arabica::XPath::NodeSet<std::string> dataElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", dataModelElems[0]);
- for (size_t j = 0; j < dataElems.size(); j++) {
- if (dataElems[j].getNodeType() == Node_base::ELEMENT_NODE)
- initializeData(Element<std::string>(dataElems[j]));
- }
- }
- _alreadyEntered.push_back(s);
- }
- // execute onentry executable content
- NodeSet<std::string> onEntryElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onEntry", s);
- executeContent(onEntryElems, false);
-
- if (isMember(s, statesForDefaultEntry)) {
- // execute initial transition content for compound states
- Arabica::XPath::NodeSet<std::string> transitions = _xpath.evaluate("" + _nsInfo.xpathPrefix + "initial/" + _nsInfo.xpathPrefix + "transition", s).asNodeSet();
- if (transitions.size() > 0) {
- executeContent(transitions);
- }
- }
-
- USCXML_MONITOR_CALLBACK3(afterEnteringState, s, i + 1 < statesToEnter.size())
-
- if (HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat"))) {
- // extension for flattened interpreters
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", s);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- Element<std::string> invokeElem = Element<std::string>(invokes[j]);
- if (HAS_ATTR(invokeElem, "persist") && stringIsTrue(ATTR(invokeElem, "persist"))) {
- invoke(invokeElem);
- }
- }
-
- // extension for flattened SCXML documents, we will need an explicit uninvoke element
- NodeSet<std::string> uninvokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "uninvoke", s);
- for (size_t j = 0; j < uninvokes.size(); j++) {
- Element<std::string> uninvokeElem = (Element<std::string>)uninvokes[j];
- cancelInvoke(uninvokeElem);
- }
- }
-
-// std::cout << "HIST?: " << ATTR(s, "id") << std::endl;
- if (defaultHistoryContent.find(ATTR(s, "id")) != defaultHistoryContent.end()) {
- executeContent(Element<std::string>(defaultHistoryContent[ATTR(s, "id")]));
- }
-
- if (isFinal(s)) {
- Element<std::string> parent = (Element<std::string>)s.getParentNode();
-
- Arabica::DOM::Element<std::string> doneData;
- Arabica::XPath::NodeSet<std::string> doneDatas = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "donedata", s);
- if (doneDatas.size() > 0) {
- // only process first donedata element
- doneData = Element<std::string>(doneDatas[0]);
- }
-
- if (parentIsScxmlState(s)) {
- _topLevelFinalReached = true;
- } else {
- internalDoneSend(parent, doneData);
- Element<std::string> grandParent = (Element<std::string>)parent.getParentNode();
-
-// internalDoneSend(parent, Arabica::DOM::Element<std::string>());
-
- if (isParallel(grandParent)) {
- Arabica::XPath::NodeSet<std::string> childs = getChildStates(grandParent);
- bool inFinalState = true;
- for (size_t j = 0; j < childs.size(); j++) {
- if (!isInFinalState(Element<std::string>(childs[j]))) {
- inFinalState = false;
- break;
- }
- }
- if (inFinalState) {
- internalDoneSend(grandParent, Arabica::DOM::Element<std::string>());
- }
- }
- }
- }
- }
-}
-
-/*
-procedure computeEntrySet(transitions, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- for t in transitions:
- for s in t.target:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- ancestor = getTransitionDomain(t)
- for s in getEffectiveTargetStates(t)):
- addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
-*/
-
-void InterpreterRC::computeEntrySet(const Arabica::XPath::NodeSet<std::string>& transitions,
- NodeSet<std::string>& statesToEnter,
- NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent) {
-
- // add all descendants in a dedicated first step
- for (size_t i = 0; i < transitions.size(); i++) {
- Element<std::string> t(transitions[i]);
-
- NodeSet<std::string> targets = getTargetStates(t);
- for (size_t j = 0; j < targets.size(); j++) {
- Element<std::string> s = Element<std::string>(targets[j]);
- addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
- }
-
- // only now add the ancestors
- for (size_t i = 0; i < transitions.size(); i++) {
- Element<std::string> t(transitions[i]);
- Element<std::string> ancestor = Element<std::string>(getTransitionDomain(t));
- NodeSet<std::string> effectiveTargetStates = getEffectiveTargetStates(t);
-
- for (size_t j = 0; j < effectiveTargetStates.size(); j++) {
- Element<std::string> s = Element<std::string>(effectiveTargetStates[j]);
- addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
-
- }
-}
-
-/*
-function getEffectiveTargetStates(transition)
- effectiveTargets = new OrderedSet()
- for s in transition.target
- if isHistoryState(s):
- if historyValue[s.id]:
- effectiveTargets.union(historyValue[s.id])
- else:
- effectiveTargets.union(getEffectiveTargetStates(s.transition))
- else:
- effectiveTargets.add(s)
- return effectiveTargets
-*/
-
-Arabica::XPath::NodeSet<std::string> InterpreterRC::getEffectiveTargetStates(const Arabica::DOM::Element<std::string>& transition) {
- NodeSet<std::string> effectiveTargets;
-
- NodeSet<std::string> targets;
- if (isState(transition)) {
- targets = getInitialStates(transition);
- return targets;
- } else {
- targets = getTargetStates(transition);
- }
-
- for (size_t j = 0; j < targets.size(); j++) {
- Element<std::string> s = Element<std::string>(targets[j]);
- if (isHistory(s)) {
- if (_historyValue.find(ATTR(s, "id")) != _historyValue.end()) {
- targets.push_back(_historyValue[ATTR(s, "id")]);
- } else {
- NodeSet<std::string> histTrans = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", s);
- // TODO: what if there are many history transitions?
- if (histTrans.size() > 0)
- targets.push_back(getEffectiveTargetStates(Element<std::string>(histTrans[0])));
- }
- } else {
- effectiveTargets.push_back(s);
- }
- }
-
- return effectiveTargets;
-}
-
-void InterpreterRC::computeEntrySet(const Arabica::DOM::Node<std::string>& transition,
- NodeSet<std::string>& statesToEnter,
- NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent) {
- Arabica::XPath::NodeSet<std::string> transitions;
- transitions.push_back(transition);
- computeEntrySet(transitions, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
-}
-
-
-/*
-procedure addDescendantStatesToEnter(state,statesToEnter,statesForDefaultEntry, defaultHistoryContent):
- if isHistoryState(state):
- if historyValue[state.id]:
- for s in historyValue[state.id]:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- addAncestorStatesToEnter(s, state.parent, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- defaultHistoryContent[state.parent.id] = state.transition.content
- for s in state.transition.target:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- addAncestorStatesToEnter(s, state.parent, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- statesToEnter.add(state)
- if isCompoundState(state):
- statesForDefaultEntry.add(state)
- for s in getEffectiveTargetStates(state.initial.transition):
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- addAncestorStatesToEnter(s, state, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- if isParallelState(state):
- for child in getChildStates(state):
- if not statesToEnter.some(lambda s: isDescendant(s,child)):
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
-*/
-void InterpreterRC::addDescendantStatesToEnter(const Arabica::DOM::Element<std::string>& state,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent) {
-
-#if VERBOSE_STATE_SELECTION
- std::cout << getPadding() << "addDescendantStatesToEnter: " << ATTR(state, "id") << std::endl;
- padding++;
-#endif
-
- if (isHistory(state)) {
-
- /*
- if historyValue[state.id]:
- for s in historyValue[state.id]:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- addAncestorStatesToEnter(s, state.parent, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- defaultHistoryContent[state.parent.id] = state.transition.content
- for s in state.transition.target:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- addAncestorStatesToEnter(s, state.parent, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- */
- std::string stateId = ATTR(state, "id");
- if (_historyValue.find(stateId) != _historyValue.end()) {
- const Arabica::XPath::NodeSet<std::string>& historyValue = _historyValue[stateId];
- for (size_t i = 0; i < historyValue.size(); i++) {
- const Element<std::string>& s = Element<std::string>(historyValue[i]);
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent);
- addAncestorStatesToEnter(s, getParentState(s), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
-
- } else {
- NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", state);
- if (transitions.size() > 0) {
- // TODO: what if there are many history transitions?
-// std::cout << "HIST: " << ATTR_CAST(getParentState(state), "id") << std::endl;
- defaultHistoryContent[ATTR_CAST(getParentState(state), "id")] = transitions[0];
- }
-
- for (size_t i = 0; i < transitions.size(); i++) {
- NodeSet<std::string> targets = getTargetStates(Element<std::string>(transitions[i]));
- for (size_t j = 0; j < targets.size(); j++) {
- const Element<std::string>& s = Element<std::string>(targets[i]);
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent);
- addAncestorStatesToEnter(s, getParentState(s), statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
- }
- }
- } else {
- /*
- statesToEnter.add(state)
- if isCompoundState(state):
- statesForDefaultEntry.add(state)
- for s in getEffectiveTargetStates(state.initial.transition):
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- addAncestorStatesToEnter(s, state, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- if isParallelState(state):
- for child in getChildStates(state):
- if not statesToEnter.some(lambda s: isDescendant(s,child)):
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- */
-
- if (!isMember(state, statesToEnter)) { // adding an existing element invalidates old reference
-#if VERBOSE_STATE_SELECTION
- std::cout << getPadding() << "adding: " << ATTR_CAST(state, "id") << std::endl;
-#endif
- statesToEnter.push_back(state);
- }
-
- if (isCompound(state)) {
- statesForDefaultEntry.push_back(state);
-
- // test 579 - initial leads to history still fails
- NodeSet<std::string> targets = getEffectiveTargetStates(Element<std::string>(state));
- for (size_t i = 0; i < targets.size(); i++) {
- const Element<std::string>& s = Element<std::string>(targets[i]);
- addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
-
- for (size_t i = 0; i < targets.size(); i++) {
- const Element<std::string>& s = Element<std::string>(targets[i]);
- addAncestorStatesToEnter(s, state, statesToEnter, statesForDefaultEntry, defaultHistoryContent);
- }
-
- } else if(isParallel(state)) {
- NodeSet<std::string> childStates = getChildStates(state);
-
- for (size_t i = 0; i < childStates.size(); i++) {
- const Element<std::string>& child = Element<std::string>(childStates[i]);
-
- for (size_t j = 0; j < statesToEnter.size(); j++) {
- const Node<std::string>& s = statesToEnter[j];
- if (isDescendant(s, child)) {
- goto BREAK_LOOP;
- }
-
- }
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent);
-BREAK_LOOP:
- ;
- }
- }
- }
- padding--;
-}
-
-/*
-procedure addAncestorStatesToEnter(state, ancestor, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- for anc in getProperAncestors(state,ancestor):
- statesToEnter.add(anc)
- if isParallelState(anc):
- for child in getChildStates(anc):
- if not statesToEnter.some(lambda s: isDescendant(s,child)):
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
-*/
-void InterpreterRC::addAncestorStatesToEnter(const Arabica::DOM::Element<std::string>& state,
- const Arabica::DOM::Element<std::string>& ancestor,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent) {
-
-#if VERBOSE_STATE_SELECTION
- std::cout << getPadding() << "addAncestorStatesToEnter: " << ATTR(state, "id") << " - " << ATTR(ancestor, "id") << std::endl;
- padding++;
-#endif
-
- NodeSet<std::string> ancestors = getProperAncestors(state, ancestor);
- for (size_t i = 0; i < ancestors.size(); i++) {
- const Node<std::string>& anc = ancestors[i];
-#if VERBOSE_STATE_SELECTION
- std::cout << getPadding() << "adding: " << ATTR_CAST(anc, "id") << std::endl;
-#endif
-
- statesToEnter.push_back(anc);
-
- if (isParallel(Element<std::string>(anc))) {
- NodeSet<std::string> childStates = getChildStates(anc);
- for (size_t j = 0; j < childStates.size(); j++) {
- const Element<std::string>& child = Element<std::string>(childStates[j]);
- for (size_t k = 0; k < statesToEnter.size(); k++) {
- const Node<std::string>& s = statesToEnter[k];
- if (isDescendant(s, child)) {
- goto BREAK_LOOP;
- }
- }
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent);
-BREAK_LOOP:
- ;
- }
- }
- }
- padding--;
-}
-
-/*
-function getTransitionDomain(t)
- tstates = getEffectiveTargetStates(t)
- if not tstates:
- return null
- elif t.type == "internal" and isCompoundState(t.source) and tstates.every(lambda s: isDescendant(s,t.source)):
- return t.source
- else:
- return findLCCA([t.source].append(tstates))
-*/
-Arabica::DOM::Node<std::string> InterpreterRC::getTransitionDomain(const Arabica::DOM::Element<std::string>& transition) {
- NodeSet<std::string> tStates = getEffectiveTargetStates(transition);
- if (tStates.size() == 0) {
- return Arabica::DOM::Node<std::string>(); // null
- }
- std::string transitionType = (HAS_ATTR(transition, "type") ? ATTR(transition, "type") : "external");
- Node<std::string> source = getSourceState(transition);
-
- if (iequals(transitionType, "internal") && isCompound(Element<std::string>(source))) {
- for (size_t i = 0; i < tStates.size(); i++) {
- const Node<std::string>& s = tStates[i];
- if (!isDescendant(s, source))
- goto BREAK_LOOP;
- }
- return source;
- }
-
-BREAK_LOOP:
- Arabica::XPath::NodeSet<std::string> states;
- states.push_back(source);
- states.push_back(tStates);
- return findLCCA(states);
-}
-
-void InterpreterRC::handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event) {
- InterpreterImpl::handleDOMEvent(event);
-
- if (event.getType().compare("DOMAttrModified") == 0) // we do not care about attributes
- return;
-
-// Node<std::string> target = Arabica::DOM::Node<std::string>(event.getTarget());
-// NodeSet<std::string> transitions = DOMUtils::DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", target, true);
-// if (transitions.size() > 0)
- _exitSet.clear();
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/interpreter/InterpreterRC.h b/src/uscxml/interpreter/InterpreterRC.h
deleted file mode 100644
index 36aca3d..0000000
--- a/src/uscxml/interpreter/InterpreterRC.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef INTERPRETERRC_H_WLJEI019
-#define INTERPRETERRC_H_WLJEI019
-
-#include "uscxml/Interpreter.h"
-
-namespace uscxml {
-
-class InterpreterRC : public InterpreterImpl {
-protected:
- void enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- void exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- Arabica::XPath::NodeSet<std::string> removeConflictingTransitions(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
-
- bool hasIntersection(const Arabica::XPath::NodeSet<std::string>& nodeSet1, const Arabica::XPath::NodeSet<std::string>& nodeSet2);
-
- Arabica::XPath::NodeSet<std::string> computeExitSet(const Arabica::XPath::NodeSet<std::string>& transitions);
- Arabica::XPath::NodeSet<std::string> computeExitSet(const Arabica::DOM::Node<std::string>& transition);
-
- void computeEntrySet(const Arabica::XPath::NodeSet<std::string>& transitions,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent);
- void computeEntrySet(const Arabica::DOM::Node<std::string>& transition,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent);
-
- Arabica::DOM::Node<std::string> getTransitionDomain(const Arabica::DOM::Element<std::string>& transition);
- Arabica::XPath::NodeSet<std::string> getEffectiveTargetStates(const Arabica::DOM::Element<std::string>& transition);
-
- void addDescendantStatesToEnter(const Arabica::DOM::Element<std::string>& state,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent);
-
- void addAncestorStatesToEnter(const Arabica::DOM::Element<std::string>& state,
- const Arabica::DOM::Element<std::string>& ancestor,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry,
- std::map<std::string, Arabica::DOM::Node<std::string> >& defaultHistoryContent);
- virtual void handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event);
-
-private:
- std::map<Arabica::DOM::Node<std::string>, Arabica::XPath::NodeSet<std::string> > _exitSet;
-};
-
-}
-
-#endif /* end of include guard: INTERPRETERRC_H_WLJEI019 */
diff --git a/src/uscxml/interpreter/MicroStepFast.cpp b/src/uscxml/interpreter/MicroStepFast.cpp
new file mode 100644
index 0000000..fbddbc9
--- /dev/null
+++ b/src/uscxml/interpreter/MicroStepFast.cpp
@@ -0,0 +1,1149 @@
+/**
+ * @file
+ * @author 2012-2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#undef USCXML_VERBOSE
+
+#include "MicroStepFast.h"
+#include "uscxml/util/DOM.h"
+#include "uscxml/util/String.h"
+#include "uscxml/util/Predicates.h"
+#include "uscxml/util/Convenience.h"
+#include "uscxml/interpreter/InterpreterMonitor.h"
+
+#include <easylogging++.h>
+
+#define BIT_ANY_SET(b) (!b.none())
+#define BIT_HAS(idx, bitset) (bitset[idx])
+#define BIT_HAS_AND(bitset1, bitset2) bitset1.intersects(bitset2)
+#define BIT_SET_AT(idx, bitset) bitset[idx] = true;
+#define BIT_CLEAR(idx, bitset) bitset[idx] = false;
+
+#define USCXML_GET_TRANS(i) (*_transitions[i])
+#define USCXML_GET_STATE(i) (*_states[i])
+
+#define USCXML_CTX_PRISTINE 0x00
+#define USCXML_CTX_SPONTANEOUS 0x01
+#define USCXML_CTX_INITIALIZED 0x02
+#define USCXML_CTX_TOP_LEVEL_FINAL 0x04
+#define USCXML_CTX_TRANSITION_FOUND 0x08
+#define USCXML_CTX_FINISHED 0x10
+#define USCXML_CTX_STABLE 0x20 // only needed to signal onStable once
+
+#define USCXML_TRANS_SPONTANEOUS 0x01
+#define USCXML_TRANS_TARGETLESS 0x02
+#define USCXML_TRANS_INTERNAL 0x04
+#define USCXML_TRANS_HISTORY 0x08
+#define USCXML_TRANS_INITIAL 0x10
+
+#define USCXML_STATE_ATOMIC 0x01
+#define USCXML_STATE_PARALLEL 0x02
+#define USCXML_STATE_COMPOUND 0x03
+#define USCXML_STATE_FINAL 0x04
+#define USCXML_STATE_HISTORY_DEEP 0x05
+#define USCXML_STATE_HISTORY_SHALLOW 0x06
+#define USCXML_STATE_INITIAL 0x07
+#define USCXML_STATE_HAS_HISTORY 0x80 /* highest bit */
+#define USCXML_STATE_MASK(t) (t & 0x7F) /* mask highest bit */
+
+#define USCXML_NUMBER_STATES _states.size()
+#define USCXML_NUMBER_TRANS _transitions.size()
+
+#ifdef __GNUC__
+# define likely(x) (__builtin_expect(!!(x), 1))
+# define unlikely(x) (__builtin_expect(!!(x), 0))
+#else
+# define likely(x) (x)
+# define unlikely(x) (x)
+#endif
+
+namespace uscxml {
+
+using namespace xercesc;
+
+MicroStepFast::MicroStepFast(MicroStepCallbacks* callbacks)
+ : MicroStepImpl(callbacks), _flags(USCXML_CTX_PRISTINE), _isInitialized(false), _isCancelled(false) {
+}
+
+MicroStepFast::~MicroStepFast() {
+ for (size_t i = 0; i < _states.size(); i++) {
+ delete(_states[i]);
+ }
+ for (size_t i = 0; i < _transitions.size(); i++) {
+ delete(_transitions[i]);
+ }
+}
+
+void MicroStepFast::resortStates(DOMNode* node, const X& xmlPrefix) {
+ if (node->getNodeType() != DOMNode::ELEMENT_NODE)
+ return;
+
+ /**
+ initials
+ deep histories
+ shallow histories
+ everything else
+ */
+
+ DOMElement* element = dynamic_cast<DOMElement*>(node);
+
+ // shallow history states to top
+ DOMNode* child = element->getFirstChild();
+ while(child) {
+ resortStates(child, xmlPrefix);
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE &&
+ TAGNAME_CAST(child) == xmlPrefix.str() + "history" &&
+ (!HAS_ATTR(element, "type") || iequals(ATTR(element, "type"), "shallow"))) {
+
+ DOMNode* tmp = child->getNextSibling();
+ if (child != element->getFirstChild()) {
+ element->insertBefore(child, element->getFirstChild());
+ }
+ child = tmp;
+ } else {
+ child = child->getNextSibling();
+ }
+ }
+
+ // deep history states to top
+ child = element->getFirstChild();
+ while(child) {
+ resortStates(child, xmlPrefix);
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE &&
+ TAGNAME_CAST(child) == xmlPrefix.str() + "history" &&
+ HAS_ATTR(element, "type") &&
+ iequals(ATTR(element, "type"), "deep")) {
+
+ DOMNode* tmp = child->getNextSibling();
+ if (child != element->getFirstChild()) {
+ element->insertBefore(child, element->getFirstChild());
+ }
+ child = tmp;
+ } else {
+ child = child->getNextSibling();
+ }
+ }
+
+ // initial states on top of histories even
+ child = element->getFirstChild();
+ while(child) {
+ resortStates(child, xmlPrefix);
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE && LOCALNAME_CAST(child) == "initial") {
+ DOMNode* tmp = child->getNextSibling();
+ if (child != element->getFirstChild()) {
+ element->insertBefore(child, element->getFirstChild());
+ }
+ child = tmp;
+ } else {
+ child = child->getNextSibling();
+ }
+ }
+}
+
+void MicroStepFast::init(xercesc::DOMElement* scxml) {
+
+ _scxml = scxml;
+ _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
+ _xmlPrefix = _scxml->getPrefix();
+ _xmlNS = _scxml->getNamespaceURI();
+ if (_xmlPrefix) {
+ _xmlPrefix = std::string(_xmlPrefix) + ":";
+ }
+
+ resortStates(_scxml, _xmlPrefix);
+
+ // TODO: https://github.com/tklab-tud/uscxml/blob/master/src/uscxml/transform/ChartToC.cpp#L244
+
+
+ /** -- All things states -- */
+
+ std::set<std::string> elements;
+ elements.insert(_xmlPrefix.str() + "state");
+ elements.insert(_xmlPrefix.str() + "parallel");
+ elements.insert(_xmlPrefix.str() + "scxml");
+ elements.insert(_xmlPrefix.str() + "initial");
+ elements.insert(_xmlPrefix.str() + "final");
+ elements.insert(_xmlPrefix.str() + "history");
+
+ std::list<xercesc::DOMElement*> tmp;
+ size_t i, j;
+
+ tmp = DOMUtils::inDocumentOrder(elements, _scxml);
+ _states.resize(tmp.size());
+ _configuration.resize(tmp.size());
+ _history.resize(tmp.size());
+ _initializedData.resize(tmp.size());
+ _invocations.resize(tmp.size());
+
+ for (i = 0; i < _states.size(); i++) {
+ _states[i] = new State();
+ _states[i]->documentOrder = i;
+ _states[i]->element = tmp.front();
+ _states[i]->element->setUserData(X("uscxmlState"), _states[i], NULL);
+ _states[i]->completion.resize(_states.size());
+ _states[i]->ancestors.resize(_states.size());
+ _states[i]->children.resize(_states.size());
+ tmp.pop_front();
+ }
+ assert(tmp.size() == 0);
+
+ if (_binding == Binding::EARLY && _states.size() > 0) {
+ // add all data elements to the first state
+ std::list<DOMElement*> dataModels = DOMUtils::filterChildElements(_xmlPrefix.str() + "datamodel", _states[0]->element, true);
+ dataModels.erase(std::remove_if(dataModels.begin(),
+ dataModels.end(),
+ [](DOMElement* elem) {
+ return isInEmbeddedDocument(elem);
+ }),
+ dataModels.end());
+
+ _states[0]->data = DOMUtils::filterChildElements(_xmlPrefix.str() + "data", dataModels, false);
+ }
+
+ for (i = 0; i < _states.size(); i++) {
+ // collect states with an id attribute
+ if (HAS_ATTR(_states[i]->element, "id")) {
+ _stateIds[ATTR(_states[i]->element, "id")] = i;
+ }
+
+ // check for executable content and datamodels
+ if (_states[i]->element->getChildElementCount() > 0) {
+ _states[i]->onEntry = DOMUtils::filterChildElements(_xmlPrefix.str() + "onentry", _states[i]->element);
+ _states[i]->onExit = DOMUtils::filterChildElements(_xmlPrefix.str() + "onexit", _states[i]->element);
+ _states[i]->invoke = DOMUtils::filterChildElements(_xmlPrefix.str() + "invoke", _states[i]->element);
+
+ if (i == 0) {
+ // have global scripts as onentry of <scxml>
+ _states[i]->onEntry = DOMUtils::filterChildElements(_xmlPrefix.str() + "script", _states[i]->element, false);
+ }
+
+ std::list<DOMElement*> doneDatas = DOMUtils::filterChildElements(_xmlPrefix.str() + "donedata", _states[i]->element);
+ if (doneDatas.size() > 0) {
+ _states[i]->doneData = doneDatas.front();
+ }
+
+ if (_binding == Binding::LATE) {
+ std::list<DOMElement*> dataModels = DOMUtils::filterChildElements(_xmlPrefix.str() + "datamodel", _states[i]->element);
+ if (dataModels.size() > 0) {
+ _states[i]->data = DOMUtils::filterChildElements(_xmlPrefix.str() + "data", dataModels, false);
+ }
+ }
+ }
+
+
+ // set the states type
+ if (false) {
+ } else if (iequals(TAGNAME(_states[i]->element), _xmlPrefix.str() + "initial")) {
+ _states[i]->type = USCXML_STATE_INITIAL;
+ } else if (isFinal(_states[i]->element)) {
+ _states[i]->type = USCXML_STATE_FINAL;
+ } else if (isHistory(_states[i]->element)) {
+ if (HAS_ATTR(_states[i]->element, "type") && iequals(ATTR(_states[i]->element, "type"), "deep")) {
+ _states[i]->type = USCXML_STATE_HISTORY_DEEP;
+ } else {
+ _states[i]->type = USCXML_STATE_HISTORY_SHALLOW;
+ }
+ } else if (isAtomic(_states[i]->element)) {
+ _states[i]->type = USCXML_STATE_ATOMIC;
+ } else if (isParallel(_states[i]->element)) {
+ _states[i]->type = USCXML_STATE_PARALLEL;
+ } else if (isCompound(_states[i]->element)) {
+ _states[i]->type = USCXML_STATE_COMPOUND;
+ } else { // <scxml>
+ _states[i]->type = USCXML_STATE_COMPOUND;
+ }
+
+ // establish the states' completion
+ std::list<DOMElement*> completion = getCompletion(_states[i]->element);
+ for (j = 0; j < _states.size(); j++) {
+ if (!completion.empty() && _states[j]->element == completion.front()) {
+ _states[i]->completion[j] = true;
+ completion.pop_front();
+ } else {
+ _states[i]->completion[j] = false;
+ }
+ }
+ assert(completion.size() == 0);
+
+ // this is set when establishing the completion
+ if (_states[i]->element->getUserData(X("hasHistoryChild")) == _states[i]) {
+ _states[i]->type |= USCXML_STATE_HAS_HISTORY;
+ }
+
+ // establish the states' ancestors
+ DOMNode* parent = _states[i]->element->getParentNode();
+ if (parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
+ State* uscxmlState = (State*)parent->getUserData(X("uscxmlState"));
+ // parent
+ _states[i]->parent = uscxmlState->documentOrder;
+ }
+
+ while(parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
+ State* uscxmlState = (State*)parent->getUserData(X("uscxmlState"));
+
+ // ancestors
+ BIT_SET_AT(uscxmlState->documentOrder, _states[i]->ancestors);
+
+ // children
+ BIT_SET_AT(i, uscxmlState->children);
+ parent = parent->getParentNode();
+ }
+ }
+
+
+ /** -- All things transitions -- */
+
+ tmp = DOMUtils::inPostFixOrder(_xmlPrefix.str() + "transition", _scxml);
+ _transitions.resize(tmp.size());
+
+ for (i = 0; i < _transitions.size(); i++) {
+ _transitions[i] = new Transition();
+ _transitions[i]->element = tmp.front();
+ _transitions[i]->conflicts.resize(_transitions.size());
+ _transitions[i]->exitSet.resize(_states.size());
+ _transitions[i]->target.resize(_states.size());
+ tmp.pop_front();
+ }
+
+ for (i = 0; i < _transitions.size(); i++) {
+
+ // establish the transitions' exit set
+ std::list<DOMElement*> exitList = getExitSet(_transitions[i]->element, _scxml);
+ for (j = 0; j < _states.size(); j++) {
+ if (!exitList.empty() && _states[j]->element == exitList.front()) {
+ _transitions[i]->exitSet[j] = true;
+ exitList.pop_front();
+ } else {
+ _transitions[i]->exitSet[j] = false;
+ }
+ }
+ assert(exitList.size() == 0);
+
+ // establish the transitions' conflict set
+ for (j = 0; j < _transitions.size(); j++) {
+ if (conflicts(_transitions[i]->element, _transitions[j]->element, _scxml)) {
+ _transitions[i]->conflicts[j] = true;
+ } else {
+ _transitions[i]->conflicts[j] = false;
+ }
+ }
+
+ // establish the transitions' target set
+ std::list<std::string> targets = tokenize(ATTR(_transitions[i]->element, "target"));
+ for (auto tIter = targets.begin(); tIter != targets.end(); tIter++) {
+ if (_stateIds.find(*tIter) != _stateIds.end()) {
+ _transitions[i]->target[_stateIds[*tIter]] = true;
+ }
+ }
+
+ // the transition's source
+ State* uscxmlState = (State*)(_transitions[i]->element->getParentNode()->getUserData(X("uscxmlState")));
+ _transitions[i]->source = uscxmlState->documentOrder;
+
+
+ // the transition's type
+ if (!HAS_ATTR(_transitions[i]->element, "target")) {
+ _transitions[i]->type |= USCXML_TRANS_TARGETLESS;
+ }
+
+ if (HAS_ATTR(_transitions[i]->element, "type") && iequals(ATTR(_transitions[i]->element, "type"), "internal")) {
+ _transitions[i]->type |= USCXML_TRANS_INTERNAL;
+ }
+
+ if (!HAS_ATTR(_transitions[i]->element, "event")) {
+ _transitions[i]->type |= USCXML_TRANS_SPONTANEOUS;
+ }
+
+ if (iequals(TAGNAME_CAST(_transitions[i]->element->getParentNode()), _xmlPrefix.str() + "history")) {
+ _transitions[i]->type |= USCXML_TRANS_HISTORY;
+ }
+
+ if (iequals(TAGNAME_CAST(_transitions[i]->element->getParentNode()), _xmlPrefix.str() + "initial")) {
+ _transitions[i]->type |= USCXML_TRANS_INITIAL;
+ }
+
+
+ // the transitions event and condition
+ _transitions[i]->event = (HAS_ATTR(_transitions[i]->element, "event") ? ATTR(_transitions[i]->element, "event") : "");
+ _transitions[i]->cond = (HAS_ATTR(_transitions[i]->element, "cond") ? ATTR(_transitions[i]->element, "cond") : "");
+
+ // is there executable content?
+ if (_transitions[i]->element->getChildElementCount() > 0) {
+ _transitions[i]->onTrans = _transitions[i]->element;
+ }
+
+ }
+ _isInitialized = true;
+}
+
+void MicroStepFast::markAsCancelled() {
+ _isCancelled = true;
+}
+
+InterpreterState MicroStepFast::step(bool blocking) {
+ if (!_isInitialized) {
+ init(_scxml);
+ return USCXML_INITIALIZED;
+ }
+
+ size_t i, j, k;
+
+ boost::dynamic_bitset<> exitSet(_states.size(), false);
+ boost::dynamic_bitset<> entrySet(_states.size(), false);
+ boost::dynamic_bitset<> targetSet(_states.size(), false);
+ boost::dynamic_bitset<> tmpStates(_states.size(), false);
+
+ boost::dynamic_bitset<> conflicts(_transitions.size(), false);
+ boost::dynamic_bitset<> transSet(_transitions.size(), false);
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "Config: ";
+ printStateNames(_configuration);
+#endif
+
+ if (_flags & USCXML_CTX_FINISHED)
+ return USCXML_FINISHED;
+
+ if (_flags & USCXML_CTX_TOP_LEVEL_FINAL) {
+ USCXML_MONITOR_CALLBACK(_callbacks->getMonitor(), beforeCompletion);
+
+ /* exit all remaining states */
+ i = USCXML_NUMBER_STATES;
+ while(i-- > 0) {
+ if (BIT_HAS(i, _configuration)) {
+ /* call all on exit handlers */
+ for (auto exitIter = USCXML_GET_STATE(i).onExit.begin(); exitIter != USCXML_GET_STATE(i).onExit.end(); exitIter++) {
+ try {
+ _callbacks->process(*exitIter);
+ } catch (...) {
+ // do nothing and continue with next block
+ }
+ }
+ /* Leave configuration intact */
+// BIT_CLEAR(i, _configuration);
+ }
+
+ if (BIT_HAS(i, _invocations)) {
+ /* cancel all invokers */
+ if (USCXML_GET_STATE(i).invoke.size() > 0) {
+ for (auto invIter = USCXML_GET_STATE(i).invoke.begin(); invIter != USCXML_GET_STATE(i).invoke.end(); invIter++) {
+ _callbacks->uninvoke(*invIter);
+ }
+ }
+ BIT_CLEAR(i, _invocations);
+ }
+ }
+
+ _flags |= USCXML_CTX_FINISHED;
+
+ USCXML_MONITOR_CALLBACK(_callbacks->getMonitor(), afterCompletion);
+
+ return USCXML_FINISHED;
+ }
+
+
+ if (_flags == USCXML_CTX_PRISTINE) {
+
+ targetSet |= USCXML_GET_STATE(0).completion;
+ _flags |= USCXML_CTX_SPONTANEOUS | USCXML_CTX_INITIALIZED;
+ USCXML_MONITOR_CALLBACK(_callbacks->getMonitor(), beforeMicroStep);
+
+ goto ESTABLISH_ENTRYSET;
+ }
+
+ if (_flags & USCXML_CTX_SPONTANEOUS) {
+ _event = Event();
+ goto SELECT_TRANSITIONS;
+ }
+
+
+ if ((_event = _callbacks->dequeueInternal())) {
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeProcessingEvent, _event);
+ goto SELECT_TRANSITIONS;
+ }
+
+ /* manage invocations */
+ for (i = 0; i < USCXML_NUMBER_STATES; i++) {
+ /* uninvoke */
+ if (!BIT_HAS(i, _configuration) && BIT_HAS(i, _invocations)) {
+ if (USCXML_GET_STATE(i).invoke.size() > 0) {
+ for (auto invIter = USCXML_GET_STATE(i).invoke.begin(); invIter != USCXML_GET_STATE(i).invoke.end(); invIter++) {
+ _callbacks->uninvoke(*invIter);
+ }
+ }
+ BIT_CLEAR(i, _invocations)
+ }
+ /* invoke */
+ if (BIT_HAS(i, _configuration) && !BIT_HAS(i, _invocations)) {
+ if (USCXML_GET_STATE(i).invoke.size() > 0) {
+ for (auto invIter = USCXML_GET_STATE(i).invoke.begin(); invIter != USCXML_GET_STATE(i).invoke.end(); invIter++) {
+ try {
+ _callbacks->invoke(*invIter);
+ } catch (...) {
+ }
+ }
+ }
+ BIT_SET_AT(i, _invocations)
+ }
+ }
+
+ // we dequeued all internal events and ought to signal stable configuration
+ if (!(_flags & USCXML_CTX_STABLE)) {
+ USCXML_MONITOR_CALLBACK(_callbacks->getMonitor(), onStableConfiguration);
+ _microstepConfigurations.clear();
+ _flags |= USCXML_CTX_STABLE;
+ }
+
+ if ((_event = _callbacks->dequeueExternal(blocking))) {
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeProcessingEvent, _event);
+ goto SELECT_TRANSITIONS;
+ }
+
+ if (_isCancelled) {
+ // finalize and exit
+ _flags |= USCXML_CTX_TOP_LEVEL_FINAL;
+ return USCXML_CANCELLED;
+ }
+
+// if (blocking) // we received the empty event to unblock
+// return USCXML_IDLE; // we return IDLE nevertheless
+
+ return USCXML_IDLE;
+
+SELECT_TRANSITIONS:
+
+ // we read an event - unset stable to signal onstable again later
+ _flags &= ~USCXML_CTX_STABLE;
+
+ for (i = 0; i < _transitions.size(); i++) {
+ /* never select history or initial transitions automatically */
+ if unlikely(USCXML_GET_TRANS(i).type & (USCXML_TRANS_HISTORY | USCXML_TRANS_INITIAL))
+ continue;
+
+ /* is the transition active? */
+ if (BIT_HAS(USCXML_GET_TRANS(i).source, _configuration)) {
+ /* is it non-conflicting? */
+ if (!BIT_HAS(i, conflicts)) {
+ /* is it spontaneous with an event or vice versa? */
+ if ((USCXML_GET_TRANS(i).event.size() == 0 && !_event) ||
+ (USCXML_GET_TRANS(i).event.size() != 0 && _event)) {
+ /* is it enabled? */
+ if ((!_event || _callbacks->isMatched(_event, USCXML_GET_TRANS(i).event)) &&
+ (USCXML_GET_TRANS(i).cond.size() == 0 || _callbacks->isTrue(USCXML_GET_TRANS(i).cond))) {
+
+ /* remember that we found a transition */
+ _flags |= USCXML_CTX_TRANSITION_FOUND;
+
+ /* transitions that are pre-empted */
+ conflicts |= USCXML_GET_TRANS(i).conflicts;
+
+ /* states that are directly targeted (resolve as entry-set later) */
+ targetSet |= USCXML_GET_TRANS(i).target;
+
+ /* states that will be left */
+ exitSet |= USCXML_GET_TRANS(i).exitSet;
+
+ BIT_SET_AT(i, transSet);
+ }
+ }
+ }
+ }
+ }
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "Complete Exit: ";
+ printStateNames(exitSet);
+#endif
+
+ exitSet &= _configuration;
+
+ if (_flags & USCXML_CTX_TRANSITION_FOUND) {
+ // trigger more sppontaneuous transitions
+ _flags |= USCXML_CTX_SPONTANEOUS;
+ _flags &= ~USCXML_CTX_TRANSITION_FOUND;
+ } else {
+ // spontaneuous transitions are exhausted
+ _flags &= ~USCXML_CTX_SPONTANEOUS;
+ return USCXML_MACROSTEPPED;
+ }
+
+ USCXML_MONITOR_CALLBACK(_callbacks->getMonitor(), beforeMicroStep);
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "Targets: ";
+ printStateNames(targetSet);
+#endif
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "Exiting: ";
+ printStateNames(exitSet);
+#endif
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "History: ";
+ printStateNames(_history);
+#endif
+
+
+ /* REMEMBER_HISTORY: */
+ for (i = 0; i < _states.size(); i++) {
+ if unlikely(USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_HISTORY_SHALLOW ||
+ USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_HISTORY_DEEP) {
+ /* a history state whose parent is about to be exited */
+ if unlikely(BIT_HAS(USCXML_GET_STATE(i).parent, exitSet)) {
+ tmpStates = USCXML_GET_STATE(i).completion;
+
+ /* set those states who were enabled */
+ tmpStates &= _configuration;
+
+ /* clear current history with completion mask */
+ _history &= ~(USCXML_GET_STATE(i).completion);
+
+ /* set history */
+ _history |= tmpStates;
+
+ }
+ }
+ }
+
+ESTABLISH_ENTRYSET:
+ /* calculate new entry set */
+ entrySet = targetSet;
+
+ /* iterate for ancestors */
+ i = entrySet.find_first();
+ while(i != boost::dynamic_bitset<>::npos) {
+ entrySet |= USCXML_GET_STATE(i).ancestors;
+ i = entrySet.find_next(i);
+ }
+
+ /* iterate for descendants */
+ i = entrySet.find_first();
+ while(i != boost::dynamic_bitset<>::npos) {
+
+
+ switch (USCXML_STATE_MASK(USCXML_GET_STATE(i).type)) {
+ case USCXML_STATE_FINAL:
+ case USCXML_STATE_ATOMIC:
+ break;
+
+ case USCXML_STATE_PARALLEL: {
+ entrySet |= USCXML_GET_STATE(i).completion;
+ break;
+ }
+
+ case USCXML_STATE_HISTORY_SHALLOW:
+ case USCXML_STATE_HISTORY_DEEP: {
+ if (!BIT_HAS_AND(USCXML_GET_STATE(i).completion, _history) &&
+ !BIT_HAS(USCXML_GET_STATE(i).parent, _configuration)) {
+
+ /* nothing set for history, look for a default transition */
+ for (j = 0; j < _transitions.size(); j++) {
+ if unlikely(USCXML_GET_TRANS(j).source == i) {
+ entrySet |= USCXML_GET_TRANS(j).target;
+
+ if(USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_HISTORY_DEEP &&
+ !BIT_HAS_AND(USCXML_GET_TRANS(j).target, USCXML_GET_STATE(i).children)) {
+ for (k = i + 1; k < _states.size(); k++) {
+ if (BIT_HAS(k, USCXML_GET_TRANS(j).target)) {
+ entrySet |= USCXML_GET_STATE(k).ancestors;
+ break;
+ }
+ }
+ }
+ BIT_SET_AT(j, transSet);
+ break;
+ }
+ /* Note: SCXML mandates every history to have a transition! */
+ }
+ } else {
+ tmpStates = USCXML_GET_STATE(i).completion;
+ tmpStates &= _history;
+ entrySet |= tmpStates;
+
+ if (USCXML_GET_STATE(i).type == (USCXML_STATE_HAS_HISTORY | USCXML_STATE_HISTORY_DEEP)) {
+ /* a deep history state with nested histories -> more completion */
+ for (j = i + 1; j < USCXML_NUMBER_STATES; j++) {
+ if (BIT_HAS(j, USCXML_GET_STATE(i).completion) &&
+ BIT_HAS(j, entrySet) &&
+ (USCXML_GET_STATE(j).type & USCXML_STATE_HAS_HISTORY)) {
+ for (k = j + 1; k < USCXML_NUMBER_STATES; k++) {
+ /* add nested history to entry_set */
+ if ((USCXML_STATE_MASK(USCXML_GET_STATE(k).type) == USCXML_STATE_HISTORY_DEEP ||
+ USCXML_STATE_MASK(USCXML_GET_STATE(k).type) == USCXML_STATE_HISTORY_SHALLOW) &&
+ BIT_HAS(k, USCXML_GET_STATE(j).children)) {
+ /* a nested history state */
+ BIT_SET_AT(k, entrySet);
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ case USCXML_STATE_INITIAL: {
+ for (j = 0; j < USCXML_NUMBER_TRANS; j++) {
+ if (USCXML_GET_TRANS(j).source == i) {
+ BIT_SET_AT(j, transSet);
+ BIT_CLEAR(i, entrySet);
+ entrySet |= USCXML_GET_TRANS(j).target;
+ for (k = i + 1; k < USCXML_NUMBER_STATES; k++) {
+ if (BIT_HAS(k, USCXML_GET_TRANS(j).target)) {
+ entrySet |= USCXML_GET_STATE(k).ancestors;
+ }
+ }
+ }
+ }
+ break;
+ }
+ case USCXML_STATE_COMPOUND: { /* we need to check whether one child is already in entry_set */
+ if (!BIT_HAS_AND(entrySet, USCXML_GET_STATE(i).children) &&
+ (!BIT_HAS_AND(_configuration, USCXML_GET_STATE(i).children) ||
+ BIT_HAS_AND(exitSet, USCXML_GET_STATE(i).children))) {
+ entrySet |= USCXML_GET_STATE(i).completion;
+ if (!BIT_HAS_AND(USCXML_GET_STATE(i).completion, USCXML_GET_STATE(i).children)) {
+ /* deep completion */
+ for (j = i + 1; j < USCXML_NUMBER_STATES; j++) {
+ if (BIT_HAS(j, USCXML_GET_STATE(i).completion)) {
+ entrySet |= USCXML_GET_STATE(j).ancestors;
+ break; /* completion of compound is single state */
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ i = entrySet.find_next(i);
+
+ }
+
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "Transitions: " << transSet << std::endl;
+#endif
+
+ /* EXIT_STATES: */
+ /* we cannot use find_first due to ordering */
+ i = USCXML_NUMBER_STATES;
+ while(i-- > 0) {
+ if (BIT_HAS(i, exitSet) && BIT_HAS(i, _configuration)) {
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeExitingState, USCXML_GET_STATE(i).element);
+
+ /* call all on exit handlers */
+ for (auto exitIter = USCXML_GET_STATE(i).onExit.begin(); exitIter != USCXML_GET_STATE(i).onExit.end(); exitIter++) {
+ try {
+ _callbacks->process(*exitIter);
+ } catch (...) {
+ // do nothing and continue with next block
+ }
+ }
+ BIT_CLEAR(i, _configuration);
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), afterExitingState, USCXML_GET_STATE(i).element);
+
+ }
+ }
+
+ /* TAKE_TRANSITIONS: */
+ i = transSet.find_first();
+ while(i != boost::dynamic_bitset<>::npos) {
+ if ((USCXML_GET_TRANS(i).type & (USCXML_TRANS_HISTORY | USCXML_TRANS_INITIAL)) == 0) {
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeTakingTransition, USCXML_GET_TRANS(i).element);
+
+ if (USCXML_GET_TRANS(i).onTrans != NULL) {
+
+ /* call executable content in non-history, non-initial transition */
+ try {
+ _callbacks->process(USCXML_GET_TRANS(i).onTrans);
+ } catch (...) {
+ // do nothing and continue with next block
+ }
+ }
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), afterTakingTransition, USCXML_GET_TRANS(i).element);
+
+ }
+ i = transSet.find_next(i);
+ }
+
+#ifdef USCXML_VERBOSE
+ std::cerr << "Entering: ";
+ printStateNames(entrySet);
+#endif
+
+
+ /* ENTER_STATES: */
+ i = entrySet.find_first();
+ while(i != boost::dynamic_bitset<>::npos) {
+
+ if (BIT_HAS(i, _configuration)) {
+ // already active
+ i = entrySet.find_next(i);
+ continue;
+ }
+
+ /* these are no proper states */
+ if unlikely(USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_HISTORY_DEEP ||
+ USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_HISTORY_SHALLOW ||
+ USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_INITIAL) {
+ i = entrySet.find_next(i);
+ continue;
+ }
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeEnteringState, USCXML_GET_STATE(i).element);
+
+ BIT_SET_AT(i, _configuration);
+
+ /* initialize data */
+ if (!BIT_HAS(i, _initializedData)) {
+ for (auto dataIter = USCXML_GET_STATE(i).data.begin(); dataIter != USCXML_GET_STATE(i).data.end(); dataIter++) {
+ _callbacks->initData(*dataIter);
+ }
+ BIT_SET_AT(i, _initializedData);
+ }
+
+ /* call all on entry handlers */
+ for (auto entryIter = USCXML_GET_STATE(i).onEntry.begin(); entryIter != USCXML_GET_STATE(i).onEntry.end(); entryIter++) {
+ try {
+ _callbacks->process(*entryIter);
+ } catch (...) {
+ // do nothing and continue with next block
+ }
+ }
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), afterEnteringState, USCXML_GET_STATE(i).element);
+
+ /* take history and initial transitions */
+ for (j = 0; j < USCXML_NUMBER_TRANS; j++) {
+ if unlikely(BIT_HAS(j, transSet) &&
+ (USCXML_GET_TRANS(j).type & (USCXML_TRANS_HISTORY | USCXML_TRANS_INITIAL)) &&
+ USCXML_GET_STATE(USCXML_GET_TRANS(j).source).parent == i) {
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), beforeTakingTransition, USCXML_GET_TRANS(j).element);
+
+ /* call executable content in transition */
+ if (USCXML_GET_TRANS(j).onTrans != NULL) {
+ try {
+ _callbacks->process(USCXML_GET_TRANS(j).onTrans);
+ } catch (...) {
+ // do nothing and continue with next block
+ }
+ }
+
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(), afterTakingTransition, USCXML_GET_TRANS(j).element);
+
+ }
+ }
+
+ /* handle final states */
+ if unlikely(USCXML_STATE_MASK(USCXML_GET_STATE(i).type) == USCXML_STATE_FINAL) {
+ if unlikely(USCXML_GET_STATE(i).ancestors.count() == 1 && BIT_HAS(0, USCXML_GET_STATE(i).ancestors)) {
+ // only the topmost scxml is an ancestor
+ _flags |= USCXML_CTX_TOP_LEVEL_FINAL;
+ } else {
+ /* raise done event */
+ _callbacks->raiseDoneEvent(USCXML_GET_STATE(USCXML_GET_STATE(i).parent).element, USCXML_GET_STATE(i).doneData);
+ }
+
+ /**
+ * are we the last final state to leave a parallel state?:
+ * 1. Gather all parallel states in our ancestor chain
+ * 2. Find all states for which these parallels are ancestors
+ * 3. Iterate all active final states and remove their ancestors
+ * 4. If a state remains, not all children of a parallel are final
+ */
+ for (j = 0; j < USCXML_NUMBER_STATES; j++) {
+ if unlikely(USCXML_STATE_MASK(USCXML_GET_STATE(j).type) == USCXML_STATE_PARALLEL &&
+ BIT_HAS(j, USCXML_GET_STATE(i).ancestors)) {
+ tmpStates.reset();
+ k = _configuration.find_first();
+ while (k != boost::dynamic_bitset<>::npos) {
+ if (BIT_HAS(j, USCXML_GET_STATE(k).ancestors)) {
+ if (USCXML_STATE_MASK(USCXML_GET_STATE(k).type) == USCXML_STATE_FINAL) {
+ tmpStates ^= USCXML_GET_STATE(k).ancestors;
+ } else {
+ BIT_SET_AT(k, tmpStates);
+ }
+ }
+ k = _configuration.find_next(k);
+ }
+ if (!tmpStates.any()) {
+ // raise done for state j
+ _callbacks->raiseDoneEvent(USCXML_GET_STATE(j).element, USCXML_GET_STATE(j).doneData);
+ }
+ }
+ }
+ }
+ }
+ USCXML_MONITOR_CALLBACK(_callbacks->getMonitor(), afterMicroStep);
+
+ // are we running in circles?
+ if (_microstepConfigurations.find(_configuration) != _microstepConfigurations.end()) {
+ USCXML_MONITOR_CALLBACK1(_callbacks->getMonitor(),
+ reportIssue,
+ InterpreterIssue("Reentering same configuration during microstep - possible endless loop",
+ NULL,
+ InterpreterIssue::USCXML_ISSUE_WARNING));
+ }
+ _microstepConfigurations.insert(_configuration);
+
+ return USCXML_MICROSTEPPED;
+}
+
+void MicroStepFast::reset() {
+ _isCancelled = false;
+ _flags = USCXML_CTX_PRISTINE;
+ _configuration.reset();
+ _history.reset();
+ _initializedData.reset();
+ _invocations.reset();
+
+}
+
+bool MicroStepFast::isInState(const std::string& stateId) {
+#ifdef USCXML_VERBOSE
+ printStateNames(_configuration);
+#endif
+ if (_stateIds.find(stateId) == _stateIds.end())
+ return false;
+ return _configuration[_stateIds[stateId]];
+}
+
+std::list<xercesc::DOMElement*> MicroStepFast::getConfiguration() {
+ std::list<xercesc::DOMElement*> config;
+ size_t i = _configuration.find_first();
+ while(i != boost::dynamic_bitset<>::npos) {
+ config.push_back(_states[i]->element);
+ i = _configuration.find_next(i);
+ }
+ return config;
+}
+
+
+std::list<DOMElement*> MicroStepFast::getHistoryCompletion(const DOMElement* history) {
+ std::set<std::string> elements;
+ elements.insert(_xmlPrefix.str() + "history");
+ std::list<DOMElement*> histories = DOMUtils::inPostFixOrder(elements, _scxml);
+
+ std::list<DOMElement*> covered;
+ std::list<DOMElement*> perParentcovered;
+ const DOMNode* parent = NULL;
+
+ std::list<DOMElement*> completion;
+
+
+ if (parent != history->getParentNode()) {
+ covered.insert(covered.end(), perParentcovered.begin(), perParentcovered.end());
+ perParentcovered.clear();
+ parent = history->getParentNode();
+ }
+
+ bool deep = (HAS_ATTR(history, "type") && iequals(ATTR(history, "type"), "deep"));
+
+ for (size_t j = 0; j < _states.size(); j++) {
+ if (_states[j]->element == history)
+ continue;
+
+ if (DOMUtils::isDescendant((DOMNode*)_states[j]->element, history->getParentNode()) && isHistory(_states[j]->element)) {
+ ((DOMElement*)history)->setUserData(X("hasHistoryChild"), _states[j], NULL);
+ }
+
+ if (DOMUtils::isMember(_states[j]->element, covered))
+ continue;
+
+ if (deep) {
+ if (DOMUtils::isDescendant(_states[j]->element, history->getParentNode()) && !isHistory(_states[j]->element)) {
+ completion.push_back(_states[j]->element);
+ }
+ } else {
+ if (_states[j]->element->getParentNode() == history->getParentNode() && !isHistory(_states[j]->element)) {
+ completion.push_back(_states[j]->element);
+ }
+ }
+ }
+
+ return completion;
+}
+
+#ifdef USCXML_VERBOSE
+/**
+ * Print name of states contained in a (debugging).
+ */
+void MicroStepFast::printStateNames(const boost::dynamic_bitset<>& a) {
+ size_t i;
+ const char* seperator = "";
+ for (i = 0; i < a.size(); i++) {
+ if (BIT_HAS(i, a)) {
+ std::cerr << seperator << (HAS_ATTR(USCXML_GET_STATE(i).element, X("id")) ? ATTR(USCXML_GET_STATE(i).element, X("id")) : "UNK");
+ seperator = ", ";
+ }
+ }
+ std::cerr << std::endl;
+}
+#endif
+
+std::list<DOMElement*> MicroStepFast::getCompletion(const DOMElement* state) {
+
+ if (isHistory(state)) {
+ // we already did in setHistoryCompletion
+ return getHistoryCompletion(state);
+
+ } else if (isParallel(state)) {
+ return getChildStates(state);
+
+ } else if (HAS_ATTR(state, "initial")) {
+ return getStates(tokenize(ATTR(state, "initial")), _scxml);
+
+ } else {
+ std::list<DOMElement*> completion;
+
+ std::list<DOMElement*> initElems = DOMUtils::filterChildElements(_xmlPrefix.str() + "initial", state);
+ if(initElems.size() > 0) {
+ // initial element is first child
+ completion.push_back(initElems.front());
+ } else {
+ // first child state
+ DOMNodeList* children = state->getChildNodes();
+ for (size_t i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ if (isState(dynamic_cast<DOMElement*>(children->item(i)))) {
+ completion.push_back(dynamic_cast<DOMElement*>(children->item(i)));
+ break;
+ }
+ }
+ }
+ return completion;
+ }
+
+}
+
+
+#if 0
+/**
+ * See: http://www.w3.org/TR/scxml/#LegalStateConfigurations
+ */
+bool MicroStepFast::hasLegalConfiguration() {
+
+ // The configuration contains exactly one child of the <scxml> element.
+ std::list<DOMElement*> scxmlChilds = getChildStates(_scxml, true);
+ DOMNode* foundScxmlChild;
+ for (auto sIter = scxmlChilds.begin(); sIter != scxmlChilds.end(); sIter++) {
+ DOMElement* state = *sIter;
+ if (isMember(state, config)) {
+ if (foundScxmlChild) {
+ LOG(ERROR) << "Invalid configuration: Multiple childs of scxml root are active '" << ATTR_CAST(foundScxmlChild, "id") << "' and '" << ATTR_CAST(scxmlChilds[i], "id") << "'";
+ return false;
+ }
+ foundScxmlChild = scxmlChilds[i];
+ }
+ }
+ if (!foundScxmlChild) {
+ LOG(ERROR) << "Invalid configuration: No childs of scxml root are active";
+
+ return false;
+ }
+
+ // The configuration contains one or more atomic states.
+ bool foundAtomicState = false;
+ for (size_t i = 0; i < config.size(); i++) {
+ if (isAtomic(Element<std::string>(config[i]))) {
+ foundAtomicState = true;
+ break;
+ }
+ }
+ if (!foundAtomicState) {
+ LOG(ERROR) << "Invalid configuration: No atomic state is active";
+ return false;
+ }
+
+ // the configuration contains no history pseudo-states
+ for (size_t i = 0; i < config.size(); i++) {
+ if (isHistory(Element<std::string>(config[i]))) {
+ LOG(ERROR) << "Invalid configuration: history state " << ATTR_CAST(config[i], "id") << " is active";
+ return false;
+ }
+ }
+
+
+
+ // When the configuration contains an atomic state, it contains all of its <state> and <parallel> ancestors.
+ for (size_t i = 0; i < config.size(); i++) {
+ if (isAtomic(Element<std::string>(config[i]))) {
+ Node<std::string> parent = config[i];
+ while(((parent = parent.getParentNode()) && parent.getNodeType() == Node_base::ELEMENT_NODE)) {
+ if (isState(Element<std::string>(parent)) &&
+ (iequals(LOCALNAME(parent), "state") ||
+ iequals(LOCALNAME(parent), "parallel"))) {
+ if (!isMember(parent, config)) {
+ LOG(ERROR) << "Invalid configuration: atomic state '" << ATTR_CAST(config[i], "id") << "' is active, but parent '" << ATTR_CAST(parent, "id") << "' is not";
+ return false;
+ }
+ }
+ }
+ }
+ }
+
+ // When the configuration contains a non-atomic <state>, it contains one and only one of the state's children
+ for (size_t i = 0; i < config.size(); i++) {
+ Element<std::string> configElem(config[i]);
+ if (!isAtomic(configElem) && !isParallel(configElem)) {
+ Node<std::string> foundChildState;
+ //std::cerr << config[i] << std::endl;
+ NodeSet<std::string> childs = getChildStates(config[i]);
+ for (size_t j = 0; j < childs.size(); j++) {
+ //std::cerr << childs[j] << std::endl;
+ if (isMember(childs[j], config)) {
+ if (foundChildState) {
+ LOG(ERROR) << "Invalid configuration: Multiple childs of compound '" << ATTR_CAST(config[i], "id")
+ << "' are active '" << ATTR_CAST(foundChildState, "id") << "' and '" << ATTR_CAST(childs[j], "id") << "'";
+ return false;
+ }
+ foundChildState = childs[j];
+ }
+ }
+ if (!foundChildState) {
+ LOG(ERROR) << "Invalid configuration: No childs of compound '" << ATTR_CAST(config[i], "id") << "' are active";
+ return false;
+ }
+ }
+ }
+
+ // If the configuration contains a <parallel> state, it contains all of its children
+ for (size_t i = 0; i < config.size(); i++) {
+ if (isParallel(Element<std::string>(config[i]))) {
+ NodeSet<std::string> childs = getChildStates(config[i]);
+ for (size_t j = 0; j < childs.size(); j++) {
+ if (!isMember(childs[j], config) && !isHistory(Element<std::string>(childs[j]))) {
+ LOG(ERROR) << "Invalid configuration: Not all children of parallel '" << ATTR_CAST(config[i], "id") << "' are active i.e. '" << ATTR_CAST(childs[j], "id") << "' is not";
+ return false;
+ }
+ }
+ }
+ }
+
+ // everything worked out fine!
+ return true;
+}
+#endif
+
+} \ No newline at end of file
diff --git a/src/uscxml/interpreter/MicroStepFast.h b/src/uscxml/interpreter/MicroStepFast.h
new file mode 100644
index 0000000..c41be80
--- /dev/null
+++ b/src/uscxml/interpreter/MicroStepFast.h
@@ -0,0 +1,127 @@
+/**
+ * @file
+ * @author 2012-2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef INTERPRETERFAST_H_DA55E52B
+#define INTERPRETERFAST_H_DA55E52B
+
+//#define USCXML_VERBOSE 1
+
+#include <vector>
+#include <set>
+#include "MicroStepImpl.h"
+
+#include <boost/dynamic_bitset.hpp>
+
+namespace uscxml {
+
+class MicroStepFast : public MicroStepImpl {
+public:
+ MicroStepFast(MicroStepCallbacks* callbacks);
+ virtual ~MicroStepFast();
+
+ virtual InterpreterState step(bool blocking);
+ virtual void reset();
+ virtual bool isInState(const std::string& stateId);
+ virtual std::list<xercesc::DOMElement*> getConfiguration();
+ void markAsCancelled();
+
+protected:
+ class Transition {
+ public:
+ Transition() : element(NULL), source(0), onTrans(NULL), type(0) {}
+
+ xercesc::DOMElement* element;
+ boost::dynamic_bitset<> conflicts;
+ boost::dynamic_bitset<> exitSet;
+
+ uint32_t source;
+ boost::dynamic_bitset<> target;
+
+ xercesc::DOMElement* onTrans;
+
+ std::string event;
+ std::string cond;
+
+ unsigned char type;
+
+ };
+
+ class State {
+ public:
+ State() : element(NULL), parent(0), documentOrder(0), doneData(NULL), type(0) {}
+
+ xercesc::DOMElement* element;
+ boost::dynamic_bitset<> completion;
+ boost::dynamic_bitset<> children;
+ boost::dynamic_bitset<> ancestors;
+ uint32_t parent;
+ uint32_t documentOrder;
+
+ std::list<xercesc::DOMElement*> data;
+ std::list<xercesc::DOMElement*> invoke;
+ std::list<xercesc::DOMElement*> onEntry;
+ std::list<xercesc::DOMElement*> onExit;
+ xercesc::DOMElement* doneData;
+
+ unsigned char type;
+ };
+
+ virtual void init(xercesc::DOMElement* scxml);
+
+ std::list<xercesc::DOMElement*> getCompletion(const xercesc::DOMElement* state);
+
+ unsigned char _flags;
+ std::map<std::string, int> _stateIds;
+
+ std::vector<State*> _states;
+ std::vector<Transition*> _transitions;
+ std::list<xercesc::DOMElement*> _globalScripts;
+
+ boost::dynamic_bitset<> _configuration;
+ boost::dynamic_bitset<> _invocations;
+ boost::dynamic_bitset<> _history;
+ boost::dynamic_bitset<> _initializedData;
+
+ std::set<boost::dynamic_bitset<> > _microstepConfigurations;
+
+ Binding _binding;
+ xercesc::DOMElement* _scxml;
+ X _xmlPrefix;
+ X _xmlNS;
+
+ bool _isInitialized;
+ bool _isCancelled;
+ Event _event; // we do not care about the event's representation
+
+private:
+ std::list<xercesc::DOMElement*> getHistoryCompletion(const xercesc::DOMElement* state);
+ void resortStates(xercesc::DOMNode* node, const X& xmlPrefix);
+
+// bool hasLegalConfiguration();
+
+#ifdef USCXML_VERBOSE
+ void printStateNames(const boost::dynamic_bitset<>& bitset);
+#endif
+
+};
+
+}
+
+#endif /* end of include guard: INTERPRETERFAST_H_DA55E52B */
+
diff --git a/src/uscxml/interpreter/MicroStepImpl.h b/src/uscxml/interpreter/MicroStepImpl.h
new file mode 100644
index 0000000..71c03b5
--- /dev/null
+++ b/src/uscxml/interpreter/MicroStepImpl.h
@@ -0,0 +1,127 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef MICROSTEPIMPL_H_98233709
+#define MICROSTEPIMPL_H_98233709
+
+#include <memory>
+#include <mutex>
+#include <list>
+#include <map>
+#include <string>
+
+#include "uscxml/Common.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/interpreter/InterpreterMonitor.h"
+#include "uscxml/util/DOM.h"
+#include <xercesc/dom/DOM.hpp>
+
+namespace uscxml {
+
+enum InterpreterState {
+
+
+ USCXML_FINISHED = -2, ///< machine reached a final configuration and is done
+ USCXML_INTERRUPTED = -1, ///< machine received the empty event on the external queue
+ USCXML_UNDEF = 0, ///< not an actual state
+ USCXML_IDLE = 1, ///< stable configuration and queues empty
+ USCXML_INITIALIZED = 2, ///< DOM is setup and all external components instantiated
+ USCXML_INSTANTIATED = 3, ///< nothing really, just instantiated
+ USCXML_MICROSTEPPED = 4, ///< processed one transition set
+ USCXML_MACROSTEPPED = 5, ///< processed all transition sets and reached a stable configuration
+ USCXML_CANCELLED = 6, ///< machine was cancelled, step once more to finalize
+};
+
+class USCXML_API MicroStepCallbacks {
+public:
+ /** Event Queues / Matching */
+ virtual Event dequeueInternal() = 0;
+ virtual Event dequeueExternal(bool blocking) = 0;
+ virtual bool isMatched(const Event& event, const std::string& eventDesc) = 0;
+ virtual void raiseDoneEvent(xercesc::DOMElement* state, xercesc::DOMElement* doneData) = 0;
+
+ /** Datamodel */
+ virtual bool isTrue(const std::string& expr) = 0;
+ virtual void initData(xercesc::DOMElement* element) = 0;
+
+ /** Executable Content */
+ virtual void process(xercesc::DOMElement* block) = 0;
+
+ /** Invocations */
+ virtual void invoke(xercesc::DOMElement* invoke) = 0;
+ virtual void uninvoke(xercesc::DOMElement* invoke) = 0;
+
+ /** Monitoring */
+ virtual InterpreterMonitor* getMonitor() = 0;
+};
+
+class USCXML_API MicroStepImpl {
+public:
+ enum Binding {
+ EARLY = 0,
+ LATE = 1
+ };
+
+ MicroStepImpl(MicroStepCallbacks* callbacks) : _callbacks(callbacks) {}
+
+ virtual InterpreterState step(bool blocking) = 0;
+ virtual void reset() = 0; ///< Reset state machine
+ virtual bool isInState(const std::string& stateId) = 0;
+ virtual std::list<xercesc::DOMElement*> getConfiguration() = 0;
+
+ virtual void init(xercesc::DOMElement* scxml) = 0;
+ virtual void markAsCancelled() = 0;
+
+protected:
+ MicroStepCallbacks* _callbacks;
+
+};
+
+class USCXML_API MicroStep {
+public:
+ PIMPL_OPERATORS(MicroStep)
+
+ virtual InterpreterState step(bool blocking) {
+ return _impl->step(blocking);
+ }
+ virtual void reset() {
+ return _impl->reset();
+ }
+ virtual bool isInState(const std::string& stateId) {
+ return _impl->isInState(stateId);
+ }
+
+ std::list<xercesc::DOMElement*> getConfiguration() {
+ return _impl->getConfiguration();
+ }
+
+ virtual void init(xercesc::DOMElement* scxml) {
+ _impl->init(scxml);
+ }
+
+ virtual void markAsCancelled() {
+ _impl->markAsCancelled();
+ }
+protected:
+ std::shared_ptr<MicroStepImpl> _impl;
+};
+
+}
+
+#endif /* end of include guard: MICROSTEPIMPL_H_98233709 */
diff --git a/src/uscxml/messages/Blob.h b/src/uscxml/messages/Blob.h
index 835c73a..9bbf0f7 100644
--- a/src/uscxml/messages/Blob.h
+++ b/src/uscxml/messages/Blob.h
@@ -21,7 +21,7 @@
#define BLOB_H_E1B6D2C3
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "uscxml/Common.h"
@@ -65,36 +65,17 @@ protected:
class USCXML_API Blob {
public:
- Blob() : _impl() {}
- Blob(const boost::shared_ptr<BlobImpl> impl) : _impl(impl) { }
- Blob(const Blob& other) : _impl(other._impl) { }
- Blob(size_t size) : _impl(boost::shared_ptr<BlobImpl>(new BlobImpl(size))) {}
+ PIMPL_OPERATORS(Blob)
+
+ Blob(size_t size) : _impl(std::shared_ptr<BlobImpl>(new BlobImpl(size))) {}
Blob(const char* data,
size_t size,
const std::string& mimeType = "application/octet-stream",
bool adopt = false) :
- _impl(boost::shared_ptr<BlobImpl>(new BlobImpl(data, size, mimeType, adopt))) {}
- virtual ~Blob() {};
-
- operator bool() const {
- return !!_impl;
- }
- bool operator< (const Blob& other) const {
- return _impl < other._impl;
- }
- bool operator==(const Blob& other) const {
- return _impl == other._impl;
- }
- bool operator!=(const Blob& other) const {
- return _impl != other._impl;
- }
- Blob& operator= (const Blob& other) {
- _impl = other._impl;
- return *this;
- }
+ _impl(std::shared_ptr<BlobImpl>(new BlobImpl(data, size, mimeType, adopt))) {}
static Blob fromBase64(const std::string base64, const std::string& mimeType = "application/octet-stream") {
- return Blob(boost::shared_ptr<BlobImpl>(BlobImpl::fromBase64(base64, mimeType)));
+ return Blob(std::shared_ptr<BlobImpl>(BlobImpl::fromBase64(base64, mimeType)));
}
std::string base64() const {
@@ -124,7 +105,7 @@ public:
#ifdef SWIGIMPORTED
protected:
#endif
- boost::shared_ptr<BlobImpl> _impl;
+ std::shared_ptr<BlobImpl> _impl;
};
diff --git a/src/uscxml/messages/Data.cpp b/src/uscxml/messages/Data.cpp
index b555ed8..089de96 100644
--- a/src/uscxml/messages/Data.cpp
+++ b/src/uscxml/messages/Data.cpp
@@ -22,25 +22,21 @@
#include <boost/algorithm/string.hpp>
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/dom/NameSpacingParser.h"
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-#include <SAX/helpers/DefaultHandler.hpp>
-#include <SAX/helpers/CatchErrorHandler.hpp>
+#include "uscxml/util/DOM.h"
-#include "glog/logging.h"
+#include "easylogging++.h"
#ifdef HAS_STRING_H
#include <string.h>
#endif
extern "C" {
-#include "jsmn.h" // minimal json parser
+#include "jsmn/jsmn.h" // minimal json parser
}
namespace uscxml {
-Data::Data(const char* data, size_t size, const std::string& mimeType, bool adopt) : binary(data, size, mimeType, adopt) {}
+Data::Data(const char* data, size_t size, const std::string& mimeType, bool adopt) : node(NULL), binary(data, size, mimeType, adopt) {}
void Data::merge(const Data& other) {
if (other.compound.size() > 0) {
@@ -76,103 +72,6 @@ void Data::merge(const Data& other) {
}
}
-Data::Data(const Arabica::DOM::Node<std::string>& dom) {
- // we may need to convert some keys to arrays if we have the same name as an element
- std::map<std::string, std::list<Data> > arrays;
-// Interpreter::dump(dom);
-
- if (dom.hasAttributes()) {
- Arabica::DOM::NamedNodeMap<std::string> attributes = dom.getAttributes();
- for (size_t i = 0; i < attributes.getLength(); i++) {
- Arabica::DOM::Node<std::string> attribute = attributes.item(i);
-// Interpreter::dump(attribute);
-
- assert(attribute.getNodeType() == Arabica::DOM::Node_base::ATTRIBUTE_NODE);
- std::string key = attribute.getLocalName();
- std::string value = attribute.getNodeValue();
- compound[key] = Data(value, VERBATIM);
- }
- }
-
- if (dom.hasChildNodes()) {
- Arabica::DOM::NodeList<std::string> children = dom.getChildNodes();
- for (size_t i = 0; i < children.getLength(); i++) {
- Arabica::DOM::Node<std::string> child = children.item(i);
-// Interpreter::dump(child);
- std::string key;
- switch (child.getNodeType()) {
- case Arabica::DOM::Node_base::ELEMENT_NODE:
- key = TAGNAME_CAST(child);
- break;
- case Arabica::DOM::Node_base::ATTRIBUTE_NODE:
- key = ((Arabica::DOM::Attr<std::string>)child).getName();
- break;
- case Arabica::DOM::Node_base::TEXT_NODE:
- default:
- break;
- }
- if (key.length() == 0)
- continue;
-
- if (compound.find(key) != compound.end()) {
- // we already have such a key .. make it an array after we processed all children
- arrays[key].push_back(Data(child));
- } else {
- compound[key] = Data(child);
- }
- }
- } else {
- atom = dom.getNodeValue();
- type = VERBATIM;
- }
-
- std::map<std::string, std::list<Data> >::iterator arrayIter = arrays.begin();
- while(arrayIter != arrays.end()) {
- assert(compound.find(arrayIter->first) != compound.end());
- Data arrayData;
- arrays[arrayIter->first].push_front(compound[arrayIter->first]);
- arrayData.array = arrays[arrayIter->first];
- compound[arrayIter->first] = arrayData;
- }
-}
-
-Arabica::DOM::Document<std::string> Data::toDocument() {
- Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Arabica::DOM::Document<std::string> document = domFactory.createDocument("http://www.w3.org/2005/07/scxml", "message", 0);
- Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement();
- scxmlMsg.setPrefix("scxml");
- scxmlMsg.setAttribute("version", "1.0");
-
- if (compound.size() > 0 || array.size() > 0) {
- Arabica::DOM::Element<std::string> payloadElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "payload");
- payloadElem.setPrefix("scxml");
-
- scxmlMsg.appendChild(payloadElem);
-
- // we do not support nested attibutes
- if (compound.size() > 0) {
- std::map<std::string, Data>::iterator compoundIter = compound.begin();
- while(compoundIter != compound.end()) {
- if (compoundIter->second.atom.size() > 0) {
- Arabica::DOM::Element<std::string> propertyElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "property");
- propertyElem.setPrefix("scxml");
-
- propertyElem.setAttribute("name", compoundIter->first);
- Arabica::DOM::Text<std::string> textElem = document.createTextNode(compoundIter->second.atom);
- propertyElem.appendChild(textElem);
- payloadElem.appendChild(propertyElem);
- }
- compoundIter++;
- }
- }
- }
- return document;
-}
-
-Data Data::fromXML(const std::string& xmlString) {
- return Data();
-}
-
Data Data::fromJSON(const std::string& jsonString) {
Data data;
@@ -300,10 +199,14 @@ Data Data::fromJSON(const std::string& jsonString) {
}
std::ostream& operator<< (std::ostream& os, const Data& data) {
- os << Data::toJSON(data);
+ os << data.asJSON();
return os;
}
+std::string Data::asJSON() const {
+ return Data::toJSON(*this);
+}
+
std::string Data::toJSON(const Data& data) {
std::stringstream os;
std::string indent;
diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h
index c2e7dcf..55b9f64 100644
--- a/src/uscxml/messages/Data.h
+++ b/src/uscxml/messages/Data.h
@@ -22,13 +22,13 @@
#include <list>
#include <map>
-
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "uscxml/Common.h"
-#include "uscxml/Convenience.h"
+#include "uscxml/util/Convenience.h"
#include "uscxml/messages/Blob.h"
-#include <DOM/Document.hpp>
+
+#include <xercesc/dom/DOMDocument.hpp>
namespace uscxml {
@@ -41,22 +41,12 @@ public:
INTERPRETED,
};
- Data() : type(INTERPRETED) {}
+ Data() : node(NULL), type(INTERPRETED) {}
- // TODO: default INTERPRETED is unfortunate
- Data(const std::string& atom, Type type) : atom(atom), type(type) {}
Data(const char* data, size_t size, const std::string& mimeType, bool adopt = false);
// convenience constructors
- Data(short atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(int atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(unsigned int atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(long atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(unsigned long atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(long long int atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(float atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(double atom) : atom(toStr(atom)), type(INTERPRETED) {}
- Data(bool atom) : type(INTERPRETED) {
+ Data(bool atom) : node(NULL), type(VERBATIM) {
if (atom) {
this->atom = "true";
} else {
@@ -64,18 +54,18 @@ public:
}
}
- template <typename T> Data(T value, Type type) : atom(toStr(value)), type(type) {}
+ Data(xercesc::DOMNode* node) : node(node), type(VERBATIM) {}
+
+ // template <typename T> Data(T value, Type type = INTERPRETED) : atom(toStr(value)), type(type) {}
-#if 0
- // constructor for arbitrary types, skip if type is subclass though (C++11)
// we will have to drop this constructor as it interferes with operator Data() and requires C++11
template <typename T>
Data(T value, typename std::enable_if<! std::is_base_of<Data, T>::value>::type* = nullptr)
- : atom(toStr(value)), type(INTERPRETED) {}
-#endif
-
+ : node(NULL), atom(toStr(value)), type(VERBATIM) {}
+ template <typename T>
+ Data(T value, Type type, typename std::enable_if<! std::is_base_of<Data, T>::value>::type* = nullptr)
+ : node(NULL), atom(toStr(value)), type(type) {}
- explicit Data(const Arabica::DOM::Node<std::string>& dom);
~Data() {}
bool empty() const {
@@ -84,9 +74,20 @@ public:
}
bool operator<(const Data& other) const {
- std::string thisJSON = Data::toJSON(*this);
- std::string otherJSON = Data::toJSON(other);
- return (thisJSON < otherJSON);
+ if (other.atom != atom)
+ return other.atom < atom;
+ if (other.array != array)
+ return other.array < array;
+ if (other.compound != compound)
+ return other.compound < compound;
+ if (other.node != node)
+ return other.node < node;
+ if (other.binary != binary)
+ return other.binary < binary;
+ if (other.type != type)
+ return other.type < type;
+
+ return false;
}
void merge(const Data& other);
@@ -150,27 +151,7 @@ public:
}
bool operator==(const Data &other) const {
- if (other.atom.size() != atom.size())
- return false;
- if (other.type != type)
- return false;
- if (other.binary != binary)
- return false;
- if (other.array.size() != array.size())
- return false;
- if (other.compound.size() != compound.size())
- return false;
-
- if (other.atom != atom)
- return false;
- if (other.array != array)
- return false;
- if (other.compound != compound)
- return false;
- if (other.node != node)
- return false;
-
- return true;
+ return (*this < other || other < *this);
}
bool operator!=(const Data &other) const {
@@ -191,13 +172,8 @@ public:
static Data fromJSON(const std::string& jsonString);
static std::string toJSON(const Data& data);
- static Data fromXML(const std::string& xmlString);
- Arabica::DOM::Document<std::string> toDocument();
- std::string toXMLString() {
- std::stringstream ss;
- ss << toDocument();
- return ss.str();
- }
+ std::string asJSON() const;
+
std::map<std::string, Data> getCompound() {
return compound;
@@ -238,7 +214,8 @@ public:
protected:
#endif
- Arabica::DOM::Node<std::string> node;
+ xercesc::DOMNode* node;
+ std::shared_ptr<xercesc::DOMDocument*> adoptedDoc;
std::map<std::string, Data> compound;
std::list<Data> array;
std::string atom;
@@ -246,7 +223,6 @@ protected:
Type type;
protected:
- Arabica::DOM::Document<std::string> toNode(const Arabica::DOM::Document<std::string>& factory, const Data& data);
friend USCXML_API std::ostream& operator<< (std::ostream& os, const Data& data);
};
diff --git a/src/uscxml/messages/Event.cpp b/src/uscxml/messages/Event.cpp
index f247542..c4aa642 100644
--- a/src/uscxml/messages/Event.cpp
+++ b/src/uscxml/messages/Event.cpp
@@ -18,116 +18,17 @@
*/
#include "uscxml/messages/Event.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-#include <SAX/helpers/DefaultHandler.hpp>
-#include <SAX/helpers/CatchErrorHandler.hpp>
+#include "uscxml/util/DOM.h"
namespace uscxml {
-//Arabica::DOM::Node<std::string> Event::getFirstDOMElement() const {
-// return getFirstDOMElement(dom);
-//}
-//
-//Arabica::DOM::Document<std::string> Event::getStrippedDOM() const {
-// return getStrippedDOM(dom);
-//}
-
-//Arabica::DOM::Node<std::string> Event::getFirstDOMElement(const Arabica::DOM::Document<std::string> dom) {
-// Arabica::DOM::Node<std::string> data = dom.getDocumentElement().getFirstChild();
-// while (data) {
-// if (data.getNodeType() == Arabica::DOM::Node_base::TEXT_NODE) {
-// std::string trimmed = boost::trim_copy(data.getNodeValue());
-// if (trimmed.length() == 0) {
-// data = data.getNextSibling();
-// continue;
-// }
-// }
-// break;
-// }
-// return data;
-//}
-//
-//Arabica::DOM::Document<std::string> Event::getStrippedDOM(const Arabica::DOM::Document<std::string> dom) {
-// Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
-// Arabica::DOM::Document<std::string> document = domFactory.createDocument("", "", 0);
-// if (dom) {
-// document.getDocumentElement().appendChild(document.importNode(getFirstDOMElement(dom), true));
-// }
-// return document;
-//}
-
-std::string Event::toXMLString() {
- std::stringstream ss;
- ss << toDocument();
- return ss.str();
-}
-
-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::Element<std::string> scxmlMsg = document.getDocumentElement();
-
-
- scxmlMsg.setAttribute("source", origin);
- scxmlMsg.setAttribute("name", name);
-
- return document;
-}
-
-
-Event Event::fromXML(const std::string& xmlString) {
- Arabica::SAX2DOM::Parser<std::string> eventParser;
- Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
- eventParser.setErrorHandler(errorHandler);
-
- std::istringstream is(xmlString);
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setByteStream(is);
-
- Event event;
- if(eventParser.parse(inputSource) && eventParser.getDocument().hasChildNodes()) {
- Arabica::DOM::Element<std::string> scxmlMsg = eventParser.getDocument().getDocumentElement();
- if (HAS_ATTR(scxmlMsg, "name"))
- event.name = ATTR(scxmlMsg, "name");
- if (HAS_ATTR(scxmlMsg, "sendid"))
- event.sendid = ATTR(scxmlMsg, "sendid");
-
- Arabica::DOM::NodeList<std::string> payloads = scxmlMsg.getElementsByTagName("scxml:payload");
- if (payloads.getLength() > 0) {
- Arabica::DOM::Node<std::string> payload = payloads.item(0);
- if (payload.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) {
- Arabica::DOM::Element<std::string> payloadElem = (Arabica::DOM::Element<std::string>)payload;
- Arabica::DOM::NodeList<std::string> properties = payloadElem.getElementsByTagName("scxml:property");
- if (properties.getLength() > 0) {
- for (size_t i = 0; i < properties.getLength(); i++) {
- if (HAS_ATTR_CAST(properties.item(i), "name")) {
- std::string key = ATTR_CAST(properties.item(i), "name");
- std::string value;
- Arabica::DOM::NodeList<std::string> childs = properties.item(i).getChildNodes();
- for (size_t j = 0; j < childs.getLength(); j++) {
- if (childs.item(j).getNodeType() == Arabica::DOM::Node_base::TEXT_NODE) {
- value = childs.item(j).getNodeValue();
- break;
- }
- }
- event.data.compound[key] = Data(value, Data::VERBATIM);
- }
- }
- }
- }
- }
- }
- return event;
-}
-
std::ostream& operator<< (std::ostream& os, const Event& event) {
std::string indent;
for (size_t i = 0; i < _dataIndentation; i++) {
indent += " ";
}
- os << indent << (event.eventType == Event::EXTERNAL ? "External" : "Internal") << " Event " << (event.dom ? "with DOM attached" : "") << std::endl;
+// os << indent << (event.eventType == Event::EXTERNAL ? "External" : "Internal") << " Event " << (event.dom ? "with DOM attached" : "") << std::endl;
if (event.name.size() > 0)
os << indent << " name: " << event.name << std::endl;
@@ -135,8 +36,8 @@ std::ostream& operator<< (std::ostream& os, const Event& event) {
os << indent << " origin: " << event.origin << std::endl;
if (event.origintype.size() > 0)
os << indent << " origintype: " << event.origintype << std::endl;
- if (event.content.size() > 0)
- os << indent << " content: '" << event.content << "'" << std::endl;
+// if (event.content.size() > 0)
+// os << indent << " content: '" << event.content << "'" << std::endl;
if (event.params.size() > 0) {
std::multimap<std::string, Data>::const_iterator paramIter = event.params.begin();
os << indent << " params:" << std::endl;
diff --git a/src/uscxml/messages/Event.h b/src/uscxml/messages/Event.h
index 94bc386..8b7bb91 100644
--- a/src/uscxml/messages/Event.h
+++ b/src/uscxml/messages/Event.h
@@ -21,28 +21,35 @@
#define EVENT_H_6174D929
#include "uscxml/messages/Data.h"
+#include "uscxml/util/UUID.h"
+
+#define ERROR_PLATFORM_THROW(msg) \
+ ErrorEvent e; \
+ e.name = "error.platform"; \
+ e.data.compound["cause"] = Data(msg, Data::VERBATIM); \
+ throw e; \
#define ERROR_EXECUTION(identifier, cause) \
- uscxml::Event identifier; \
+ uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
identifier.name = "error.execution"; \
identifier.eventType = uscxml::Event::PLATFORM;
#define ERROR_EXECUTION2(identifier, cause, node) \
- uscxml::Event identifier; \
+ uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
identifier.name = "error.execution"; \
identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
identifier.eventType = uscxml::Event::PLATFORM;
#define ERROR_COMMUNICATION(identifier, cause) \
- uscxml::Event identifier; \
+ uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
identifier.name = "error.communication"; \
identifier.eventType = uscxml::Event::PLATFORM;
#define ERROR_COMMUNICATION2(identifier, cause, node) \
- uscxml::Event identifier; \
+ uscxml::ErrorEvent identifier; \
identifier.data.compound["cause"] = uscxml::Data(cause, uscxml::Data::VERBATIM); \
identifier.name = "error.communication"; \
identifier.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(node), uscxml::Data::VERBATIM); \
@@ -82,9 +89,8 @@ public:
PLATFORM = 3
};
- Event() : eventType(INTERNAL), hideSendId(false) {}
+ Event() : eventType(INTERNAL), hideSendId(false), uuid(UUID::getUUID()) {}
Event(const std::string& name, Type type = INTERNAL) : name(name), eventType(type), hideSendId(false) {}
- Event(const Arabica::DOM::Node<std::string>& xmlString) : eventType(INTERNAL), hideSendId(false) {};
bool operator< (const Event& other) const {
return this < &other;
}
@@ -99,105 +105,8 @@ public:
return !(*this == other);
}
- std::string getName() const {
- return name;
- }
- void setName(const std::string& name) {
- this->name = name;
- }
-
- Type getEventType() const {
- return eventType;
- }
- void setEventType(const Type type) {
- this->eventType = type;
- }
-
- std::string getOrigin() const {
- return origin;
- }
- void setOrigin(const std::string& origin) {
- this->origin = origin;
- }
-
- std::string getOriginType() const {
- return origintype;
- }
- void setOriginType(const std::string& originType) {
- this->origintype = originType;
- }
-
- Arabica::DOM::Node<std::string> getDOM() const {
- return dom;
- }
- void setDOM(const Arabica::DOM::Node<std::string>& dom) {
- this->dom = dom;
- }
-
-// Arabica::DOM::Node<std::string> getFirstDOMElement() const;
-// Arabica::DOM::Document<std::string> getStrippedDOM() const;
-//
-// static Arabica::DOM::Node<std::string> getFirstDOMElement(const Arabica::DOM::Document<std::string> dom);
-// static Arabica::DOM::Document<std::string> getStrippedDOM(const Arabica::DOM::Document<std::string> dom);
-
- std::string getRaw() const {
- return raw;
- }
- void setRaw(const std::string& raw) {
- this->raw = raw;
- }
-
- std::string getContent() const {
- return content;
- }
- void setContent(const std::string& content) {
- this->content = content;
- }
-
- std::string getXML() const {
- return xml;
- }
- void setXML(const std::string& xml) {
- this->xml = xml;
- }
-
- std::string getSendId() const {
- return sendid;
- }
- void setSendId(const std::string& sendId) {
- this->sendid = sendId;
- }
-
- std::string getInvokeId() const {
- return invokeid;
- }
- void setInvokeId(const std::string& invokeId) {
- this->invokeid = invokeId;
- }
-
- Data getData() const {
- return data;
- }
- void setData(const Data& data) {
- this->data = data;
- }
-
- static Event fromXML(const std::string& xmlString);
- Arabica::DOM::Document<std::string> toDocument();
- std::string toXMLString();
-
- std::map<std::string, Data>& getNameList() {
- return namelist;
- }
- std::multimap<std::string, Data>& getParams() {
- return params;
- }
-
- void setNameList(const std::map<std::string, Data>& nameList) {
- this->namelist = nameList;
- }
- void setParams(const std::multimap<std::string, Data>& params) {
- this->params = params;
+ operator bool() {
+ return name.size() > 0;
}
typedef std::multimap<std::string, Data> params_t;
@@ -225,7 +134,7 @@ public:
template <typename T> static bool getParam(const params_t& params, const std::string& name, T& target) {
if (params.find(name) != params.end()) {
- target = boost::lexical_cast<T>(params.find(name)->second.atom);
+ target = strTo<T>(params.find(name)->second.atom);
return true;
}
return false;
@@ -252,7 +161,7 @@ public:
if (params.find(name) != params.end()) {
std::pair<params_t::const_iterator, params_t::const_iterator> rangeIter = params.equal_range(name);
while(rangeIter.first != rangeIter.second) {
- target.push_back(boost::lexical_cast<T>(rangeIter.first->second.atom));
+ target.push_back(strTo<T>(rangeIter.first->second.atom));
rangeIter.first++;
}
return true;
@@ -260,31 +169,35 @@ public:
return false;
}
-
-#ifdef SWIGIMPORTED
-protected:
-#endif
-
std::string raw;
- std::string xml;
std::string name;
Type eventType;
std::string origin;
std::string origintype;
- Arabica::DOM::Node<std::string> dom;
std::string sendid;
- bool hideSendId;
+ bool hideSendId; // sendid is assumed to be undef with some ecma tests
std::string invokeid;
Data data;
- std::string content;
std::map<std::string, Data> namelist;
std::multimap<std::string, Data> params;
+ std::string uuid; // the sendid is not necessarily unique!
friend USCXML_API std::ostream& operator<< (std::ostream& os, const Event& event);
};
USCXML_API std::ostream& operator<< (std::ostream& os, const Event& event);
+
+class USCXML_API ErrorEvent : public Event {
+public:
+ ErrorEvent() : Event() {}
+ ErrorEvent(const std::string& msg) : Event("error.platform") {
+ data.compound["msg"] = msg;
+ }
+};
+
}
+
+
#endif /* end of include guard: EVENT_H_6174D929 */
diff --git a/src/uscxml/messages/InvokeRequest.cpp b/src/uscxml/messages/InvokeRequest.cpp
deleted file mode 100644
index e56a6ff..0000000
--- a/src/uscxml/messages/InvokeRequest.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/messages/InvokeRequest.h"
-#include <DOM/Simple/DOMImplementation.hpp>
-#include <DOM/Document.hpp>
-#include <DOM/io/Stream.hpp>
-
-namespace uscxml {
-
-std::string InvokeRequest::toXMLString() {
- std::stringstream ss;
- ss << toDocument();
- return ss.str();
-}
-
-Arabica::DOM::Document<std::string> InvokeRequest::toDocument() {
- Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Arabica::DOM::Document<std::string> document = Event::toDocument();
- Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement();
-
- scxmlMsg.setAttribute("invokeid", invokeid);
-
- return document;
-}
-
-InvokeRequest InvokeRequest::fromXML(const std::string& xmlString) {
- Event::fromXML(xmlString);
- return InvokeRequest();
-}
-
-std::ostream& operator<< (std::ostream& os, const InvokeRequest& invokeReq) {
-
- std::string indent;
- for (size_t i = 0; i < _dataIndentation; i++) {
- indent += " ";
- }
-
- os << indent << "InvokeReq" << (invokeReq.autoForward ? " with autoforward" : "") << std::endl;
-
- if (invokeReq.type.size() > 0)
- os << indent << " type: " << invokeReq.type << std::endl;
-
- if (invokeReq.src.size() > 0)
- os<< indent << " src: " << invokeReq.src << std::endl;
-
-#if 0
- if (invokeReq.namelist.size() > 0) {
- os << indent << " namelist: " << std::endl;
- InvokeRequest::namelist_t::const_iterator namelistIter = invokeReq.namelist.begin();
- while(namelistIter != invokeReq.namelist.end()) {
- os << indent << " " << namelistIter->first << ": " << namelistIter->second << std::endl;
- namelistIter++;
- }
- }
-
- if (invokeReq.params.size() > 0) {
- os << indent << " params: " << std::endl;
- InvokeRequest::params_t::const_iterator paramIter = invokeReq.params.begin();
- while(paramIter != invokeReq.params.end()) {
- os << indent << " " << paramIter->first << ": " << paramIter->second << std::endl;
- paramIter++;
- }
- }
-
- if (invokeReq.content.size() > 0)
- os << indent << " content: " << invokeReq.content << std::endl;
-#endif
-
- _dataIndentation++;
- os << (Event)invokeReq;
- _dataIndentation--;
- return os;
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/messages/InvokeRequest.h b/src/uscxml/messages/InvokeRequest.h
deleted file mode 100644
index 6f597fe..0000000
--- a/src/uscxml/messages/InvokeRequest.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef INVOKEREQUEST_H_BAF058E2
-#define INVOKEREQUEST_H_BAF058E2
-
-#include "uscxml/messages/Event.h"
-
-namespace uscxml {
-
-class USCXML_API InvokeRequest : public Event {
-public:
- InvokeRequest(Event event) : Event(event) {}
- InvokeRequest() {}
-
- std::string getType() {
- return type;
- }
- void setType(const std::string& type) {
- this->type = type;
- }
-
- std::string getSource() {
- return src;
- }
- void setSource(const std::string& src) {
- this->src = src;
- }
-
- bool isAutoForwarded() {
- return autoForward;
- }
- void setAutoForwarded(bool autoForward) {
- this->autoForward = autoForward;
- }
-
- static InvokeRequest fromXML(const std::string& xmlString);
- Arabica::DOM::Document<std::string> toDocument();
- std::string toXMLString();
-
-#ifdef SWIGIMPORTED
-protected:
-#endif
- std::string type;
- std::string src;
- bool autoForward;
- Arabica::DOM::Element<std::string> elem;
-
- friend USCXML_API std::ostream& operator<< (std::ostream& os, const InvokeRequest& sendReq);
-
-};
-
-USCXML_API std::ostream& operator<< (std::ostream& os, const InvokeRequest& invokeReq);
-
-}
-
-#endif /* end of include guard: INVOKEREQUEST_H_BAF058E2 */
diff --git a/src/uscxml/messages/MMIMessages.cpp b/src/uscxml/messages/MMIMessages.cpp
deleted file mode 100644
index 814be5f..0000000
--- a/src/uscxml/messages/MMIMessages.cpp
+++ /dev/null
@@ -1,549 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <string> // MSVC will croak with operator+ on strings if this is not first
-
-#include "MMIMessages.h"
-
-#include <DOM/Simple/DOMImplementation.hpp>
-#include <DOM/io/Stream.hpp>
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-#include <SAX/helpers/InputSourceResolver.hpp>
-
-#include <uscxml/dom/DOMUtils.h>
-
-#include <boost/algorithm/string.hpp>
-
-#define TO_EVENT_OPERATOR(type, name, base)\
-type::operator Event() const { \
- Event ev = base::operator Event();\
- ev.setName(name);\
- if (representation == MMI_AS_XML) \
- ev.setDOM(toXML());\
- return ev;\
-}
-
-#define FIND_MSG_ELEM(elem, doc) \
-Element<std::string> elem; \
-if (encapsulateInMMI) { \
- elem = Element<std::string>(doc.getDocumentElement().getFirstChild()); \
-} else { \
- elem = Element<std::string>(doc.getDocumentElement()); \
-}
-
-#define FROM_XML(clazz, enumType, base) \
-clazz clazz::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) { \
- clazz event = base::fromXML(node, interpreter); \
- event.type = enumType; \
- return event; \
-}
-
-#define STRING_ATTR_OR_EXPR(element, name)\
-(element.hasAttributeNS(nameSpace, "name##Expr") && interpreter ? \
- interpreter->getDataModel().evalAsString(element.getAttributeNS(nameSpace, "name##Expr")) : \
- (element.hasAttributeNS(nameSpace, #name) ? element.getAttributeNS(nameSpace, #name) : "") \
-)
-
-#define FIND_EVENT_NODE(node)\
-if (node.getNodeType() == Node_base::DOCUMENT_NODE) \
- node = node.getFirstChild(); \
-while (node) {\
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {\
- if (boost::iequals(node.getLocalName(), "MMI")) {\
- node = node.getFirstChild();\
- continue;\
- } else {\
- break;\
- }\
- }\
- node = node.getNextSibling();\
-}\
-
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-
-std::string MMIEvent::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
-
-MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) {
- if (!node || node.getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE)
- return INVALID;
-
- // MMI container?
- if (boost::iequals(node.getLocalName(), "MMI")) {
- node = node.getFirstChild();
- if (!node)
- return INVALID;
- while(node.getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE) {
- node = node.getNextSibling();
- if (!node)
- return INVALID;
- }
- }
-
- if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST"))
- return NEWCONTEXTREQUEST;
- if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE"))
- return NEWCONTEXTRESPONSE;
- if (boost::iequals(node.getLocalName(), "PREPAREREQUEST"))
- return PREPAREREQUEST;
- if (boost::iequals(node.getLocalName(), "PREPARERESPONSE"))
- return PREPARERESPONSE;
- if (boost::iequals(node.getLocalName(), "STARTREQUEST"))
- return STARTREQUEST;
- if (boost::iequals(node.getLocalName(), "STARTRESPONSE"))
- return STARTRESPONSE;
- if (boost::iequals(node.getLocalName(), "DONENOTIFICATION"))
- return DONENOTIFICATION;
- if (boost::iequals(node.getLocalName(), "CANCELREQUEST"))
- return CANCELREQUEST;
- if (boost::iequals(node.getLocalName(), "CANCELRESPONSE"))
- return CANCELRESPONSE;
- if (boost::iequals(node.getLocalName(), "PAUSEREQUEST"))
- return PAUSEREQUEST;
- if (boost::iequals(node.getLocalName(), "PAUSERESPONSE"))
- return PAUSERESPONSE;
- if (boost::iequals(node.getLocalName(), "RESUMEREQUEST"))
- return RESUMEREQUEST;
- if (boost::iequals(node.getLocalName(), "RESUMERESPONSE"))
- return RESUMERESPONSE;
- if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION"))
- return EXTENSIONNOTIFICATION;
- if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST"))
- return CLEARCONTEXTREQUEST;
- if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE"))
- return CLEARCONTEXTRESPONSE;
- if (boost::iequals(node.getLocalName(), "STATUSREQUEST"))
- return STATUSREQUEST;
- if (boost::iequals(node.getLocalName(), "STATUSRESPONSE"))
- return STATUSRESPONSE;
- return INVALID;
-}
-
-Arabica::DOM::Document<std::string> MMIEvent::toXML(bool encapsulateInMMI) const {
- Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Document<std::string> doc = domFactory.createDocument(nameSpace, "", 0);
- Element<std::string> msgElem = doc.createElementNS(nameSpace, tagName);
- msgElem.setAttributeNS(nameSpace, "Source", source);
- msgElem.setAttributeNS(nameSpace, "Target", target);
- msgElem.setAttributeNS(nameSpace, "RequestID", requestId);
-
- if (dataDOM) {
- Element<std::string> dataElem = doc.createElementNS(nameSpace, "Data");
- Node<std::string> importNode = doc.importNode(dataDOM, true);
- dataElem.appendChild(importNode);
- msgElem.appendChild(dataElem);
- } else if (data.size() > 0) {
- Element<std::string> dataElem = doc.createElementNS(nameSpace, "Data");
- Text<std::string> textElem = doc.createTextNode(data);
- dataElem.appendChild(textElem);
- msgElem.appendChild(dataElem);
- }
-
- if (encapsulateInMMI) {
- Element<std::string> mmiElem = doc.createElementNS(nameSpace, "mmi");
- mmiElem.appendChild(msgElem);
- doc.appendChild(mmiElem);
- } else {
- doc.appendChild(msgElem);
- }
- return doc;
-}
-
-Arabica::DOM::Document<std::string> ContentRequest::toXML(bool encapsulateInMMI) const {
- Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI);
- FIND_MSG_ELEM(msgElem, doc);
-
- if (contentURL.href.size() > 0) {
- Element<std::string> contentURLElem = doc.createElementNS(nameSpace, "ContentURL");
- contentURLElem.setAttributeNS(nameSpace, "href", contentURL.href);
- contentURLElem.setAttributeNS(nameSpace, "fetchtimeout", contentURL.fetchTimeout);
- contentURLElem.setAttributeNS(nameSpace, "max-age", contentURL.maxAge);
- msgElem.appendChild(contentURLElem);
- } else if (contentDOM) {
- Element<std::string> contentElem = doc.createElementNS(nameSpace, "Content");
- Node<std::string> importNode = doc.importNode(contentDOM, true);
- contentElem.appendChild(importNode);
- msgElem.appendChild(contentElem);
- } else if (content.size() > 0) {
- Element<std::string> contentElem = doc.createElementNS(nameSpace, "Content");
- Text<std::string> textElem = doc.createTextNode(content);
- contentElem.appendChild(textElem);
- msgElem.appendChild(contentElem);
- }
- return doc;
-}
-
-Arabica::DOM::Document<std::string> ContextualizedRequest::toXML(bool encapsulateInMMI) const {
- Document<std::string> doc = MMIEvent::toXML(encapsulateInMMI);
- FIND_MSG_ELEM(msgElem, doc);
- msgElem.setAttributeNS(nameSpace, "Context", context);
- return doc;
-}
-
-Arabica::DOM::Document<std::string> ExtensionNotification::toXML(bool encapsulateInMMI) const {
- Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI);
- FIND_MSG_ELEM(msgElem, doc);
- msgElem.setAttributeNS(nameSpace, "Name", name);
- return doc;
-}
-
-Arabica::DOM::Document<std::string> StatusResponse::toXML(bool encapsulateInMMI) const {
- Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI);
- FIND_MSG_ELEM(msgElem, doc);
- if (status == ALIVE) {
- msgElem.setAttributeNS(nameSpace, "Status", "alive");
- } else if(status == DEAD) {
- msgElem.setAttributeNS(nameSpace, "Status", "dead");
- } else if(status == FAILURE) {
- msgElem.setAttributeNS(nameSpace, "Status", "failure");
- } else if(status == SUCCESS) {
- msgElem.setAttributeNS(nameSpace, "Status", "success");
- }
- return doc;
-}
-
-Arabica::DOM::Document<std::string> StatusInfoResponse::toXML(bool encapsulateInMMI) const {
- Document<std::string> doc = StatusResponse::toXML(encapsulateInMMI);
- FIND_MSG_ELEM(msgElem, doc);
-
- Element<std::string> statusInfoElem = doc.createElementNS(nameSpace, "StatusInfo");
- Text<std::string> statusInfoText = doc.createTextNode(statusInfo);
- statusInfoElem.appendChild(statusInfoText);
- msgElem.appendChild(statusInfoElem);
-
- return doc;
-}
-
-Arabica::DOM::Document<std::string> StatusRequest::toXML(bool encapsulateInMMI) const {
- Document<std::string> doc = ContextualizedRequest::toXML(encapsulateInMMI);
- FIND_MSG_ELEM(msgElem, doc);
-
- if (automaticUpdate) {
- msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "true");
- } else {
- msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "false");
- }
-
- return doc;
-}
-
-
-
-MMIEvent MMIEvent::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- MMIEvent msg;
-
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- msg.source = STRING_ATTR_OR_EXPR(msgElem, Source);
- msg.target = STRING_ATTR_OR_EXPR(msgElem, Target);
- msg.requestId = STRING_ATTR_OR_EXPR(msgElem, RequestID);
- msg.tagName = msgElem.getLocalName();
-
- Element<std::string> dataElem;
-
- // search for data element
- node = msgElem.getFirstChild();
- while (node) {
- if (node.getNodeType() == Node_base::ELEMENT_NODE)
- dataElem = Element<std::string>(node);
- if (dataElem && boost::iequals(dataElem.getLocalName(), "data"))
- break;
- node = node.getNextSibling();
- }
-
- if (dataElem && boost::iequals(dataElem.getLocalName(), "data") && dataElem.getFirstChild()) {
- Arabica::DOM::Node<std::string> dataChild = dataElem.getFirstChild();
- std::stringstream ss;
-
- while (dataChild) {
- if (dataChild.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE)
- msg.dataDOM = dataChild;
- ss << dataChild;
- dataChild = dataChild.getNextSibling();
- }
- msg.data = ss.str();
- }
-
- return msg;
-}
-
-FROM_XML(NewContextRequest, NEWCONTEXTREQUEST, MMIEvent)
-
-FROM_XML(PauseRequest, PAUSEREQUEST, ContextualizedRequest)
-FROM_XML(ResumeRequest, RESUMEREQUEST, ContextualizedRequest)
-FROM_XML(ClearContextRequest, CLEARCONTEXTREQUEST, ContextualizedRequest)
-FROM_XML(CancelRequest, CANCELREQUEST, ContextualizedRequest)
-
-FROM_XML(PrepareRequest, PREPAREREQUEST, ContentRequest)
-FROM_XML(StartRequest, STARTREQUEST, ContentRequest)
-
-FROM_XML(PrepareResponse, PREPARERESPONSE, StatusInfoResponse)
-FROM_XML(StartResponse, STARTRESPONSE, StatusInfoResponse)
-FROM_XML(CancelResponse, CANCELRESPONSE, StatusInfoResponse)
-FROM_XML(PauseResponse, PAUSERESPONSE, StatusInfoResponse)
-FROM_XML(ResumeResponse, RESUMERESPONSE, StatusInfoResponse)
-FROM_XML(ClearContextResponse, CLEARCONTEXTRESPONSE, StatusInfoResponse)
-FROM_XML(NewContextResponse, NEWCONTEXTRESPONSE, StatusInfoResponse)
-FROM_XML(DoneNotification, DONENOTIFICATION, StatusInfoResponse)
-
-
-ContextualizedRequest ContextualizedRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- ContextualizedRequest msg(MMIEvent::fromXML(node, interpreter));
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- msg.context = STRING_ATTR_OR_EXPR(msgElem, Context);
- return msg;
-}
-
-ExtensionNotification ExtensionNotification::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- ExtensionNotification msg(ContextualizedRequest::fromXML(node, interpreter));
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- msg.name = STRING_ATTR_OR_EXPR(msgElem, Name);
- msg.type = EXTENSIONNOTIFICATION;
- return msg;
-}
-
-ContentRequest ContentRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- ContentRequest msg(ContextualizedRequest::fromXML(node, interpreter));
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- Element<std::string> contentElem;
-
- node = msgElem.getFirstChild();
- while (node) {
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {
- contentElem = Element<std::string>(node);
- if (boost::iequals(contentElem.getLocalName(), "content") ||
- boost::iequals(contentElem.getLocalName(), "contentURL"))
- break;
- }
- node = node.getNextSibling();
- }
-
- if (contentElem) {
- if(boost::iequals(contentElem.getLocalName(), "content")) {
- Arabica::DOM::Node<std::string> contentChild = contentElem.getFirstChild();
- std::stringstream ss;
-
- while (contentChild) {
- if (contentChild.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE)
- msg.contentDOM = contentChild;
- ss << contentChild;
- contentChild = contentChild.getNextSibling();
- }
- msg.content = ss.str();
-
- } else if(boost::iequals(contentElem.getLocalName(), "contentURL")) {
- msg.contentURL.href = STRING_ATTR_OR_EXPR(contentElem, href);
- msg.contentURL.maxAge = STRING_ATTR_OR_EXPR(contentElem, max-age);
- msg.contentURL.fetchTimeout = STRING_ATTR_OR_EXPR(contentElem, fetchtimeout);
- }
- }
-
- //msg.content = msgElem.getAttributeNS(nameSpace, "Context");
- return msg;
-}
-
-StatusResponse StatusResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- StatusResponse msg(ContextualizedRequest::fromXML(node, interpreter));
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- std::string status = STRING_ATTR_OR_EXPR(msgElem, Status);
-
- if (boost::iequals(status, "ALIVE")) {
- msg.status = ALIVE;
- } else if(boost::iequals(status, "DEAD")) {
- msg.status = DEAD;
- } else if(boost::iequals(status, "FAILURE")) {
- msg.status = FAILURE;
- } else if(boost::iequals(status, "SUCCESS")) {
- msg.status = SUCCESS;
- } else {
- msg.status = INVALID;
- }
- msg.type = STATUSRESPONSE;
- return msg;
-}
-
-StatusInfoResponse StatusInfoResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- StatusInfoResponse msg(StatusResponse::fromXML(node, interpreter));
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- Element<std::string> statusInfoElem;
-
- node = msgElem.getFirstChild();
- while (node) {
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {
- statusInfoElem = Element<std::string>(node);
- if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo"))
- break;
- }
- node = node.getNextSibling();
- }
-
- if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo")) {
- node = statusInfoElem.getFirstChild();
- while (node) {
- if (node.getNodeType() == Node_base::TEXT_NODE) {
- msg.statusInfo = node.getNodeValue();
- break;
- }
- node = node.getNextSibling();
- }
- }
- return msg;
-}
-
-
-StatusRequest StatusRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
- StatusRequest msg(ContextualizedRequest::fromXML(node, interpreter));
- FIND_EVENT_NODE(node);
-
- Element<std::string> msgElem(node);
- std::string autoUpdate = STRING_ATTR_OR_EXPR(msgElem, RequestAutomaticUpdate);
-
- if (boost::iequals(autoUpdate, "true")) {
- msg.automaticUpdate = true;
- } else if(boost::iequals(autoUpdate, "on")) {
- msg.automaticUpdate = true;
- } else if(boost::iequals(autoUpdate, "yes")) {
- msg.automaticUpdate = true;
- } else if(boost::iequals(autoUpdate, "1")) {
- msg.automaticUpdate = true;
- } else {
- msg.automaticUpdate = false;
- }
- msg.type = STATUSREQUEST;
- return msg;
-}
-
-
-
-#ifdef MMI_WITH_OPERATOR_EVENT
-
-TO_EVENT_OPERATOR(NewContextRequest, "mmi.request.newcontext", MMIEvent);
-TO_EVENT_OPERATOR(PauseRequest, "mmi.request.pause", ContextualizedRequest);
-TO_EVENT_OPERATOR(ResumeRequest, "mmi.request.resume", ContextualizedRequest);
-TO_EVENT_OPERATOR(CancelRequest, "mmi.request.cancel", ContextualizedRequest);
-TO_EVENT_OPERATOR(ClearContextRequest, "mmi.request.clearcontext", ContextualizedRequest);
-TO_EVENT_OPERATOR(StatusRequest, "mmi.request.status", ContextualizedRequest);
-
-TO_EVENT_OPERATOR(PrepareRequest, "mmi.request.prepare", ContentRequest);
-TO_EVENT_OPERATOR(StartRequest, "mmi.request.start", ContentRequest);
-
-TO_EVENT_OPERATOR(PrepareResponse, "mmi.response.prepare", StatusInfoResponse);
-TO_EVENT_OPERATOR(StartResponse, "mmi.response.start", StatusInfoResponse);
-TO_EVENT_OPERATOR(CancelResponse, "mmi.response.cancel", StatusInfoResponse);
-TO_EVENT_OPERATOR(PauseResponse, "mmi.response.pause", StatusInfoResponse);
-TO_EVENT_OPERATOR(ResumeResponse, "mmi.response.resume", StatusInfoResponse);
-TO_EVENT_OPERATOR(ClearContextResponse, "mmi.response.clearcontext", StatusInfoResponse);
-TO_EVENT_OPERATOR(NewContextResponse, "mmi.response.newcontext", StatusInfoResponse);
-TO_EVENT_OPERATOR(DoneNotification, "mmi.notification.done", StatusInfoResponse);
-
-
-MMIEvent::operator Event() const {
- Event ev;
- ev.setOriginType("mmi.event");
- ev.setOrigin(source);
-
- if (representation == MMI_AS_DATA) {
- if (dataDOM) {
- ev.data.node = dataDOM;
- } else {
- ev.data = Data::fromJSON(data);
- if (ev.data.empty()) {
- ev.content = data;
- }
- }
- }
- return ev;
-}
-
-ContextualizedRequest::operator Event() const {
- Event ev = MMIEvent::operator Event();
- // do we want to represent the context? It's the interpreters name already
- return ev;
-}
-
-ExtensionNotification::operator Event() const {
- Event ev = ContextualizedRequest::operator Event();
- if (name.length() > 0) {
- ev.setName(name);
- } else {
- ev.setName("mmi.notification.extension");
- }
- return ev;
-}
-
-ContentRequest::operator Event() const {
- Event ev = ContextualizedRequest::operator Event();
- if (representation == MMI_AS_DATA) {
- if (content.length() > 0)
- ev.data.compound["content"] = Data(content, Data::VERBATIM);
- if (contentURL.fetchTimeout.length() > 0)
- ev.data.compound["contentURL"].compound["fetchTimeout"] = Data(contentURL.fetchTimeout, Data::VERBATIM);
- if (contentURL.href.length() > 0)
- ev.data.compound["contentURL"].compound["href"] = Data(contentURL.href, Data::VERBATIM);
- if (contentURL.maxAge.length() > 0)
- ev.data.compound["contentURL"].compound["maxAge"] = Data(contentURL.maxAge, Data::VERBATIM);
- }
- return ev;
-}
-
-StatusResponse::operator Event() const {
- Event ev = ContextualizedRequest::operator Event();
- ev.setName("mmi.response.status");
-
- if (representation == MMI_AS_DATA) {
- switch (status) {
- case ALIVE:
- ev.data.compound["status"] = Data("alive", Data::VERBATIM);
- break;
- case DEAD:
- ev.data.compound["status"] = Data("dead", Data::VERBATIM);
- break;
- case SUCCESS:
- ev.data.compound["status"] = Data("success", Data::VERBATIM);
- break;
- case FAILURE:
- ev.data.compound["status"] = Data("failure", Data::VERBATIM);
- break;
- default:
- ev.data.compound["status"] = Data("invalid", Data::VERBATIM);
- }
- } else {
- ev.dom = toXML();
- }
-
- return ev;
-}
-
-#endif
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/messages/MMIMessages.h b/src/uscxml/messages/MMIMessages.h
deleted file mode 100644
index 3538816..0000000
--- a/src/uscxml/messages/MMIMessages.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef MMIEVENT_H_OS0SE7H5
-#define MMIEVENT_H_OS0SE7H5
-
-#define MMI_WITH_OPERATOR_EVENT 1
-
-#include <iostream>
-#include <DOM/Node.hpp>
-#include <DOM/Document.hpp>
-#include <uscxml/Interpreter.h>
-
-namespace uscxml {
-
-class MMIEvent {
-public:
- enum Type {
- NEWCONTEXTREQUEST,
- NEWCONTEXTRESPONSE,
- PREPAREREQUEST,
- PREPARERESPONSE,
- STARTREQUEST,
- STARTRESPONSE,
- DONENOTIFICATION,
- CANCELREQUEST,
- CANCELRESPONSE,
- PAUSEREQUEST,
- PAUSERESPONSE,
- RESUMEREQUEST,
- RESUMERESPONSE,
- EXTENSIONNOTIFICATION,
- CLEARCONTEXTREQUEST,
- CLEARCONTEXTRESPONSE,
- STATUSREQUEST,
- STATUSRESPONSE,
- INVALID
- };
-
- enum RepresentationType {
- MMI_AS_DATA,
- MMI_AS_XML
- };
- static Type getType(Arabica::DOM::Node<std::string> node);
-
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- static MMIEvent fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- // conversion operator
- operator Event() const;
-#endif
-
- std::string source;
- std::string target;
- std::string data;
- Arabica::DOM::Node<std::string> dataDOM;
- std::string requestId;
-
- std::string tagName;
- Type type;
- RepresentationType representation;
-
- static std::string nameSpace;
-
-protected:
- MMIEvent() : representation(MMI_AS_DATA) {}
-};
-
-class NewContextRequest : public MMIEvent {
-public:
- NewContextRequest() {
- tagName = "NewContextRequest";
- type = NEWCONTEXTREQUEST;
- }
- NewContextRequest(const MMIEvent& father) : MMIEvent(father) {}
- static NewContextRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
- std::string token; ///< special token for server-less modality components
-};
-
-class ContextualizedRequest : public MMIEvent {
-public:
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- static ContextualizedRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
- std::string context;
-protected:
- ContextualizedRequest() {}
- ContextualizedRequest(const MMIEvent& father) : MMIEvent(father) {}
-};
-
-class PauseRequest : public ContextualizedRequest {
-public:
- PauseRequest() {
- tagName = "PauseRequest";
- type = PAUSEREQUEST;
- }
- PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static PauseRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
-};
-class ResumeRequest : public ContextualizedRequest {
-public:
- ResumeRequest() {
- tagName = "ResumeRequest";
- type = RESUMEREQUEST;
- }
- ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static ResumeRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
-};
-class CancelRequest : public ContextualizedRequest {
-public:
- CancelRequest() {
- tagName = "CancelRequest";
- type = CANCELREQUEST;
- }
- CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static CancelRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
-};
-class ClearContextRequest : public ContextualizedRequest {
-public:
- ClearContextRequest() {
- tagName = "ClearContextRequest";
- type = CLEARCONTEXTREQUEST;
- }
- ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static ClearContextRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
-};
-class StatusRequest : public ContextualizedRequest {
-public:
- StatusRequest() {
- tagName = "StatusRequest";
- type = STARTREQUEST;
- }
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- static StatusRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
- bool automaticUpdate;
-protected:
- StatusRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
-};
-
-class ContentRequest : public ContextualizedRequest {
-public:
- struct ContentURL {
- std::string href;
- std::string maxAge;
- std::string fetchTimeout;
- };
-
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- static ContentRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
- std::string content;
- Arabica::DOM::Node<std::string> contentDOM;
- ContentURL contentURL;
-protected:
- ContentRequest() {}
- ContentRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
-};
-
-class PrepareRequest : public ContentRequest {
-public:
- PrepareRequest() {
- tagName = "PrepareRequest";
- type = PREPAREREQUEST;
- }
- PrepareRequest(const ContentRequest& father) : ContentRequest(father) {}
- static PrepareRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class StartRequest : public ContentRequest {
-public:
- StartRequest() {
- tagName = "StartRequest";
- type = STARTREQUEST;
- }
- StartRequest(const ContentRequest& father) : ContentRequest(father) {}
- static StartRequest fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
-};
-
-class ExtensionNotification : public ContextualizedRequest {
-public:
- ExtensionNotification() {
- tagName = "ExtensionNotification";
- type = EXTENSIONNOTIFICATION;
- }
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- static ExtensionNotification fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
- std::string name;
-protected:
- ExtensionNotification(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
-
-};
-
-class StatusResponse : public ContextualizedRequest {
-public:
- enum Status {
- INVALID = 0,
- ALIVE = 1,
- DEAD = 2,
- SUCCESS = 3,
- FAILURE = 4
- };
-
- StatusResponse() {
- tagName = "StatusResponse";
- type = STATUSRESPONSE;
- status = INVALID;
- }
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- static StatusResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
- Status status;
-protected:
- StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
-};
-
-class StatusInfoResponse : public StatusResponse {
-public:
- virtual Arabica::DOM::Document<std::string> toXML(bool encapsulateInMMI = true) const;
- StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
- static StatusInfoResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
- std::string statusInfo;
-protected:
- StatusInfoResponse() {}
-};
-
-class PrepareResponse : public StatusInfoResponse {
-public:
- PrepareResponse() {
- tagName = "PrepareResponse";
- type = PREPARERESPONSE;
- }
- PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static PrepareResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-
-};
-
-class StartResponse : public StatusInfoResponse {
-public:
- StartResponse() {
- tagName = "StartResponse";
- type = STARTRESPONSE;
- }
- StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static StartResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class CancelResponse : public StatusInfoResponse {
-public:
- CancelResponse() {
- tagName = "CancelResponse";
- type = CANCELRESPONSE;
- }
- CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static CancelResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class PauseResponse : public StatusInfoResponse {
-public:
- PauseResponse() {
- tagName = "PauseResponse";
- type = PAUSERESPONSE;
- }
- PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static PauseResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class ResumeResponse : public StatusInfoResponse {
-public:
- ResumeResponse() {
- tagName = "ResumeResponse";
- type = RESUMERESPONSE;
- }
- ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static ResumeResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class ClearContextResponse : public StatusInfoResponse {
-public:
- ClearContextResponse() {
- tagName = "ClearContextResponse";
- type = CLEARCONTEXTRESPONSE;
- }
- ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static ClearContextResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class NewContextResponse : public StatusInfoResponse {
-public:
- NewContextResponse() {
- tagName = "NewContextResponse";
- type = NEWCONTEXTRESPONSE;
- }
- NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static NewContextResponse fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-class DoneNotification : public StatusInfoResponse {
-public:
- DoneNotification() {
- tagName = "DoneNotification";
- type = DONENOTIFICATION;
- }
- DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static DoneNotification fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter = NULL);
-
-#ifdef MMI_WITH_OPERATOR_EVENT
- operator Event() const;
-#endif
-};
-
-}
-
-#endif /* end of include guard: MMIEVENT_H_OS0SE7H5 */
diff --git a/src/uscxml/messages/SendRequest.cpp b/src/uscxml/messages/SendRequest.cpp
deleted file mode 100644
index 4759d29..0000000
--- a/src/uscxml/messages/SendRequest.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/messages/SendRequest.h"
-#include <DOM/Simple/DOMImplementation.hpp>
-#include <DOM/Document.hpp>
-#include <DOM/io/Stream.hpp>
-
-namespace uscxml {
-
-std::string SendRequest::toXMLString() {
- std::stringstream ss;
- ss << toDocument();
- return ss.str();
-}
-
-Arabica::DOM::Document<std::string> SendRequest::toDocument() {
- Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Arabica::DOM::Document<std::string> document = Event::toDocument();
- Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement();
-
- // add params and namelist
- if (params.size() > 0 || namelist.size() > 0) {
- Arabica::DOM::NodeList<std::string> payload = scxmlMsg.getElementsByTagName("scxml:payload");
- if (payload.getLength() == 0) {
- Arabica::DOM::Element<std::string> payloadElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "payload");
- payloadElem.setPrefix("scxml");
-
- scxmlMsg.appendChild(payloadElem);
- }
- Arabica::DOM::Node<std::string> payloadElem = scxmlMsg.getElementsByTagName("scxml:payload").item(0);
-
- // add parameters
- std::multimap<std::string, Data>::iterator paramIter = params.begin();
- while(paramIter != params.end()) {
- Arabica::DOM::Element<std::string> propertyElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "property");
- propertyElem.setPrefix("scxml");
-
- propertyElem.setAttribute("name", paramIter->first);
- // this is simplified - Data might be more elaborate than a simple string atom
- Arabica::DOM::Text<std::string> textElem = document.createTextNode(paramIter->second.atom);
- propertyElem.appendChild(textElem);
- payloadElem.appendChild(propertyElem);
- paramIter++;
- }
-
- // add namelist elements
- std::map<std::string, Data>::iterator namelistIter = namelist.begin();
- while(namelistIter != namelist.end()) {
- Arabica::DOM::Element<std::string> propertyElem = document.createElementNS("http://www.w3.org/2005/07/scxml", "property");
- propertyElem.setPrefix("scxml");
-
- propertyElem.setAttribute("name", namelistIter->first);
- // this is simplified - Data might be more elaborate than a simple string atom
- Arabica::DOM::Text<std::string> textElem = document.createTextNode(namelistIter->second.atom);
- propertyElem.appendChild(textElem);
- payloadElem.appendChild(propertyElem);
- namelistIter++;
- }
-
- }
-
- scxmlMsg.setAttribute("sendid", sendid);
-
- return document;
-}
-
-SendRequest SendRequest::fromXML(const std::string& xmlString) {
- Event::fromXML(xmlString);
- return SendRequest();
-}
-
-std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq) {
-
- std::string indent;
- for (size_t i = 0; i < _dataIndentation; i++) {
- indent += " ";
- }
-
- os << indent << "SendReq" << std::endl;
-
- if (sendReq.target.size() > 0)
- os << indent << " target: " << sendReq.target << std::endl;
-
- if (sendReq.type.size() > 0)
- os << indent << " type: " << sendReq.type << std::endl;
-
- if (sendReq.delayMs > 0)
- os<< indent << " delay: " << sendReq.delayMs << std::endl;
-#if 0
- if (sendReq.namelist.size() > 0) {
- os << indent << " namelist: " << std::endl;
- SendRequest::namelist_t::const_iterator namelistIter = sendReq.namelist.begin();
- while(namelistIter != sendReq.namelist.end()) {
- os << indent << " " << namelistIter->first << ": " << namelistIter->second << std::endl;
- namelistIter++;
- }
- }
-
- if (sendReq.params.size() > 0) {
- os << indent << " params: " << std::endl;
- SendRequest::params_t::const_iterator paramIter = sendReq.params.begin();
- while(paramIter != sendReq.params.end()) {
- os << indent << " " << paramIter->first << ": " << paramIter->second << std::endl;
- paramIter++;
- }
- }
-
- if (sendReq.content.size() > 0)
- os << indent << " content: " << sendReq.content << std::endl;
-#endif
- _dataIndentation++;
- os << (Event)sendReq;
- _dataIndentation--;
- return os;
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/messages/SendRequest.h b/src/uscxml/messages/SendRequest.h
deleted file mode 100644
index 369fc65..0000000
--- a/src/uscxml/messages/SendRequest.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SENDREQUEST_H_86B0F6A0
-#define SENDREQUEST_H_86B0F6A0
-
-#include "uscxml/messages/Event.h"
-
-namespace uscxml {
-
-class USCXML_API SendRequest : public Event {
-public:
- SendRequest() : delayMs(0) {}
- SendRequest(Event event) : Event(event) {}
-
- std::string getTarget() {
- return target;
- }
- void setTarget(const std::string& target) {
- this->target = target;
- }
-
- std::string getType() {
- return type;
- }
- void setType(const std::string& type) {
- this->type = type;
- }
-
- uint32_t getDelayMs() {
- return delayMs;
- }
- void setDelayMs(uint32_t delayMs) {
- this->delayMs = delayMs;
- }
-
- static SendRequest fromXML(const std::string& xmlString);
- Arabica::DOM::Document<std::string> toDocument();
- std::string toXMLString();
-
-#ifdef SWIGIMPORTED
-protected:
-#endif
- std::string target;
- std::string type;
- uint32_t delayMs;
- Arabica::DOM::Element<std::string> elem;
-
- friend USCXML_API std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq);
-
-};
-
-USCXML_API std::ostream& operator<< (std::ostream& os, const SendRequest& sendReq);
-
-}
-
-#endif /* end of include guard: SENDREQUEST_H_86B0F6A0 */
diff --git a/src/uscxml/pch.h b/src/uscxml/pch.h
deleted file mode 100644
index c69abce..0000000
--- a/src/uscxml/pch.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/Common.h"
-
-#include <boost/algorithm/string.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/lexical_cast.hpp>
-
-#include <iostream>
-#include <set>
-#include <map>
-#include <list>
-#include <vector>
-#include <string>
-
-#include <DOM/Document.hpp> \ No newline at end of file
diff --git a/src/uscxml/plugins/DataModel.h b/src/uscxml/plugins/DataModel.h
index 5cbd0c8..b08f934 100644
--- a/src/uscxml/plugins/DataModel.h
+++ b/src/uscxml/plugins/DataModel.h
@@ -20,10 +20,9 @@
#ifndef DATAMODEL_H_F1F776F9
#define DATAMODEL_H_F1F776F9
-#include "uscxml/config.h"
#include "uscxml/Common.h"
-#include "uscxml/InterpreterInfo.h"
-#include "uscxml/plugins/EventHandler.h"
+#include "uscxml/plugins/Invoker.h"
+#include "uscxml/plugins/IOProcessor.h"
#ifndef TIME_BLOCK
# ifdef BUILD_PROFILING
@@ -35,17 +34,27 @@
#endif
#include <list>
-#include <boost/shared_ptr.hpp>
#include <string>
+#include <memory>
#include <sstream>
-#include "DOM/Document.hpp"
+#include <xercesc/dom/DOM.hpp>
namespace uscxml {
class InterpreterImpl;
class DataModelImpl;
+class USCXML_API DataModelCallbacks {
+public:
+ virtual const std::string& getName() = 0;
+ virtual const std::string& getSessionId() = 0;
+ virtual const std::map<std::string, IOProcessor>& getIOProcessors() = 0;
+ virtual bool isInState(const std::string& stateId) = 0;
+ virtual xercesc::DOMDocument* getDocument() const = 0;
+ virtual const std::map<std::string, Invoker>& getInvokers() = 0;
+};
+
class USCXML_API DataModelExtension {
public:
DataModelExtension() : dm(NULL) {}
@@ -59,16 +68,13 @@ public:
class USCXML_API DataModelImpl {
public:
virtual ~DataModelImpl() {}
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter) = 0;
+ virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* interpreter) = 0;
virtual std::list<std::string> getNames() = 0;
- virtual bool validate(const std::string& location, const std::string& schema) = 0;
- virtual bool isLocation(const std::string& expr) = 0;
virtual bool isValidSyntax(const std::string& expr) {
return true; // overwrite when datamodel supports it
}
virtual void setEvent(const Event& event) = 0;
- virtual Data getStringAsData(const std::string& content) = 0;
size_t replaceExpressions(std::string& content);
@@ -78,19 +84,10 @@ public:
const std::string& array,
const std::string& index,
uint32_t iteration) = 0;
- virtual void pushContext() = 0;
- virtual void popContext() = 0;
-
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr) = 0;
- virtual std::string evalAsString(const std::string& expr) = 0;
-
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& scriptNode,
- const std::string& expr) = 0;
- virtual bool evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
- }
+ virtual Data getAsData(const std::string& content) = 0;
+ virtual Data evalAsData(const std::string& content) = 0;
+ virtual bool evalAsBool(const std::string& expr) = 0;
virtual bool isDeclared(const std::string& expr) = 0;
@@ -107,18 +104,11 @@ public:
* <data id="Var1" expr="return"/>
*
*/
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content) = 0;
virtual void assign(const std::string& location, const Data& data) = 0;
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content) = 0;
virtual void init(const std::string& location, const Data& data) = 0;
- virtual void setInterpreter(InterpreterInfo* interpreter) {
- _interpreter = interpreter;
+ virtual void setCallbacks(DataModelCallbacks* callbacks) {
+ _callbacks = callbacks;
}
virtual void addExtension(DataModelExtension* ext);
@@ -127,14 +117,14 @@ public:
}
protected:
- InterpreterInfo* _interpreter;
+ DataModelCallbacks* _callbacks;
};
class USCXML_API DataModel {
public:
DataModel() : _impl() {}
- DataModel(const boost::shared_ptr<DataModelImpl> impl) : _impl(impl) { }
+ DataModel(const std::shared_ptr<DataModelImpl> impl) : _impl(impl) { }
DataModel(const DataModel& other) : _impl(other._impl) { }
virtual ~DataModel() {};
@@ -160,14 +150,6 @@ public:
return _impl->getNames();
}
- virtual bool validate(const std::string& location, const std::string& schema) {
- TIME_BLOCK
- return _impl->validate(location, schema);
- }
- virtual bool isLocation(const std::string& expr) {
- TIME_BLOCK
- return _impl->isLocation(expr);
- }
virtual bool isValidSyntax(const std::string& expr) {
TIME_BLOCK
return _impl->isValidSyntax(expr);
@@ -177,38 +159,19 @@ public:
TIME_BLOCK
return _impl->setEvent(event);
}
- virtual Data getStringAsData(const std::string& content) {
+ virtual Data getAsData(const std::string& content) {
TIME_BLOCK
- return _impl->getStringAsData(content);
+ return _impl->getAsData(content);
}
-
- virtual void pushContext() {
+ virtual Data evalAsData(const std::string& content) {
TIME_BLOCK
- return _impl->pushContext();
- }
- virtual void popContext() {
- TIME_BLOCK
- return _impl->popContext();
+ return _impl->evalAsData(content);
}
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr) {
- TIME_BLOCK
- return _impl->eval(scriptElem, expr);
- }
- virtual std::string evalAsString(const std::string& expr) {
- TIME_BLOCK
- return _impl->evalAsString(expr);
- }
virtual bool evalAsBool(const std::string& expr) {
TIME_BLOCK
return _impl->evalAsBool(expr);
}
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& scriptNode,
- const std::string& expr) {
- TIME_BLOCK
- return _impl->evalAsBool(scriptNode, expr);
- }
virtual uint32_t getLength(const std::string& expr) {
TIME_BLOCK
@@ -222,23 +185,11 @@ public:
return _impl->setForeach(item, array, index, iteration);
}
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content) {
- TIME_BLOCK
- return _impl->assign(assignElem, node, content);
- }
virtual void assign(const std::string& location, const Data& data) {
TIME_BLOCK
return _impl->assign(location, data);
}
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content) {
- TIME_BLOCK
- return _impl->init(dataElem, node, content);
- }
virtual void init(const std::string& location, const Data& data) {
TIME_BLOCK
return _impl->init(location, data);
@@ -259,9 +210,9 @@ public:
return _impl->andExpressions(expressions);
}
- virtual void setInterpreter(InterpreterInfo* interpreter) {
+ virtual void setCallbacks(DataModelCallbacks* callbacks) {
TIME_BLOCK
- _impl->setInterpreter(interpreter);
+ _impl->setCallbacks(callbacks);
}
virtual void addExtension(DataModelExtension* ext) {
@@ -274,7 +225,7 @@ public:
#endif
protected:
- boost::shared_ptr<DataModelImpl> _impl;
+ std::shared_ptr<DataModelImpl> _impl;
};
diff --git a/src/uscxml/plugins/EventHandler.h b/src/uscxml/plugins/EventHandler.h
index 91703fc..401afec 100644
--- a/src/uscxml/plugins/EventHandler.h
+++ b/src/uscxml/plugins/EventHandler.h
@@ -21,14 +21,15 @@
#define EVENTHANDLER_H_2801243E
#include "uscxml/Common.h"
+#include "uscxml/messages/Data.h"
+#include "uscxml/messages/Event.h"
#include <list>
-#include <boost/shared_ptr.hpp>
#include <string>
+#include <memory>
#include <sstream>
-#include "DOM/Document.hpp"
-#include "uscxml/messages/SendRequest.h"
+#include <xercesc/dom/DOM.hpp>
namespace uscxml {
@@ -36,54 +37,19 @@ class InterpreterImpl;
class USCXML_API EventHandlerImpl {
public:
+ EventHandlerImpl() {}
virtual ~EventHandlerImpl() {}
virtual std::list<std::string> getNames() = 0;
-
- virtual void setInterpreter(InterpreterImpl* interpreter) {
- _interpreter = interpreter;
- }
- void setInvokeId(const std::string& invokeId) {
- _invokeId = invokeId;
- }
- void setType(const std::string& type) {
- _type = type;
- }
- std::string getType() {
- return _type;
- }
-
- void setElement(const Arabica::DOM::Element<std::string>& element) {
- _element = element;
- }
-
- Arabica::DOM::Element<std::string> getElement() {
- return _element;
- }
-
virtual Data getDataModelVariables() = 0;
- virtual void send(const SendRequest& req) = 0;
-
- virtual void runOnMainThread() {};
- void returnErrorExecution(const std::string&);
- void returnErrorCommunication(const std::string&);
- void returnEvent(Event& event, bool internal = false);
protected:
InterpreterImpl* _interpreter;
- Arabica::DOM::Element<std::string> _element;
- std::string _invokeId;
- std::string _type;
-
-
};
class USCXML_API EventHandler {
public:
- EventHandler() : _impl() {}
- EventHandler(boost::shared_ptr<EventHandlerImpl> const impl) : _impl(impl) { }
- EventHandler(const EventHandler& other) : _impl(other._impl) { }
- virtual ~EventHandler() {};
+ PIMPL_OPERATORS(EventHandler);
virtual std::list<std::string> getNames() {
return _impl->getNames();
@@ -92,37 +58,9 @@ public:
virtual Data getDataModelVariables() const {
return _impl->getDataModelVariables();
};
- virtual void send(const SendRequest& req) {
- return _impl->send(req);
- };
- virtual void runOnMainThread() {
- return _impl->runOnMainThread();
- }
-
- void setInterpreter(InterpreterImpl* interpreter) {
- _impl->setInterpreter(interpreter);
- }
- void setInvokeId(const std::string& invokeId) {
- _impl->setInvokeId(invokeId);
- }
-
- void setType(const std::string& type) {
- _impl->setType(type);
- }
- std::string getType() {
- return _impl->getType();
- }
-
- void setElement(const Arabica::DOM::Element<std::string>& element) {
- _impl->setElement(element);
- }
-
- Arabica::DOM::Element<std::string> getElement() {
- return _impl->getElement();
- }
protected:
- boost::shared_ptr<EventHandlerImpl> _impl;
+ std::shared_ptr<EventHandlerImpl> _impl;
friend class InterpreterImpl;
};
diff --git a/src/uscxml/plugins/ExecutableContent.h b/src/uscxml/plugins/ExecutableContent.h
index 6df197c..0190820 100644
--- a/src/uscxml/plugins/ExecutableContent.h
+++ b/src/uscxml/plugins/ExecutableContent.h
@@ -21,10 +21,10 @@
#define EXECUTABLECONTENT_H_1E028A2D
#include "uscxml/Common.h"
-#include <boost/shared_ptr.hpp>
#include <string>
+#include <memory>
#include <sstream>
-#include "DOM/Document.hpp"
+#include "xercesc/dom/DOM.hpp"
namespace uscxml {
@@ -34,7 +34,7 @@ class USCXML_API ExecutableContentImpl {
public:
ExecutableContentImpl() {};
virtual ~ExecutableContentImpl() {};
- virtual boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) = 0;
+ virtual std::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) = 0;
virtual void setInterpreter(InterpreterImpl* interpreter) {
_interpreter = interpreter;
@@ -44,8 +44,8 @@ public:
virtual std::string getNamespace() {
return "http://www.w3.org/2005/07/scxml"; ///< The namespace of the element.
}
- virtual void enterElement(const Arabica::DOM::Element<std::string>& node) = 0; ///< Invoked when entering the element as part of evaluating executable content.
- virtual void exitElement(const Arabica::DOM::Element<std::string>& node) = 0; ///< Invoked when exiting the element as part of evaluating executable content.
+ virtual void enterElement(xercesc::DOMElement* node) = 0; ///< Invoked when entering the element as part of evaluating executable content.
+ virtual void exitElement(xercesc::DOMElement* 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:
@@ -55,7 +55,7 @@ protected:
class USCXML_API ExecutableContent {
public:
ExecutableContent() : _impl() {}
- ExecutableContent(boost::shared_ptr<ExecutableContentImpl> const impl) : _impl(impl) { }
+ ExecutableContent(std::shared_ptr<ExecutableContentImpl> const impl) : _impl(impl) { }
ExecutableContent(const ExecutableContent& other) : _impl(other._impl) { }
virtual ~ExecutableContent() {};
@@ -86,17 +86,17 @@ public:
std::string getNamespace() {
return _impl->getNamespace();
}
- void enterElement(const Arabica::DOM::Element<std::string>& node) {
+ void enterElement(xercesc::DOMElement* node) {
return _impl->enterElement(node);
}
- void exitElement(const Arabica::DOM::Element<std::string>& node) {
+ void exitElement(xercesc::DOMElement* node) {
return _impl->exitElement(node);
}
bool processChildren() {
return _impl->processChildren();
}
protected:
- boost::shared_ptr<ExecutableContentImpl> _impl;
+ std::shared_ptr<ExecutableContentImpl> _impl;
};
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/plugins/Factory.cpp
index 9ff2148..7c68a30 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/plugins/Factory.cpp
@@ -19,91 +19,18 @@
#include "uscxml/config.h"
-#include "uscxml/Factory.h"
-#include "uscxml/Message.h"
+#include "uscxml/plugins/Factory.h"
+#include "uscxml/messages/Data.h"
#include "uscxml/Interpreter.h"
-#include <glog/logging.h>
-
-#include "uscxml/server/InterpreterServlet.h"
-
-#include "uscxml/plugins/datamodel/null/NULLDataModel.h"
+#include <easylogging++.h>
// see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
-#ifdef BUILD_AS_PLUGINS
-# include "uscxml/plugins/Plugins.h"
-#else
-
-# include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
-# include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h"
-# include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h"
-
-# ifndef BUILD_MINIMAL
-# include "uscxml/plugins/invoker/imap/IMAPInvoker.h"
-# ifdef CURL_HAS_SMTP
-# include "uscxml/plugins/invoker/smtp/SMTPInvoker.h"
-# endif
-# include "uscxml/plugins/invoker/xhtml/XHTMLInvoker.h"
-# include "uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h"
-# include "uscxml/plugins/invoker/system/SystemInvoker.h"
-# include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
-# include "uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h"
-
-# include "uscxml/plugins/datamodel/xpath/XPathDataModel.h"
-# include "uscxml/plugins/datamodel/promela/PromelaDataModel.h"
-
-# include "uscxml/plugins/element/file/FileElement.h"
-# include "uscxml/plugins/element/fetch/FetchElement.h"
-# include "uscxml/plugins/element/respond/RespondElement.h"
-# include "uscxml/plugins/element/postpone/PostponeElement.h"
-
-# include "uscxml/plugins/ioprocessor/comet/CometIOProcessor.h"
-# include "uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h"
-
-# endif
-
-
-#ifdef PROTOBUF_FOUND
-//# include "uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h"
-#endif
-
-# if (defined UMUNDO_FOUND && defined PROTOBUF_FOUND)
-# include "uscxml/plugins/invoker/umundo/UmundoInvoker.h"
-#endif
-
-# ifdef OPENSCENEGRAPH_FOUND
-# include "uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h"
-# include "uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h"
-# endif
-
-# ifdef MILES_FOUND
-# include "uscxml/plugins/invoker/miles/MilesSessionInvoker.h"
-//# include "uscxml/plugins/invoker/miles/SpatialAudio.h"
-# endif
-
-# ifdef FFMPEG_FOUND
-# include "uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h"
-# endif
-
-# ifdef LIBICAL_FOUND
-# include "uscxml/plugins/invoker/calendar/CalendarInvoker.h"
-# endif
-
-# ifdef LIBPURPLE_FOUND
-# include "uscxml/plugins/invoker/im/IMInvoker.h"
-# endif
-
-# if (defined EXPECT_FOUND && defined TCL_FOUND)
-# include "uscxml/plugins/invoker/expect/ExpectInvoker.h"
-# endif
-
-#ifdef OPENAL_FOUND
-# include "uscxml/plugins/invoker/audio/OpenALInvoker.h"
-#endif
-
-# ifdef CORELOCATION_FOUND
-# include "uscxml/plugins/invoker/location/CoreLocation/LocationInvoker.h"
-# endif
+// we will always include these in a build
+#include "uscxml/plugins/datamodel/null/NULLDataModel.h"
+#include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h"
+#include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h"
+#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
# ifdef V8_FOUND
# include "uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h"
@@ -113,24 +40,10 @@
# include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h"
# endif
-# ifdef SWI_FOUND
-# include "uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h"
-# endif
-
# ifdef LUA_FOUND
# include "uscxml/plugins/datamodel/lua/LuaDataModel.h"
# endif
-# if 0
-# include "uscxml/plugins/element/mmi/MMIEvents.h"
-# endif
-
-#endif
-
-#define ELEMENT_MMI_REGISTER(class)\
-class##Element* class = new class##Element(); \
-registerExecutableContent(class);
-
namespace uscxml {
@@ -153,262 +66,49 @@ std::string Factory::getDefaultPluginPath() {
}
void Factory::registerPlugins() {
- {
- InterpreterHTTPServlet* ioProcessor = new InterpreterHTTPServlet();
- registerIOProcessor(ioProcessor);
- }
- {
- InterpreterWebSocketServlet* ioProcessor = new InterpreterWebSocketServlet();
- registerIOProcessor(ioProcessor);
- }
- {
- NULLDataModel* dataModel = new NULLDataModel();
- registerDataModel(dataModel);
- }
-
-#ifdef BUILD_AS_PLUGINS
- // these are part of core
-
- if (_pluginPath.length() == 0) {
- // try to read USCXML_PLUGIN_PATH environment variable
- _pluginPath = (getenv("USCXML_PLUGIN_PATH") != NULL ? getenv("USCXML_PLUGIN_PATH") : "");
- }
- if (_pluginPath.length() > 0) {
- pluma.acceptProviderType<InvokerImplProvider>();
- pluma.acceptProviderType<IOProcessorImplProvider>();
- pluma.acceptProviderType<DataModelImplProvider>();
- pluma.acceptProviderType<ExecutableContentImplProvider>();
- pluma.loadFromFolder(_pluginPath);
-
- std::vector<InvokerImplProvider*> invokerProviders;
- pluma.getProviders(invokerProviders);
- for (std::vector<InvokerImplProvider*>::iterator it = invokerProviders.begin() ; it != invokerProviders.end() ; ++it) {
- InvokerImpl* invoker = (*it)->create();
- registerInvoker(invoker);
- }
-
- std::vector<IOProcessorImplProvider*> ioProcessorProviders;
- pluma.getProviders(ioProcessorProviders);
- for (std::vector<IOProcessorImplProvider*>::iterator it = ioProcessorProviders.begin() ; it != ioProcessorProviders.end() ; ++it) {
- IOProcessorImpl* ioProcessor = (*it)->create();
- registerIOProcessor(ioProcessor);
- }
-
- std::vector<DataModelImplProvider*> dataModelProviders;
- pluma.getProviders(dataModelProviders);
- for (std::vector<DataModelImplProvider*>::iterator it = dataModelProviders.begin() ; it != dataModelProviders.end() ; ++it) {
- DataModelImpl* dataModel = (*it)->create();
- registerDataModel(dataModel);
- }
-
- std::vector<ExecutableContentImplProvider*> execContentProviders;
- pluma.getProviders(execContentProviders);
- for (std::vector<ExecutableContentImplProvider*>::iterator it = execContentProviders.begin() ; it != execContentProviders.end() ; ++it) {
- ExecutableContentImpl* execContent = (*it)->create();
- registerExecutableContent(execContent);
- }
-
- } else {
- LOG(WARNING) << "No path to plugins known, export USCXML_PLUGIN_PATH or pass path as parameter";
- }
-#else
- if (_pluginPath.length() > 0)
- LOG(WARNING) << "Plugin path is given, but uscxml is compiled without support";
-
-#ifndef BUILD_MINIMAL
-
-# if (defined UMUNDO_FOUND && defined PROTOBUF_FOUND)
- {
- UmundoInvoker* invoker = new UmundoInvoker();
- registerInvoker(invoker);
- }
-#if 0
- {
- VoiceXMLInvoker* invoker = new VoiceXMLInvoker();
- registerInvoker(invoker);
- }
-#endif
-#endif
-
-#ifdef MILES_FOUND
- {
- MilesSessionInvoker* invoker = new MilesSessionInvoker();
- registerInvoker(invoker);
- }
- // {
- // SpatialAudio* invoker = new SpatialAudio();
- // registerInvoker(invoker);
- // }
-#endif
-
-#ifdef FFMPEG_FOUND
- {
- FFMPEGInvoker* invoker = new FFMPEGInvoker();
- registerInvoker(invoker);
- }
-#endif
-#ifdef LIBICAL_FOUND
{
- CalendarInvoker* invoker = new CalendarInvoker();
+ USCXMLInvoker* invoker = new USCXMLInvoker();
registerInvoker(invoker);
}
-#endif
-#ifdef LIBPURPLE_FOUND
{
- IMInvoker* invoker = new IMInvoker();
- registerInvoker(invoker);
- }
-#endif
-
-#if (defined EXPECT_FOUND && defined TCL_FOUND)
- {
- ExpectInvoker* invoker = new ExpectInvoker();
- registerInvoker(invoker);
+ SCXMLIOProcessor* ioProcessor = new SCXMLIOProcessor();
+ registerIOProcessor(ioProcessor);
}
-#endif
-#if (defined OPENAL_FOUND && (defined LIBSNDFILE_FOUND || defined AUDIOTOOLBOX_FOUND))
{
- OpenALInvoker* invoker = new OpenALInvoker();
- registerInvoker(invoker);
+ BasicHTTPIOProcessor* ioProcessor = new BasicHTTPIOProcessor();
+ registerIOProcessor(ioProcessor);
}
-#endif
-#ifdef OPENSCENEGRAPH_FOUND
- {
- OSGInvoker* invoker = new OSGInvoker();
- registerInvoker(invoker);
- }
{
- OSGConverter* invoker = new OSGConverter();
- registerInvoker(invoker);
+ NULLDataModel* dataModel = new NULLDataModel();
+ registerDataModel(dataModel);
}
-#endif
-#if (defined V8_FOUND && defined BUILD_DM_ECMA)
+#ifdef V8_FOUND
{
V8DataModel* dataModel = new V8DataModel();
registerDataModel(dataModel);
}
#endif
-#if (defined JSC_FOUND && defined BUILD_DM_ECMA)
+#ifdef JSC_FOUND
{
JSCDataModel* dataModel = new JSCDataModel();
registerDataModel(dataModel);
}
#endif
-#if (defined SWI_FOUND && defined BUILD_DM_PROLOG)
- {
- SWIDataModel* dataModel = new SWIDataModel();
- registerDataModel(dataModel);
- }
-#endif
-
-#if (defined LUA_FOUND && defined BUILD_DM_LUA)
+#ifdef LUA_FOUND
{
LuaDataModel* dataModel = new LuaDataModel();
registerDataModel(dataModel);
}
#endif
-#if (defined BUILD_DM_PROMELA)
- {
- PromelaDataModel* dataModel = new PromelaDataModel();
- registerDataModel(dataModel);
- }
-#endif
-
-#ifdef BUILD_DM_XPATH
- {
- XPathDataModel* dataModel = new XPathDataModel();
- registerDataModel(dataModel);
- }
-#endif
-
-#ifdef PROTOBUF_FOUND
- {
- // MMIHTTPIOProcessor* ioProcessor = new MMIHTTPIOProcessor();
- // registerIOProcessor(ioProcessor);
- }
-#endif
-
-#ifdef CURL_HAS_SMTP
- {
- SMTPInvoker* invoker = new SMTPInvoker();
- registerInvoker(invoker);
- }
-#endif
-
- // these are always available when not building minimal
- {
- XHTMLInvoker* invoker = new XHTMLInvoker();
- registerInvoker(invoker);
- }
- {
- IMAPInvoker* invoker = new IMAPInvoker();
- registerInvoker(invoker);
- }
- {
- HTTPServletInvoker* invoker = new HTTPServletInvoker();
- registerInvoker(invoker);
- }
- {
- HeartbeatInvoker* invoker = new HeartbeatInvoker();
- registerInvoker(invoker);
- }
- {
- DirMonInvoker* invoker = new DirMonInvoker();
- registerInvoker(invoker);
- }
- {
- SystemInvoker* invoker = new SystemInvoker();
- registerInvoker(invoker);
- }
- {
- VoiceXMLInvoker* invoker = new VoiceXMLInvoker();
- registerInvoker(invoker);
- }
-
- {
- FetchElement* element = new FetchElement();
- registerExecutableContent(element);
- }
- {
- RespondElement* element = new RespondElement();
- registerExecutableContent(element);
- }
- {
- PostponeElement* element = new PostponeElement();
- registerExecutableContent(element);
- }
- {
- FileElement* element = new FileElement();
- registerExecutableContent(element);
- }
-
-#endif
-
- {
- USCXMLInvoker* invoker = new USCXMLInvoker();
- registerInvoker(invoker);
- }
-
- {
- BasicHTTPIOProcessor* ioProcessor = new BasicHTTPIOProcessor();
- registerIOProcessor(ioProcessor);
- }
-
- {
- SCXMLIOProcessor* ioProcessor = new SCXMLIOProcessor();
- registerIOProcessor(ioProcessor);
- }
-
-#endif
}
Factory::~Factory() {
@@ -537,14 +237,13 @@ bool Factory::hasInvoker(const std::string& type) {
return false;
}
-boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, InterpreterImpl* interpreter) {
+std::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, InterpreterImpl* interpreter) {
// do we have this type ourself?
if (_invokerAliases.find(type) != _invokerAliases.end()) {
std::string canonicalName = _invokerAliases[type];
if (_invokers.find(canonicalName) != _invokers.end()) {
- boost::shared_ptr<InvokerImpl> invoker = _invokers[canonicalName]->create(interpreter);
- invoker->setInterpreter(interpreter);
+ std::shared_ptr<InvokerImpl> invoker = _invokers[canonicalName]->create(interpreter);
return invoker;
}
}
@@ -556,7 +255,7 @@ boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, I
ERROR_EXECUTION_THROW("No Invoker named '" + type + "' known");
}
- return boost::shared_ptr<InvokerImpl>();
+ return std::shared_ptr<InvokerImpl>();
}
@@ -569,26 +268,26 @@ bool Factory::hasDataModel(const std::string& type) {
return false;
}
-boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, InterpreterInfo* interpreter) {
+std::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, DataModelCallbacks* callbacks) {
// do we have this type ourself?
if (_dataModelAliases.find(type) != _dataModelAliases.end()) {
std::string canonicalName = _dataModelAliases[type];
if (_dataModels.find(canonicalName) != _dataModels.end()) {
- boost::shared_ptr<DataModelImpl> dataModel = _dataModels[canonicalName]->create(interpreter);
- dataModel->setInterpreter(interpreter);
+ std::shared_ptr<DataModelImpl> dataModel = _dataModels[canonicalName]->create(callbacks);
+ dataModel->setCallbacks(callbacks);
return dataModel;
}
}
// lookup in parent factory
if (_parentFactory) {
- return _parentFactory->createDataModel(type, interpreter);
+ return _parentFactory->createDataModel(type, callbacks);
} else {
ERROR_EXECUTION_THROW("No Datamodel name '" + type + "' known");
}
- return boost::shared_ptr<DataModelImpl>();
+ return std::shared_ptr<DataModelImpl>();
}
@@ -601,13 +300,13 @@ bool Factory::hasIOProcessor(const std::string& type) {
return false;
}
-boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string& type, InterpreterImpl* interpreter) {
+std::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string& type, InterpreterImpl* interpreter) {
// do we have this type ourself?
if (_ioProcessorAliases.find(type) != _ioProcessorAliases.end()) {
std::string canonicalName = _ioProcessorAliases[type];
if (_ioProcessors.find(canonicalName) != _ioProcessors.end()) {
- boost::shared_ptr<IOProcessorImpl> ioProc = _ioProcessors[canonicalName]->create(interpreter);
- ioProc->setInterpreter(interpreter);
+ std::shared_ptr<IOProcessorImpl> ioProc = _ioProcessors[canonicalName]->create(interpreter);
+// ioProc->setInterpreter(interpreter);
return ioProc;
}
}
@@ -619,7 +318,7 @@ boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string&
ERROR_EXECUTION_THROW("No IOProcessor named '" + type + "' known");
}
- return boost::shared_ptr<IOProcessorImpl>();
+ return std::shared_ptr<IOProcessorImpl>();
}
bool Factory::hasExecutableContent(const std::string& localName, const std::string& nameSpace) {
@@ -632,11 +331,11 @@ bool Factory::hasExecutableContent(const std::string& localName, const std::stri
return false;
}
-boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter) {
+std::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter) {
// do we have this type in this factory?
std::string actualNameSpace = (nameSpace.length() == 0 ? "http://www.w3.org/2005/07/scxml" : nameSpace);
if (_executableContent.find(std::make_pair(localName, actualNameSpace)) != _executableContent.end()) {
- boost::shared_ptr<ExecutableContentImpl> execContent = _executableContent[std::make_pair(localName, actualNameSpace)]->create(interpreter);
+ std::shared_ptr<ExecutableContentImpl> execContent = _executableContent[std::make_pair(localName, actualNameSpace)]->create(interpreter);
execContent->setInterpreter(interpreter);
return execContent;
}
@@ -648,7 +347,7 @@ boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const
ERROR_EXECUTION_THROW("No Executable content name '" + localName + "' in namespace '" + actualNameSpace + "' known");
}
- return boost::shared_ptr<ExecutableContentImpl>();
+ return std::shared_ptr<ExecutableContentImpl>();
}
@@ -686,7 +385,7 @@ size_t DataModelImpl::replaceExpressions(std::string& content) {
std::string expr = content.substr(start, end - start);
end++;
try {
- Data data = getStringAsData(expr);
+ Data data = getAsData(expr);
// if (data.type == Data::VERBATIM) {
// ss << "\"" << data.atom << "\"";
// } else {
@@ -724,30 +423,51 @@ Factory* Factory::getInstance() {
return _instance;
}
-void EventHandlerImpl::returnErrorExecution(const std::string& cause) {
- ERROR_EXECUTION(exc, cause);
- returnEvent(exc);
-}
+//void EventHandlerImpl::returnErrorExecution(const std::string& cause) {
+// ERROR_EXECUTION(exc, cause);
+// returnEvent(exc);
+//}
+//
+//void EventHandlerImpl::returnErrorCommunication(const std::string& cause) {
+// ERROR_COMMUNICATION(exc, cause);
+// returnEvent(exc);
+//}
+
+void IOProcessorImpl::eventToSCXML(Event& event,
+ const std::string& type,
+ const std::string& origin,
+ bool internal) {
+ if (event.eventType == 0)
+ event.eventType = (internal ? Event::INTERNAL : Event::EXTERNAL);
+ if (event.origin.length() == 0 && origin.length() > 0)
+ event.origin = origin;
+ if (event.origintype.length() == 0)
+ event.origintype = type;
-void EventHandlerImpl::returnErrorCommunication(const std::string& cause) {
- ERROR_COMMUNICATION(exc, cause);
- returnEvent(exc);
+ if (internal) {
+ _interpreter->enqueueInternal(event);
+ } else {
+ _interpreter->enqueueExternal(event);
+ }
}
-void EventHandlerImpl::returnEvent(Event& event, bool internal) {
+void InvokerImpl::eventToSCXML(Event& event,
+ const std::string& type,
+ const std::string& invokeId,
+ bool internal) {
if (event.invokeid.length() == 0)
- event.invokeid = _invokeId;
+ event.invokeid = invokeId;
if (event.eventType == 0)
event.eventType = (internal ? Event::INTERNAL : Event::EXTERNAL);
- if (event.origin.length() == 0 && _invokeId.length() > 0)
- event.origin = "#_" + _invokeId;
+ if (event.origin.length() == 0 && invokeId.length() > 0)
+ event.origin = "#_" + invokeId;
if (event.origintype.length() == 0)
- event.origintype = _type;
+ event.origintype = type;
if (internal) {
- _interpreter->receiveInternal(event);
+ _interpreter->enqueueInternal(event);
} else {
- _interpreter->receive(event);
+ _interpreter->enqueueExternal(event);
}
}
diff --git a/src/uscxml/Factory.h b/src/uscxml/plugins/Factory.h
index 4fdd322..0ce2af9 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/plugins/Factory.h
@@ -21,7 +21,6 @@
#define FACTORY_H_5WKLGPRB
#include "uscxml/Common.h"
-#include "uscxml/InterpreterInfo.h"
#include "uscxml/plugins/ExecutableContent.h"
#include "uscxml/plugins/EventHandler.h"
@@ -36,15 +35,14 @@
#endif
#include <string>
+#include <memory>
#include <set>
-#include <boost/shared_ptr.hpp>
#include <limits>
namespace uscxml {
class InterpreterImpl;
-
class USCXML_API Factory {
public:
Factory(Factory* parentFactory);
@@ -55,10 +53,10 @@ public:
void registerInvoker(InvokerImpl* invoker);
void registerExecutableContent(ExecutableContentImpl* executableContent);
- boost::shared_ptr<DataModelImpl> createDataModel(const std::string& type, InterpreterInfo* interpreter);
- boost::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, InterpreterImpl* interpreter);
- boost::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InterpreterImpl* interpreter);
- boost::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter);
+ std::shared_ptr<DataModelImpl> createDataModel(const std::string& type, DataModelCallbacks* callbacks);
+ std::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, InterpreterImpl* interpreter);
+ std::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InterpreterImpl* interpreter);
+ std::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter);
bool hasDataModel(const std::string& type);
bool hasIOProcessor(const std::string& type);
diff --git a/src/uscxml/plugins/IOProcessor.h b/src/uscxml/plugins/IOProcessor.h
index c770719..c7d90e5 100644
--- a/src/uscxml/plugins/IOProcessor.h
+++ b/src/uscxml/plugins/IOProcessor.h
@@ -22,6 +22,7 @@
#include "uscxml/Common.h"
#include "uscxml/plugins/EventHandler.h"
+#include "uscxml/messages/Event.h"
namespace uscxml {
@@ -29,38 +30,30 @@ class InterpreterImpl;
class USCXML_API IOProcessorImpl : public EventHandlerImpl {
public:
- IOProcessorImpl() {};
- virtual ~IOProcessorImpl() {};
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0;
+
+ virtual std::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0;
+ virtual void eventFromSCXML(const std::string& target, const Event& event) = 0;
+ virtual bool isValidTarget(const std::string& target) = 0;
+
+protected:
+ void eventToSCXML(Event& event, const std::string& type, const std::string& origin, bool internal = false);
+
};
class USCXML_API IOProcessor : public EventHandler {
public:
- IOProcessor() : _impl() {}
- IOProcessor(boost::shared_ptr<IOProcessorImpl> const impl) : EventHandler(impl), _impl(impl) { }
- IOProcessor(const IOProcessor& other) : EventHandler(other._impl), _impl(other._impl) { }
- virtual ~IOProcessor() {};
+ PIMPL_OPERATORS2(IOProcessor, EventHandler)
- operator bool() const {
- return !!_impl;
+ virtual void eventFromSCXML(const std::string& target, const Event& event) {
+ _impl->eventFromSCXML(target, event);
}
- bool operator< (const IOProcessor& other) const {
- return _impl < other._impl;
- }
- bool operator==(const IOProcessor& other) const {
- return _impl == other._impl;
- }
- bool operator!=(const IOProcessor& other) const {
- return _impl != other._impl;
- }
- IOProcessor& operator= (const IOProcessor& other) {
- _impl = other._impl;
- EventHandler::_impl = _impl;
- return *this;
+
+ virtual bool isValidTarget(const std::string& target) {
+ return _impl->isValidTarget(target);
}
protected:
- boost::shared_ptr<IOProcessorImpl> _impl;
+ std::shared_ptr<IOProcessorImpl> _impl;
friend class InterpreterImpl;
};
diff --git a/src/uscxml/plugins/Invoker.h b/src/uscxml/plugins/Invoker.h
index b9b767b..c22b7e3 100644
--- a/src/uscxml/plugins/Invoker.h
+++ b/src/uscxml/plugins/Invoker.h
@@ -23,64 +23,63 @@
#include "uscxml/Common.h"
#include "uscxml/plugins/EventHandler.h"
-#include "uscxml/messages/InvokeRequest.h"
+#include "uscxml/messages/Event.h"
namespace uscxml {
-class InterpreterImpl;
+class Interpreter;
class USCXML_API InvokerImpl : public EventHandlerImpl {
public:
+ InvokerImpl() : _finalize(NULL) {};
virtual ~InvokerImpl() {}
- virtual void invoke(const InvokeRequest& req) = 0;
- virtual void uninvoke() {}
+ virtual std::list<std::string> getNames() = 0;
- virtual bool deleteOnUninvoke() {
- return true;
+ virtual void invoke(const std::string& source, const Event& invokeEvent) = 0;
+ virtual void uninvoke() = 0;
+
+ virtual void eventFromSCXML(const Event& event) = 0;
+
+ virtual std::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter) = 0;
+ virtual xercesc::DOMElement* getFinalize() {
+ return _finalize;
+ }
+ virtual void setFinalize(xercesc::DOMElement* finalize) {
+ _finalize = finalize;
+ }
+ virtual void setInvokeId(const std::string& invokeId) {
+ _invokeId = invokeId;
}
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter) = 0;
+protected:
+ void eventToSCXML(Event& event, const std::string& type, const std::string& invokeId, bool internal = false);
+
+ xercesc::DOMElement* _finalize;
+ std::string _invokeId;
+
};
class USCXML_API Invoker : public EventHandler {
public:
- Invoker() : _impl() {}
- Invoker(boost::shared_ptr<InvokerImpl> const impl) : EventHandler(impl), _impl(impl) { }
- Invoker(const Invoker& other) : EventHandler(other._impl), _impl(other._impl) { }
- virtual ~Invoker() {};
+ PIMPL_OPERATORS2(Invoker, EventHandler);
- operator bool() const {
- return !!_impl;
- }
- bool operator< (const Invoker& other) const {
- return _impl < other._impl;
- }
- bool operator==(const Invoker& other) const {
- return _impl == other._impl;
- }
- bool operator!=(const Invoker& other) const {
- return _impl != other._impl;
- }
- Invoker& operator= (const Invoker& other) {
- _impl = other._impl;
- EventHandler::_impl = _impl;
- return *this;
- }
-
- virtual void invoke(InvokeRequest& req) {
- _impl->invoke(req);
+ virtual void invoke(const std::string& source, const Event& invokeEvent) {
+ _impl->invoke(source, invokeEvent);
}
virtual void uninvoke() {
_impl->uninvoke();
}
- virtual bool deleteOnUninvoke() {
- return _impl->deleteOnUninvoke();
+ virtual void eventFromSCXML(const Event& event) {
+ _impl->eventFromSCXML(event);
}
+ virtual xercesc::DOMElement* getFinalize() {
+ return _impl->getFinalize();
+ }
protected:
- boost::shared_ptr<InvokerImpl> _impl;
+ std::shared_ptr<InvokerImpl> _impl;
};
diff --git a/src/uscxml/plugins/Plugins.cpp b/src/uscxml/plugins/Plugins.cpp
deleted file mode 100644
index b2643f7..0000000
--- a/src/uscxml/plugins/Plugins.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "Plugins.h"
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_PROVIDER_SOURCE(DataModelImpl, 1, 1);
-PLUMA_PROVIDER_SOURCE(IOProcessorImpl, 1, 1);
-PLUMA_PROVIDER_SOURCE(InvokerImpl, 1, 1);
-PLUMA_PROVIDER_SOURCE(ExecutableContentImpl, 1, 1);
-#endif
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/Plugins.h b/src/uscxml/plugins/Plugins.h
deleted file mode 100644
index 537d3fe..0000000
--- a/src/uscxml/plugins/Plugins.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef PLUGINS_H_M6G1NF1E
-#define PLUGINS_H_M6G1NF1E
-
-#include <Pluma/Pluma.hpp>
-#include "uscxml/Factory.h"
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_PROVIDER_HEADER(IOProcessorImpl);
-PLUMA_PROVIDER_HEADER(InvokerImpl);
-PLUMA_PROVIDER_HEADER(ExecutableContentImpl);
-PLUMA_PROVIDER_HEADER(DataModelImpl);
-#endif
-
-}
-
-#endif /* end of include guard: PLUGINS_H_M6G1NF1E */
diff --git a/src/uscxml/plugins/Pluma/Config.hpp b/src/uscxml/plugins/Pluma/Config.hpp
deleted file mode 100755
index efd98c9..0000000
--- a/src/uscxml/plugins/Pluma/Config.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-//
-// Based on SFML configuration header
-// SFML Config.hpp:
-// http://www.sfml-dev.org/documentation/2.0/Config_8hpp-source.htm
-//
-// Acknowledgements to Simple and Fast Multimedia Library
-// http://www.sfml-dev.org/
-//
-////////////////////////////////////////////////////////////
-
-
-#ifndef PLUMA_CONFIG_HPP
-#define PLUMA_CONFIG_HPP
-
-
-////////////////////////////////////////////////////////////
-// Identify the operating system
-////////////////////////////////////////////////////////////
-#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
-
- // Windows
- #define PLUMA_SYS_WINDOWS
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #ifndef NOMINMAX
- #define NOMINMAX
- #endif
-
-#elif defined(linux) || defined(__linux)
-
- // Linux
- #define PLUMA_SYS_LINUX
-
-#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
-
- // MacOS
- #define PLUMA_SYS_MACOS
-
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-
- // FreeBSD
- #define PLUMA_SYS_FREEBSD
-
-#else
-
- // Unsupported system
- #error This operating system is not supported by this library
-
-#endif
-
-
-
-////////////////////////////////////////////////////////////
-// Define library file extension based on OS
-////////////////////////////////////////////////////////////
-#ifdef PLUMA_SYS_WINDOWS
- #define PLUMA_LIB_EXTENSION "dll"
-#elif defined(PLUMA_SYS_MACOS)
- #define PLUMA_LIB_EXTENSION "dylib"
-#elif defined(PLUMA_SYS_LINUX) || defined(PLUMA_SYS_FREEBSD)
- #define PLUMA_LIB_EXTENSION "so"
-#else
- // unknown library file type
- #error Unknown library file extension for this operating system
-#endif
-
-
-////////////////////////////////////////////////////////////
-// Define portable import / export macros
-////////////////////////////////////////////////////////////
-#if defined(PLUMA_SYS_WINDOWS)
-
- #ifndef PLUMA_STATIC
-
- // Windows platforms
- #ifdef PLUMA_EXPORTS
-
- // From DLL side, we must export
- #define PLUMA_API __declspec(dllexport)
-
- #else
-
- // From client application side, we must import
- #define PLUMA_API __declspec(dllimport)
-
- #endif
-
- // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
- // You can read lots ot different things about it, but the point is the code will
- // just work fine, and so the simplest way to get rid of this warning is to disable it
- #ifdef _MSC_VER
-
- #pragma warning(disable : 4251)
-
- #endif
-
- #else
-
- // No specific directive needed for static build
- #define PLUMA_API
-
- #endif
-
-#else
-
- // Other platforms don't need to define anything
- #define PLUMA_API
-
-#endif
-
-
-
-
-#endif // PLUMA_CONFIG_HPP
diff --git a/src/uscxml/plugins/Pluma/Connector.hpp b/src/uscxml/plugins/Pluma/Connector.hpp
deleted file mode 100755
index 3c227e7..0000000
--- a/src/uscxml/plugins/Pluma/Connector.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_CONNECTOR_HPP
-#define PLUMA_CONNECTOR_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <Pluma/Pluma.hpp>
-
-
-/////////////////////////////////////////////////////////////////
-// Define portable import/export macros for Plugin registration
-/////////////////////////////////////////////////////////////////
-#if defined(PLUMA_SYS_WINDOWS)
-
- #ifndef PLUMA_STATIC_PLUGIN
-
- // Windows platforms
- #ifndef PLUGIN_IMPORTS
-
- // From DLL side, we must export
- #ifdef __cplusplus
- #define PLUMA_CONNECTOR extern "C" __declspec(dllexport)
- #else
- #define PLUMA_CONNECTOR __declspec(dllexport)
- #endif
-
- #else
-
- // From client application side, we must import
- #ifdef __cplusplus
- #define PLUMA_CONNECTOR extern "C" __declspec(dllimport)
- #else
- #define PLUMA_CONNECTOR __declspec(dllimport)
- #endif
-
- #endif
-
- #else
-
- // Only define the extern "C" for static build
- #ifdef __cplusplus
- #define PLUMA_CONNECTOR extern "C"
- #else
- #define PLUMA_CONNECTOR
- #endif
-
- #endif
-
-#else
-
- // Only define the extern "C" for other platforms
- #ifdef __cplusplus
- #define PLUMA_CONNECTOR extern "C"
- #else
- #define PLUMA_CONNECTOR
- #endif
-
-#endif
-
-
-#endif // PLUMA_CONNECTOR_HPP
diff --git a/src/uscxml/plugins/Pluma/DLibrary.cpp b/src/uscxml/plugins/Pluma/DLibrary.cpp
deleted file mode 100644
index 0cbf309..0000000
--- a/src/uscxml/plugins/Pluma/DLibrary.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/DLibrary.hpp>
-#include <cstdio>
-#include <string>
-
-
-namespace pluma {
-
-////////////////////////////////////////////////////////////
-DLibrary* DLibrary::load(const std::string& path) {
- if ( path.empty() ) {
- fprintf(stderr, "Failed to load library: Empty path\n");
- return NULL;
- }
- void* handle = NULL;
-
- // load library - OS dependent operation
-#ifdef PLUMA_SYS_WINDOWS
- handle = ::LoadLibraryA(path.c_str());
- if (!handle) {
- fprintf(stderr, "Failed to load library \"%s\".\n", path.c_str());
- return NULL;
- }
-#else
- handle = ::dlopen(path.c_str(), RTLD_NOW);
- if (!handle) {
- const char* errorString = ::dlerror();
- fprintf(stderr, "Failed to load library \"%s\".", path.c_str());
- if(errorString) fprintf(stderr, " OS returned error: \"%s\".", errorString);
- fprintf(stderr, "\n");
- return NULL;
- }
-#endif
- // return a DLibrary with the DLL handle
- return new DLibrary(handle);
-}
-
-
-////////////////////////////////////////////////////////////
-DLibrary::~DLibrary() {
- if (handle) {
-#ifdef PLUMA_SYS_WINDOWS
- ::FreeLibrary( (HMODULE)handle );
-#else
- ::dlclose(handle);
-#endif
- }
-}
-
-
-////////////////////////////////////////////////////////////
-void* DLibrary::getSymbol(const std::string& symbol) {
- if (!handle) {
- fprintf(stderr, "Cannot inspect library symbols, library isn't loaded.\n");
- return NULL;
- }
- void* res;
-#ifdef PLUMA_SYS_WINDOWS
- res = (void*)(::GetProcAddress((HMODULE)handle, symbol.c_str()));
-#else
- res = (void*)(::dlsym(handle, symbol.c_str()));
-#endif
- if (!res) {
- fprintf(stderr, "Library symbol \"%s\" not found.\n", symbol.c_str());
- return NULL;
- }
- return res;
-}
-
-
-////////////////////////////////////////////////////////////
-DLibrary::DLibrary(void* handle):
- handle(handle) {
- // Nothing to do
-}
-
-} // namespace pluma
-
diff --git a/src/uscxml/plugins/Pluma/DLibrary.hpp b/src/uscxml/plugins/Pluma/DLibrary.hpp
deleted file mode 100755
index 1bb9bac..0000000
--- a/src/uscxml/plugins/Pluma/DLibrary.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_DYNAMIC_LIBRARY_HPP
-#define PLUMA_DYNAMIC_LIBRARY_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <string>
-
-// include OS dependent support for DLL
-#ifdef PLUMA_SYS_WINDOWS
- #include <Windows.h>
-#else
- #include <dlfcn.h>
-#endif
-
-
-
-namespace pluma{
-
-////////////////////////////////////////////////////////////
-/// \brief Manages a Dynamic Linking Library.
-///
-////////////////////////////////////////////////////////////
-class DLibrary{
-
-
-public:
-
- ////////////////////////////////////////////////////////////
- /// \brief Load a library.
- ///
- /// \param path Path to the library.
- ///
- /// \return Pointer to the loaded library, or NULL if failed.
- ///
- ////////////////////////////////////////////////////////////
- static DLibrary* load(const std::string& path);
-
- ////////////////////////////////////////////////////////////
- /// \brief Destructor.
- ///
- /// Close and free the opened library (if any).
- ///
- ////////////////////////////////////////////////////////////
- ~DLibrary();
-
- ////////////////////////////////////////////////////////////
- /// \brief Get a symbol from the library.
- ///
- /// \param symbol Symbol that we're looking for.
- ///
- /// \return Pointer to what the symbol refers to, or NULL if
- /// the symbol is not found.
- ///
- ////////////////////////////////////////////////////////////
- void* getSymbol(const std::string& symbol);
-
-
-private:
-
- ////////////////////////////////////////////////////////////
- /// \brief Default constructor.
- ///
- /// Library instances cannot be created, use load instead.
- ///
- /// \see load
- ///
- ////////////////////////////////////////////////////////////
- DLibrary();
-
- ////////////////////////////////////////////////////////////
- /// \brief Constructor via library handle.
- ///
- /// Used on load function.
- ///
- /// \see load
- ///
- ////////////////////////////////////////////////////////////
- DLibrary(void* handle);
-
-
-
-////////////////////////////////////////////////////////////
-// Member data
-////////////////////////////////////////////////////////////
-
-
-private:
-
- void* handle; ///< Library handle.
-
-};
-
-
-} // namespace pluma
-
-
-#endif // PLUMA_DYNAMIC_LIBRARY_HPP
diff --git a/src/uscxml/plugins/Pluma/Dir.cpp b/src/uscxml/plugins/Pluma/Dir.cpp
deleted file mode 100644
index 73271ea..0000000
--- a/src/uscxml/plugins/Pluma/Dir.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Dir.hpp>
-#include <Pluma/uce-dirent.h>
-#include <cstdio>
-#include <queue>
-
-
-namespace pluma {
-
-namespace dir {
-
-
-////////////////////////////////////////////////////////////
-void listFiles(std::list<std::string>& list, const std::string& folder, const std::string& extension, bool recursive) {
- DIR* dir;
- DIR* subDir;
- struct dirent *ent;
- // try to open top folder
- dir = opendir(folder.c_str());
- if (dir == NULL) {
- // could not open directory
- fprintf(stderr, "Could not open \"%s\" directory.\n", folder.c_str());
- return;
- } else {
- // close, we'll process it next
- closedir(dir);
- }
- // enqueue top folder
- std::queue<std::string> folders;
- folders.push(folder);
-
- // run while has queued folders
- while (!folders.empty()) {
- std::string currFolder = folders.front();
- folders.pop();
- dir = opendir(currFolder.c_str());
- if (dir == NULL) continue;
- // iterate through all the files and directories
- while ((ent = readdir (dir)) != NULL) {
- std::string name(ent->d_name);
- // ignore "." and ".." directories
- if ( name.compare(".") == 0 || name.compare("..") == 0) continue;
- // add path to the file name
- std::string path = currFolder;
- path.append("/");
- path.append(name);
- // check if it's a folder by trying to open it
- subDir = opendir(path.c_str());
- if (subDir != NULL) {
- // it's a folder: close, we can process it later
- closedir(subDir);
- if (recursive) folders.push(path);
- } else {
- // it's a file
- if (extension.empty()) {
- list.push_back(path);
- } else {
- // check file extension
- size_t lastDot = name.find_last_of('.');
- std::string ext = name.substr(lastDot+1);
- if (ext.compare(extension) == 0) {
- // match
- list.push_back(path);
- }
- } // endif (extension test)
- } // endif (folder test)
- } // endwhile (nextFile)
- closedir(dir);
- } // endwhile (queued folders)
-
-} // end listFiles
-
-
-} // namespace dir
-
-} // namespace pluma
diff --git a/src/uscxml/plugins/Pluma/Dir.hpp b/src/uscxml/plugins/Pluma/Dir.hpp
deleted file mode 100755
index a94c477..0000000
--- a/src/uscxml/plugins/Pluma/Dir.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_DIRECTORY_HPP
-#define PLUMA_DIRECTORY_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <string>
-#include <list>
-
-
-namespace pluma{
-
-namespace dir{
-
-////////////////////////////////////////////////////////////
-/// \brief List files of a directory.
-///
-/// \param list The output files list.
-/// \param folder The folder where to search in
-/// \param extension A file extension filter,
-/// empty extension will match all files.
-/// \param recursive If true it will list files in
-/// sub directories as well.
-///
-////////////////////////////////////////////////////////////
-void listFiles(
- std::list<std::string>& list,
- const std::string& folder,
- const std::string& extension = "",
- bool recursive = false
-);
-
-
-} // namespace dir
-
-} // namespace pluma
-
-
-#endif // PLUMA_DIRECTORY_HPP
diff --git a/src/uscxml/plugins/Pluma/Host.cpp b/src/uscxml/plugins/Pluma/Host.cpp
deleted file mode 100644
index 73979a6..0000000
--- a/src/uscxml/plugins/Pluma/Host.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Host.hpp>
-#include <cstdio>
-
-
-namespace pluma {
-
-////////////////////////////////////////////////////////////
-Host::Host() {
- // Nothing to do
-}
-
-
-////////////////////////////////////////////////////////////
-bool Host::add(Provider* provider) {
- if (provider == NULL) {
- fprintf(stderr, "Trying to add a null provider.\n");
- return false;
- }
- if (!validateProvider(provider)) {
- delete provider;
- return false;
- }
- addRequests[ provider->plumaGetType() ].push_back(provider);
- return true;
-}
-
-
-////////////////////////////////////////////////////////////
-Host::~Host() {
- clearProviders();
- // map frees itself
-}
-
-
-////////////////////////////////////////////////////////////
-void Host::clearProviders() {
- ProvidersMap::iterator it;
- for (it = knownTypes.begin() ; it != knownTypes.end() ; ++it) {
- std::list<Provider*>& providers = it->second.providers;
- std::list<Provider*>::iterator provIt;
- for (provIt = providers.begin() ; provIt != providers.end() ; ++provIt) {
- delete *provIt;
- }
- std::list<Provider*>().swap(providers);
- }
-}
-
-
-////////////////////////////////////////////////////////////
-bool Host::knows(const std::string& type) const {
- return knownTypes.find(type) != knownTypes.end();
-}
-
-
-////////////////////////////////////////////////////////////
-unsigned int Host::getVersion(const std::string& type) const {
- ProvidersMap::const_iterator it = knownTypes.find(type);
- if (it != knownTypes.end())
- return it->second.version;
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////
-unsigned int Host::getLowestVersion(const std::string& type) const {
- ProvidersMap::const_iterator it = knownTypes.find(type);
- if (it != knownTypes.end())
- return it->second.lowestVersion;
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////
-void Host::registerType(const std::string& type, unsigned int version, unsigned int lowestVersion) {
- if (!knows(type)) {
- ProviderInfo pi;
- pi.version = version;
- pi.lowestVersion = lowestVersion;
- knownTypes[type] = pi;
- }
-}
-
-
-////////////////////////////////////////////////////////////
-const std::list<Provider*>* Host::getProviders(const std::string& type) const {
- ProvidersMap::const_iterator it = knownTypes.find(type);
- if (it != knownTypes.end())
- return &it->second.providers;
- return NULL;
-}
-
-
-////////////////////////////////////////////////////////////
-bool Host::validateProvider(Provider* provider) const {
- const std::string& type = provider->plumaGetType();
- if ( !knows(type) ) {
- fprintf(stderr, "%s provider type isn't registered.\n", type.c_str());
- return false;
- }
- if (!provider->isCompatible(*this)) {
- fprintf(stderr, "Incompatible %s provider version.\n", type.c_str());
- return false;
- }
- return true;
-}
-
-
-////////////////////////////////////////////////////////////
-bool Host::registerProvider(Provider* provider) {
- if (!validateProvider(provider)) {
- delete provider;
- return false;
- }
- knownTypes[ provider->plumaGetType() ].providers.push_back(provider);
- return true;
-}
-
-
-////////////////////////////////////////////////////////////
-void Host::cancelAddictions() {
- TempProvidersMap::iterator it;
- for( it = addRequests.begin() ; it != addRequests.end() ; ++it) {
- std::list<Provider*> lst = it->second;
- std::list<Provider*>::iterator providerIt;
- for (providerIt = lst.begin() ; providerIt != lst.end() ; ++providerIt) {
- delete *providerIt;
- }
- }
- // clear map
- TempProvidersMap().swap(addRequests);
-}
-
-
-////////////////////////////////////////////////////////////
-bool Host::confirmAddictions() {
- if (addRequests.empty()) return false;
- TempProvidersMap::iterator it;
- for( it = addRequests.begin() ; it != addRequests.end() ; ++it) {
- std::list<Provider*> lst = it->second;
- std::list<Provider*>::iterator providerIt;
- for (providerIt = lst.begin() ; providerIt != lst.end() ; ++providerIt) {
- knownTypes[it->first].providers.push_back(*providerIt);
- }
- }
- // clear map
- TempProvidersMap().swap(addRequests);
- return true;
-}
-
-
-} //namespace pluma
diff --git a/src/uscxml/plugins/Pluma/Host.hpp b/src/uscxml/plugins/Pluma/Host.hpp
deleted file mode 100755
index cf049f5..0000000
--- a/src/uscxml/plugins/Pluma/Host.hpp
+++ /dev/null
@@ -1,212 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_HOST_HPP
-#define PLUMA_HOST_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <Pluma/Provider.hpp>
-
-#include <vector>
-#include <list>
-#include <map>
-
-namespace pluma{
-
-////////////////////////////////////////////////////////////
-/// \brief Manages providers.
-///
-////////////////////////////////////////////////////////////
-class PLUMA_API Host{
-friend class PluginManager;
-friend class Provider;
-
-
-public:
-
- ////////////////////////////////////////////////////////////
- /// \brief Add provider.
- ///
- /// Provider type and version are checked. Only known and
- /// valid provider types are accepted.
- ///
- /// \param provider Provider to be added.
- ///
- /// \return True if the provider is accepted.
- ///
- ////////////////////////////////////////////////////////////
- bool add(Provider* provider);
-
-
-private:
-
- ////////////////////////////////////////////////////////////
- /// \brief Default constructor.
- ///
- /// New Host instances are not publicly allowed.
- ///
- ////////////////////////////////////////////////////////////
- Host();
-
- ////////////////////////////////////////////////////////////
- /// \brief Destructor.
- ///
- /// Clears all hosted providers
- ///
- ////////////////////////////////////////////////////////////
- ~Host();
-
- ////////////////////////////////////////////////////////////
- /// \brief Ckeck if a provider type is registered.
- ///
- /// \param type Provider type id.
- ///
- /// \return True if the type is registered
- ///
- ////////////////////////////////////////////////////////////
- bool knows(const std::string& type) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Get version of a type of providers.
- ///
- /// \param type Provider type.
- ///
- /// \return The version of the provider type.
- ///
- ////////////////////////////////////////////////////////////
- unsigned int getVersion(const std::string& type) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Get lowest compatible version of a type of providers.
- ///
- /// \param type Provider type.
- ///
- /// \return The lowest compatible version of the provider type.
- ///
- ////////////////////////////////////////////////////////////
- unsigned int getLowestVersion(const std::string& type) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Register a type of providers.
- ///
- /// \param type Provider type.
- /// \param version Current version of that provider type.
- /// \param lowestVersion Lowest compatible version of that provider type.
- ///
- ////////////////////////////////////////////////////////////
- void registerType(const std::string& type, unsigned int version, unsigned int lowestVersion);
-
- ////////////////////////////////////////////////////////////
- /// \brief Get providers of a certain type.
- ///
- /// \param type Provider type.
- ///
- /// \return Pointer to the list of providers of that \a type,
- /// or NULL if \a type is not registered.
- ///
- ////////////////////////////////////////////////////////////
- const std::list<Provider*>* getProviders(const std::string& type) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Clears all hosted providers.
- ///
- ////////////////////////////////////////////////////////////
- void clearProviders();
-
- ////////////////////////////////////////////////////////////
- /// \brief Validate provider type and version.
- ///
- /// \return True if the provider is acceptable.
- ///
- ////////////////////////////////////////////////////////////
- bool validateProvider(Provider* provider) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Clearly add a provider.
- ///
- /// Provider type and version are checked. Only known and
- /// valid provider types are accepted.
- /// If acepted, provider is directly stored.
- ///
- /// \param provider Provider to be added.
- ///
- /// \return True if the provider is accepted.
- ///
- ////////////////////////////////////////////////////////////
- bool registerProvider(Provider* provider);
-
- ////////////////////////////////////////////////////////////
- /// \brief Previous add calls are canceled.
- ///
- /// Added providers are not stored.
- ///
- /// \see add
- ///
- ////////////////////////////////////////////////////////////
- void cancelAddictions();
-
- ////////////////////////////////////////////////////////////
- /// \brief Previous add calls are confirmed.
- ///
- /// Added providers are finally stored.
- ///
- /// \return True if something was stored.
- ///
- /// \see add
- ///
- ////////////////////////////////////////////////////////////
- bool confirmAddictions();
-
-
-
-////////////////////////////////////////////////////////////
-// Member data
-////////////////////////////////////////////////////////////
-
-private:
-
- ////////////////////////////////////////////////////////////
- /// \brief Structure with information about a provider type.
- ///
- ////////////////////////////////////////////////////////////
- struct ProviderInfo{
- unsigned int version;
- unsigned int lowestVersion;
- std::list<Provider*> providers;
- };
-
- typedef std::map<std::string, ProviderInfo > ProvidersMap;
- typedef std::map<std::string, std::list<Provider*> > TempProvidersMap;
-
- ProvidersMap knownTypes; ///< Map of registered types.
- TempProvidersMap addRequests; ///< Temporarily added providers
-
-};
-
-} // namespace pluma
-
-#endif // PLUMA_HOST_HPP
diff --git a/src/uscxml/plugins/Pluma/PluginManager.cpp b/src/uscxml/plugins/Pluma/PluginManager.cpp
deleted file mode 100644
index 22e0438..0000000
--- a/src/uscxml/plugins/Pluma/PluginManager.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/PluginManager.hpp>
-#include <Pluma/DLibrary.hpp>
-#include <Pluma/Dir.hpp>
-#include <cstdio>
-
-namespace pluma {
-
-////////////////////////////////////////////////////////////
-PluginManager::PluginManager() {
- // Nothing to do
-}
-
-
-////////////////////////////////////////////////////////////
-PluginManager::~PluginManager() {
- unloadAll();
-}
-
-
-////////////////////////////////////////////////////////////
-bool PluginManager::load(const std::string& path) {
- std::string plugName = getPluginName(path);
- std::string realPath = resolvePathExtension(path);
- DLibrary* lib = DLibrary::load(realPath);
- if (!lib) return false;
-
- fnRegisterPlugin* registerFunction;
- registerFunction = reinterpret_cast<fnRegisterPlugin*>(lib->getSymbol("pluginConnect"));
-
- if(!registerFunction) {
- fprintf(stderr, "Failed to initialize plugin \"%s\": pluginConnect function not found\n", plugName.c_str());
- delete lib;
- return false;
- }
- // try to initialize plugin:
- if (!registerFunction(host)) {
- // plugin decided to fail
- fprintf(stderr, "Self registry failed on plugin \"%s\".\n", plugName.c_str());
- host.cancelAddictions();
- delete lib;
- return false;
- }
- // Store the library if addictions are confirmed
- if (host.confirmAddictions())
- libraries[plugName] = lib;
- else {
- // otherwise nothing was registered
- fprintf(stderr, "Nothing registered by plugin \"%s\".\n", plugName.c_str());
- delete lib;
- return false;
- }
- return true;
-}
-
-
-////////////////////////////////////////////////////////////
-bool PluginManager::load(const std::string& folder, const std::string& pluginName) {
- if (folder.empty())
- return load(pluginName);
- else if (folder[folder.size()-1] == '/' || folder[folder.size()-1] == '\\')
- return load(folder + pluginName);
- return load(folder + '/' + pluginName);
-}
-
-
-////////////////////////////////////////////////////////////
-int PluginManager::loadFromFolder(const std::string& folder, bool recursive) {
- std::list<std::string> files;
- dir::listFiles(files, folder, PLUMA_LIB_EXTENSION, recursive);
- // try to load every library
- int res = 0;
- std::list<std::string>::const_iterator it;
- for (it = files.begin() ; it != files.end() ; ++it) {
- if ( load(*it) ) ++res;
- }
- return res;
-}
-
-
-////////////////////////////////////////////////////////////
-bool PluginManager::unload(const std::string& pluginName) {
- std::string plugName = getPluginName(pluginName);
- LibMap::iterator it = libraries.find(plugName);
- if( it != libraries.end() ) {
- delete it->second;
- libraries.erase(it);
- return true;
- }
- return false;
-}
-
-
-////////////////////////////////////////////////////////////
-void PluginManager::unloadAll() {
-
- host.clearProviders();
- LibMap::iterator it;
- for (it = libraries.begin() ; it != libraries.end() ; ++it) {
- delete it->second;
- }
- libraries.clear();
-}
-
-
-////////////////////////////////////////////////////////////
-std::string PluginManager::getPluginName(const std::string& path) {
- size_t lastDash = path.find_last_of("/\\");
- size_t lastDot = path.find_last_of('.');
- if (lastDash == std::string::npos) lastDash = 0;
- else ++lastDash;
- if (lastDot < lastDash || lastDot == std::string::npos) {
- // path without extension
- lastDot = path.length();
- }
- return path.substr(lastDash, lastDot-lastDash);
-}
-
-
-////////////////////////////////////////////////////////////
-std::string PluginManager::resolvePathExtension(const std::string& path) {
- size_t lastDash = path.find_last_of("/\\");
- size_t lastDot = path.find_last_of('.');
- if (lastDash == std::string::npos) lastDash = 0;
- else ++lastDash;
- if (lastDot < lastDash || lastDot == std::string::npos) {
- // path without extension, add it
- return path + "." + PLUMA_LIB_EXTENSION;
- }
- return path;
-}
-
-
-////////////////////////////////////////////////////////////
-void PluginManager::registerType(const std::string& type, unsigned int version, unsigned int lowestVersion) {
- host.registerType(type, version, lowestVersion);
-}
-
-
-////////////////////////////////////////////////////////////
-bool PluginManager::addProvider(Provider* provider) {
- if (provider == NULL) {
- fprintf(stderr, "Trying to add null provider\n");
- return false;
- }
- return host.registerProvider(provider);
-}
-
-
-////////////////////////////////////////////////////////////
-void PluginManager::getLoadedPlugins(std::vector<const std::string*>& pluginNames) const {
- pluginNames.reserve(pluginNames.size()+libraries.size());
- LibMap::const_iterator it;
- for(it = libraries.begin() ; it != libraries.end() ; ++it) {
- pluginNames.push_back(&(it->first));
- }
-}
-
-
-////////////////////////////////////////////////////////////
-bool PluginManager::isLoaded(const std::string& pluginName) const {
- return libraries.find(getPluginName(pluginName)) != libraries.end();
-}
-
-
-////////////////////////////////////////////////////////////
-const std::list<Provider*>* PluginManager::getProviders(const std::string& type) const {
- return host.getProviders(type);
-}
-
-
-
-} // namespace pluma
-
diff --git a/src/uscxml/plugins/Pluma/PluginManager.hpp b/src/uscxml/plugins/Pluma/PluginManager.hpp
deleted file mode 100755
index e5ddf06..0000000
--- a/src/uscxml/plugins/Pluma/PluginManager.hpp
+++ /dev/null
@@ -1,245 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_PLUGIN_MANAGER_HPP
-#define PLUMA_PLUGIN_MANAGER_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <Pluma/Host.hpp>
-
-#include <string>
-#include <map>
-
-namespace pluma{
-class DLibrary;
-
-////////////////////////////////////////////////////////////
-/// \brief Manages loaded plugins.
-///
-////////////////////////////////////////////////////////////
-class PLUMA_API PluginManager{
-
-
-public:
-
- ////////////////////////////////////////////////////////////
- /// \brief Destructor.
- ///
- ////////////////////////////////////////////////////////////
- ~PluginManager();
-
- ////////////////////////////////////////////////////////////
- /// \brief Load a plugin given it's path
- ///
- /// \param path Path for the plugin, including plugin name. File extension
- /// may be included, but is discouraged for better cross platform code.
- /// If file extension isn't present on the path, Pluma will deduce it
- /// from the operating system.
- ///
- /// \return True if the plugin is successfully loaded.
- ///
- /// \see load(const std::string&, const std::string&)
- /// \see loadFromFolder
- /// \see unload
- /// \see unloadAll
- ///
- ////////////////////////////////////////////////////////////
- bool load(const std::string& path);
-
-
- ////////////////////////////////////////////////////////////
- /// \brief Load a plugin from a given folder
- ///
- /// \param folder The folder path.
- /// \param pluginName Name of the plugin. File extension
- /// may be included, but is discouraged for better cross platform code.
- /// If file extension is omitted, Pluma will deduce it
- /// from the operating system.
- ///
- /// \return True if the plugin is successfully loaded.
- ///
- /// \see load(const std::string&)
- /// \see loadFromFolder
- /// \see unload
- /// \see unloadAll
- ///
- ////////////////////////////////////////////////////////////
- bool load(const std::string& folder, const std::string& pluginName);
-
- ////////////////////////////////////////////////////////////
- /// \brief Load all plugins from a given folder
- ///
- /// \param folder Path for the folder where the plug-ins are.
- /// \param recursive If true it will search on sub-folders as well
- ///
- /// \return Number of successfully loaded plug-ins.
- ///
- /// \see load(const std::string&, const std::string&)
- /// \see load(const std::string&)
- /// \see unload
- /// \see unloadAll
- ///
- ////////////////////////////////////////////////////////////
- int loadFromFolder(const std::string& folder, bool recursive = false);
-
- ////////////////////////////////////////////////////////////
- /// \brief Unload a plugin.
- ///
- /// \param pluginName Name or path of the plugin.
- ///
- /// \return True if the plugin is successfully unloaded,
- /// false if no such plugin exists on the manager.
- ///
- /// \see load(const std::string&, const std::string&)
- /// \see load(const std::string&)
- /// \see loadFromFolder
- /// \see unloadAll
- ///
- ////////////////////////////////////////////////////////////
- bool unload(const std::string& pluginName);
-
- ////////////////////////////////////////////////////////////
- /// \brief Unload all loaded plugins.
- ///
- /// \see load(const std::string&, const std::string&)
- /// \see load(const std::string&)
- /// \see loadFromFolder
- /// \see unload
- ///
- ////////////////////////////////////////////////////////////
- void unloadAll();
-
- ////////////////////////////////////////////////////////////
- /// \brief Directly add a new provider.
- ///
- /// \param provider Provider.
- ///
- ////////////////////////////////////////////////////////////
- bool addProvider(Provider* provider);
-
- ////////////////////////////////////////////////////////////
- /// \brief Get the name of all loaded plugins.
- ///
- /// \param pluginNames A vector to fill with the plugins names.
- ///
- ////////////////////////////////////////////////////////////
- void getLoadedPlugins(std::vector<const std::string*>& pluginNames) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Check if a plug-in is loaded.
- ///
- /// \param pluginName the plug-in tname o check.
- ///
- ////////////////////////////////////////////////////////////
- bool isLoaded(const std::string& pluginName) const;
-
-
-protected:
-
- ////////////////////////////////////////////////////////////
- /// \brief Default constructor.
- ///
- /// PluginManager cannot be publicly instantiated.
- ///
- ////////////////////////////////////////////////////////////
- PluginManager();
-
- ////////////////////////////////////////////////////////////
- /// \brief Register a provider type
- ///
- /// \param type Provider type.
- /// \param version Current version of that provider type.
- /// \param lowestVersion Lowest compatible version of that provider type.
- ///
- /// \see Host::registerType
- ///
- ////////////////////////////////////////////////////////////
- void registerType(const std::string& type, unsigned int version, unsigned int lowestVersion);
-
- ////////////////////////////////////////////////////////////
- /// \brief Get providers of a certain type.
- ///
- /// \param type Provider type.
- ///
- /// \return Pointer to the list of providers of that \a type,
- /// or NULL if \a type is not registered.
- ///
- /// \see Host::getProviders
- ///
- ////////////////////////////////////////////////////////////
- const std::list<Provider*>* getProviders(const std::string& type) const;
-
-
-private:
-
- ////////////////////////////////////////////////////////////
- /// \brief Get the plugin name (without extension) from its path
- ///
- /// \param path Plugin path.
- ///
- /// \return Name of the plugin.
- ///
- /// \see resolvePathExtension
- /// \see load(const std::string&, const std::string&)
- /// \see load(const std::string&)
- /// \see unload
- ///
- ////////////////////////////////////////////////////////////
- static std::string getPluginName(const std::string& path);
-
- ////////////////////////////////////////////////////////////
- /// \brief If the plugin path omits it's extension, this method returns
- /// the path plus the OS specific dll extension.
- /// Return a copy of the path otherwise.
- ///
- /// \param path Plugin path.
- ///
- /// \return Path with extension.
- ///
- /// \see getPluginName
- /// \see load(const std::string&, const std::string&)
- /// \see load(const std::string&)
- /// \see unload
- ///
- ////////////////////////////////////////////////////////////
- static std::string resolvePathExtension(const std::string& path);
-
-
-private:
-
- /// Signature for the plugin's registration function
- typedef bool fnRegisterPlugin(Host&);
- typedef std::map<std::string,DLibrary*> LibMap;
-
- LibMap libraries; ///< Map containing the loaded libraries
- Host host; ///< Host app proxy, holding all providers
-
-};
-
-} // namespace pluma
-
-#endif // PLUMA_PLUGIN_MANAGER_HPP
diff --git a/src/uscxml/plugins/Pluma/Pluma.hpp b/src/uscxml/plugins/Pluma/Pluma.hpp
deleted file mode 100755
index a9d614e..0000000
--- a/src/uscxml/plugins/Pluma/Pluma.hpp
+++ /dev/null
@@ -1,171 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_PLUMA_HPP
-#define PLUMA_PLUMA_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <Pluma/Provider.hpp>
-#include <Pluma/PluginManager.hpp>
-
-////////////////////////////////////////////////////////////
-// Andy macro to convert parameter to string
-////////////////////////////////////////////////////////////
-#define PLUMA_2STRING(X) #X
-
-////////////////////////////////////////////////////////////
-// Macro that helps host applications defining
-// their provider classes
-////////////////////////////////////////////////////////////
-#define PLUMA_PROVIDER_HEADER(TYPE)\
-PLUMA_PROVIDER_HEADER_BEGIN(TYPE)\
-virtual TYPE* create() const = 0;\
-PLUMA_PROVIDER_HEADER_END
-
-////////////////////////////////////////////////////////////
-// Macro that generate first part of the provider definition
-////////////////////////////////////////////////////////////
-#define PLUMA_PROVIDER_HEADER_BEGIN(TYPE)\
-class TYPE##Provider: public pluma::Provider{\
-private:\
- friend class pluma::Pluma;\
- static const unsigned int PLUMA_INTERFACE_VERSION;\
- static const unsigned int PLUMA_INTERFACE_LOWEST_VERSION;\
- static const std::string PLUMA_PROVIDER_TYPE;\
- std::string plumaGetType() const{ return PLUMA_PROVIDER_TYPE; }\
-public:\
- unsigned int getVersion() const{ return PLUMA_INTERFACE_VERSION; }
-
-////////////////////////////////////////////////////////////
-// Macro that generate last part of the provider definition
-////////////////////////////////////////////////////////////
-#define PLUMA_PROVIDER_HEADER_END };
-
-////////////////////////////////////////////////////////////
-// Macro that generate the provider declaration
-////////////////////////////////////////////////////////////
-#define PLUMA_PROVIDER_SOURCE(TYPE, Version, LowestVersion)\
-const std::string TYPE##Provider::PLUMA_PROVIDER_TYPE = PLUMA_2STRING( TYPE );\
-const unsigned int TYPE##Provider::PLUMA_INTERFACE_VERSION = Version;\
-const unsigned int TYPE##Provider::PLUMA_INTERFACE_LOWEST_VERSION = LowestVersion;
-
-
-////////////////////////////////////////////////////////////
-// Macro that helps plugins generating their provider implementations
-// PRE: SPECIALIZED_TYPE must inherit from BASE_TYPE
-////////////////////////////////////////////////////////////
-#define PLUMA_INHERIT_PROVIDER(SPECIALIZED_TYPE, BASE_TYPE)\
-class SPECIALIZED_TYPE##Provider: public BASE_TYPE##Provider{\
-public:\
- BASE_TYPE * create() const{ return new SPECIALIZED_TYPE (); }\
-};
-
-
-namespace pluma{
-
-////////////////////////////////////////////////////////////
-/// \brief Pluma plugins management
-///
-////////////////////////////////////////////////////////////
-class Pluma: public PluginManager{
-
-public:
- ////////////////////////////////////////////////////////////
- /// \brief Default Constructor
- ///
- ////////////////////////////////////////////////////////////
- Pluma();
-
- ////////////////////////////////////////////////////////////
- /// \brief Tell Pluma to accept a certain type of providers
- ///
- /// A Pluma object is able to accept multiple types of providers.
- /// When a plugin is loaded, it tries to register it's providers
- /// implementations. Those are only accepted by the host
- /// application if it's accepting providers of that kind.
- ///
- /// \tparam ProviderType type of provider.
- ///
- ////////////////////////////////////////////////////////////
- template<typename ProviderType>
- void acceptProviderType();
-
- ////////////////////////////////////////////////////////////
- /// \brief Get the stored providers of a certain type.
- ///
- /// Providers are added at the end of the \a providers vector.
- ///
- /// \tparam ProviderType type of provider to be returned.
- /// \param[out] providers Vector to fill with the existing
- /// providers.
- ///
- ////////////////////////////////////////////////////////////
- template<typename ProviderType>
- void getProviders(std::vector<ProviderType*>& providers);
-};
-
-#include <Pluma/Pluma.inl>
-
-}
-
-
-#endif // PLUMA_PLUMA_HPP
-
-
-////////////////////////////////////////////////////////////
-/// \class pluma::Pluma
-///
-/// Pluma is the main class of Pluma library. Allows hosting
-/// applications to load/unload dlls in runtime (plugins), and
-/// to get providers of shared interface objects.
-///
-/// Example:
-/// \code
-/// pluma::Pluma pluma;
-/// // Tell it to accept providers of the type DeviceProvider
-/// pluma.acceptProviderType<DeviceProvider>();
-/// // Load some dll
-/// pluma.load("plugins/standard_devices");
-/// // Get device providers into a vector
-/// std::vector<DeviceProvider*> providers;
-/// pluma.getProviders(providers);
-/// // create a Device from the first provider
-/// if (!providers.empty()){
-/// Device* myDevice = providers.first()->create();
-/// // do something with myDevice
-/// std::cout << device->getDescription() << std::endl;
-/// // (...)
-/// delete myDevice;
-/// }
-/// \endcode
-///
-/// It is also possible to add local providers, providers that
-/// are defined directly on the host application. That can
-/// be useful to provide and use default implementations of certain
-/// interfaces, along with plugin implementations.
-///
-////////////////////////////////////////////////////////////
diff --git a/src/uscxml/plugins/Pluma/Pluma.inl b/src/uscxml/plugins/Pluma/Pluma.inl
deleted file mode 100755
index c3b6ce7..0000000
--- a/src/uscxml/plugins/Pluma/Pluma.inl
+++ /dev/null
@@ -1,52 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-inline Pluma::Pluma(){
- // Nothing to do
-}
-
-
-////////////////////////////////////////////////////////////
-template<typename ProviderType>
-void Pluma::acceptProviderType(){
- PluginManager::registerType(
- ProviderType::PLUMA_PROVIDER_TYPE,
- ProviderType::PLUMA_INTERFACE_VERSION,
- ProviderType::PLUMA_INTERFACE_LOWEST_VERSION
- );
-}
-
-
-////////////////////////////////////////////////////////////
-template<typename ProviderType>
-void Pluma::getProviders(std::vector<ProviderType*>& providers){
- const std::list<Provider*>* lst = PluginManager::getProviders(ProviderType::PLUMA_PROVIDER_TYPE);
- if (!lst) return;
- providers.reserve(providers.size() + lst->size());
- std::list<Provider*>::const_iterator it;
- for (it = lst->begin() ; it != lst->end() ; ++it)
- providers.push_back(static_cast<ProviderType*>(*it));
-}
diff --git a/src/uscxml/plugins/Pluma/Provider.cpp b/src/uscxml/plugins/Pluma/Provider.cpp
deleted file mode 100644
index 7691eb1..0000000
--- a/src/uscxml/plugins/Pluma/Provider.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Provider.hpp>
-#include <Pluma/Host.hpp>
-
-
-namespace pluma {
-
-////////////////////////////////////////////////////////////
-Provider::~Provider() {
- // Nothing to do
-}
-
-
-////////////////////////////////////////////////////////////
-bool Provider::isCompatible(const Host& host) const {
- // check compatibility with host
- const std::string& type = this->plumaGetType();
- if (!host.knows(type)) return false;
- unsigned int lowest = host.getLowestVersion(type);
- unsigned int current = host.getVersion(type);
- unsigned int myVersion = this->getVersion();
- return lowest <= myVersion && myVersion <= current;
-}
-
-} // namespace pluma
diff --git a/src/uscxml/plugins/Pluma/Provider.hpp b/src/uscxml/plugins/Pluma/Provider.hpp
deleted file mode 100755
index d01e7f4..0000000
--- a/src/uscxml/plugins/Pluma/Provider.hpp
+++ /dev/null
@@ -1,204 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// Pluma - Plug-in Management Framework
-// Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef PLUMA_PROVIDER_HPP
-#define PLUMA_PROVIDER_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <Pluma/Config.hpp>
-#include <string>
-
-
-namespace pluma{
-class Host;
-
-////////////////////////////////////////////////////////////
-/// \brief Interface to provide applications with objects from plugins.
-///
-////////////////////////////////////////////////////////////
-class PLUMA_API Provider{
-friend class Host;
-
-
-public:
-
- ////////////////////////////////////////////////////////////
- /// \brief Destructor.
- ///
- ////////////////////////////////////////////////////////////
- virtual ~Provider();
-
- ////////////////////////////////////////////////////////////
- /// \brief Get provider version.
- ///
- /// \return Version number.
- ///
- ////////////////////////////////////////////////////////////
- virtual unsigned int getVersion() const = 0;
-
- ////////////////////////////////////////////////////////////
- /// \brief Check compatibility with host.
- ///
- /// The same provider may be compiled with different versions
- /// on host side and on plugins side. This function checks if
- /// a plugin provider is compatible with the current version of
- /// the same provider type on the host side.
- ///
- /// \param host Host, proxy of host application.
- ///
- /// \return True if it's compatible with \a host.
- ///
- ////////////////////////////////////////////////////////////
- bool isCompatible(const Host& host) const;
-
-
-private:
-
- ////////////////////////////////////////////////////////////
- /// \brief Get provider type.
- ///
- /// Each provider defined on the host application is identified by
- /// a unique type. Those types are automatically managed internally by
- /// pluma.
- ///
- /// \return Provider type id.
- ///
- ////////////////////////////////////////////////////////////
- virtual std::string plumaGetType() const = 0;
-
-};
-
-} // namespace pluma
-
-
-#endif // PLUMA_PROVIDER_HPP
-
-
-////////////////////////////////////////////////////////////
-/// \class pluma::Provider
-/// The plugin specific implementations are unknown at the host side,
-/// only their shared interfaces are known. Then, host app needs a generic
-/// way of create interface objects. That's what provider classes are for.
-/// It is the factory design pattern
-/// (http://www.oodesign.com/factory-pattern.html)
-///
-/// Shared interfaces define their provider types (by inheriting from
-/// pluma::Provider). Hosts then use those tipes to get objects from the
-/// plugins.
-/// Plugins derive the shared interface providers so that they can provide
-/// host with specific implementations of the shared interface.
-/// Those specific providers are given to the host through a connect function.
-///
-///
-/// Example: A host app uses objects of type Device. A certain plugin
-/// defines a Keyboard, witch is a Device.
-/// The Host will use DeviceProviders to create objects of type Device.
-/// The plugin will provide host specifically with a KeyboardProvider.
-/// Other plugins may provide host with other derived DeviceProvider types.
-///
-/// Device hpp (shared):
-/// \code
-/// #include <Pluma/Pluma.hpp>
-/// class Device{
-/// public:
-/// virtual std::string getDescription() const = 0;
-/// };
-/// // create DevicedProvider class
-/// PLUMA_PROVIDER_HEADER(Device);
-/// \endcode
-///
-/// Device cpp (shared):
-/// \code
-/// #include "Device.hpp"
-/// generate DevicedProvider with version 6, and compatible with at least v.3
-/// PLUMA_PROVIDER_SOURCE(Device, 6, 3);
-/// \endcode
-///
-///
-/// <br>
-/// Keyboard code on the plugin side:
-/// \code
-/// #include <Pluma/Pluma.hpp>
-/// #include "Device.hpp"
-///
-/// class Keyboard: public Device{
-/// public:
-/// std::string getDescription() const{
-/// return "keyboard";
-/// }
-/// };
-///
-/// // create KeyboardProvider, it implements DeviceProvider
-/// PLUMA_INHERIT_PROVIDER(Keyboard, Device);
-/// \endcode
-///
-/// plugin connector:
-/// \code
-/// #include <Pluma/Connector.hpp>
-/// #include "Keyboard.hpp"
-///
-/// PLUMA_CONNECTOR
-/// bool pluginConnect(pluma::Host& host){
-/// // add a keyboard provider to host
-/// host.add( new KeyboardProvider() );
-/// return true;
-/// }
-/// \endcode
-///
-///
-/// Host application code:
-/// \code
-/// #include <Pluma/Pluma.hpp>
-///
-/// #include "Device.hpp"
-/// #include <iostream>
-/// #include <vector>
-///
-/// int main(){
-///
-/// pluma::Pluma plugins;
-/// // Tell plugins manager to accept providers of the type DeviceProvider
-/// plugins.acceptProviderType<DeviceProvider>();
-/// // Load library "standard_devices" from folder "plugins"
-/// plugins.load("plugins", "standard_devices");
-///
-/// // Get device providers into a vector
-/// std::vector<DeviceProvider*> providers;
-/// plugins.getProviders(providers);
-///
-/// // create a Device from the first provider
-/// if (!providers.empty()){
-/// Device* myDevice = providers.first()->create();
-/// // do something with myDevice
-/// std::cout << device->getDescription() << std::endl;
-/// // and delete it in the end
-/// delete myDevice;
-/// }
-/// return 0;
-/// }
-/// \endcode
-///
-////////////////////////////////////////////////////////////
diff --git a/src/uscxml/plugins/Pluma/uce-dirent.h b/src/uscxml/plugins/Pluma/uce-dirent.h
deleted file mode 100644
index bafd4e4..0000000
--- a/src/uscxml/plugins/Pluma/uce-dirent.h
+++ /dev/null
@@ -1,671 +0,0 @@
-/*
- * uce-dirent.h - operating system independent dirent implementation
- *
- * Copyright (C) 1998-2002 Toni Ronkko
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * ``Software''), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
- *
- * $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
- *
- * $Log: uce-dirent.h,v $
- * Revision 1.7 2002/05/13 10:48:35 tr
- * embedded some source code directly to the header so that no source
- * modules need to be included in the MS Visual C project using the
- * interface, removed all the dependencies to other headers of the `uce'
- * library so that the header can be made public
- *
- * Revision 1.6 2002/04/12 16:22:04 tr
- * Unified Compiling Environment (UCE) replaced `std' library
- *
- * Revision 1.5 2001/07/20 16:33:40 tr
- * moved to `std' library and re-named defines accordingly
- *
- * Revision 1.4 2001/07/10 16:47:18 tronkko
- * revised comments
- *
- * Revision 1.3 2001/01/11 13:16:43 tr
- * using ``uce-machine.h'' for finding out defines such as `FREEBSD'
- *
- * Revision 1.2 2000/10/08 16:00:41 tr
- * copy of FreeBSD man page
- *
- * Revision 1.1 2000/07/10 05:53:16 tr
- * Initial revision
- *
- * Revision 1.2 1998/07/19 18:29:14 tr
- * Added error reporting capabilities and some asserts.
- *
- * Revision 1.1 1998/07/04 16:27:51 tr
- * Initial revision
- *
- *
- * MSVC 1.0 scans automatic dependencies incorrectly when your project
- * contains this very header. The problem is that MSVC cannot handle
- * include directives inside #if..#endif block those are never entered.
- * Since this header ought to compile in many different operating systems,
- * there had to be several conditional blocks that are compiled only in
- * operating systems for what they were designed for. MSVC 1.0 cannot
- * handle inclusion of sys/dir.h in a part that is compiled only in Apollo
- * operating system. To fix the problem you need to insert DIR.H into
- * SYSINCL.DAT located in MSVC\BIN directory and restart visual C++.
- * Consult manuals for more informaton about the problem.
- *
- * Since many UNIX systems have dirent.h we assume to have one also.
- * However, if your UNIX system does not have dirent.h you can download one
- * for example at: http://ftp.uni-mannheim.de/ftp/GNU/dirent/dirent.tar.gz.
- * You can also see if you have one of dirent.h, direct.h, dir.h, ndir.h,
- * sys/dir.h and sys/ndir.h somewhere. Try defining HAVE_DIRENT_H,
- * HAVE_DIRECT_H, HAVE_DIR_H, HAVE_NDIR_H, HAVE_SYS_DIR_H and
- * HAVE_SYS_NDIR_H according to the files found.
- */
-#ifndef DIRENT_H
-#define DIRENT_H
-#define DIRENT_H_INCLUDED
-
-/* find out platform */
-#if defined(MSDOS) /* MS-DOS */
-#elif defined(__MSDOS__) /* Turbo C/Borland */
-# define MSDOS
-#elif defined(__DOS__) /* Watcom */
-# define MSDOS
-#endif
-
-#if defined(WIN32) /* MS-Windows */
-#elif defined(__NT__) /* Watcom */
-# define WIN32
-#elif defined(_WIN32) /* Microsoft */
-# define WIN32
-#elif defined(__WIN32__) /* Borland */
-# define WIN32
-#endif
-
-/*
- * See what kind of dirent interface we have unless autoconf has already
- * determinated that.
- */
-#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
-# if defined(_MSC_VER) /* Microsoft C/C++ */
-/* no dirent.h */
-# elif defined(__BORLANDC__) /* Borland C/C++ */
-# define HAVE_DIRENT_H
-# define VOID_CLOSEDIR
-# elif defined(__TURBOC__) /* Borland Turbo C */
-/* no dirent.h */
-# elif defined(__WATCOMC__) /* Watcom C/C++ */
-# define HAVE_DIRECT_H
-# elif defined(__apollo) /* Apollo */
-# define HAVE_SYS_DIR_H
-# elif defined(__hpux) /* HP-UX */
-# define HAVE_DIRENT_H
-# elif defined(__alpha) || defined(__alpha__) /* Alpha OSF1 */
-# error "not implemented"
-# elif defined(__sgi) /* Silicon Graphics */
-# define HAVE_DIRENT_H
-# elif defined(sun) || defined(_sun) /* Sun Solaris */
-# define HAVE_DIRENT_H
-# elif defined(__FreeBSD__) /* FreeBSD */
-# define HAVE_DIRENT_H
-# elif defined(__linux__) /* Linux */
-# define HAVE_DIRENT_H
-# elif defined(__GNUC__) /* GNU C/C++ */
-# define HAVE_DIRENT_H
-# else
-# error "not implemented"
-# endif
-#endif
-
-/* include proper interface headers */
-#if defined(HAVE_DIRENT_H)
-# include <dirent.h>
-# ifdef FREEBSD
-# define NAMLEN(dp) ((int)((dp)->d_namlen))
-# else
-# define NAMLEN(dp) ((int)(strlen((dp)->d_name)))
-# endif
-
-#elif defined(HAVE_NDIR_H)
-# include <ndir.h>
-# define NAMLEN(dp) ((int)((dp)->d_namlen))
-
-#elif defined(HAVE_SYS_NDIR_H)
-# include <sys/ndir.h>
-# define NAMLEN(dp) ((int)((dp)->d_namlen))
-
-#elif defined(HAVE_DIRECT_H)
-# include <direct.h>
-# define NAMLEN(dp) ((int)((dp)->d_namlen))
-
-#elif defined(HAVE_DIR_H)
-# include <dir.h>
-# define NAMLEN(dp) ((int)((dp)->d_namlen))
-
-#elif defined(HAVE_SYS_DIR_H)
-# include <sys/types.h>
-# include <sys/dir.h>
-# ifndef dirent
-# define dirent direct
-# endif
-# define NAMLEN(dp) ((int)((dp)->d_namlen))
-
-#elif defined(MSDOS) || defined(WIN32)
-
-/* figure out type of underlaying directory interface to be used */
-# if defined(WIN32)
-# define DIRENT_WIN32_INTERFACE
-# elif defined(MSDOS)
-# define DIRENT_MSDOS_INTERFACE
-# else
-# error "missing native dirent interface"
-# endif
-
-/*** WIN32 specifics ***/
-# if defined(DIRENT_WIN32_INTERFACE)
-# include <windows.h>
-# if !defined(DIRENT_MAXNAMLEN)
-# define DIRENT_MAXNAMLEN (MAX_PATH)
-# endif
-
-
-/*** MS-DOS specifics ***/
-# elif defined(DIRENT_MSDOS_INTERFACE)
-# include <dos.h>
-
-/* Borland defines file length macros in dir.h */
-# if defined(__BORLANDC__)
-# include <dir.h>
-# if !defined(DIRENT_MAXNAMLEN)
-# define DIRENT_MAXNAMLEN ((MAXFILE)+(MAXEXT))
-# endif
-# if !defined(_find_t)
-# define _find_t find_t
-# endif
-
-/* Turbo C defines ffblk structure in dir.h */
-# elif defined(__TURBOC__)
-# include <dir.h>
-# if !defined(DIRENT_MAXNAMLEN)
-# define DIRENT_MAXNAMLEN ((MAXFILE)+(MAXEXT))
-# endif
-# define DIRENT_USE_FFBLK
-
-/* MSVC */
-# elif defined(_MSC_VER)
-# if !defined(DIRENT_MAXNAMLEN)
-# define DIRENT_MAXNAMLEN (12)
-# endif
-
-/* Watcom */
-# elif defined(__WATCOMC__)
-# if !defined(DIRENT_MAXNAMLEN)
-# if defined(__OS2__) || defined(__NT__)
-# define DIRENT_MAXNAMLEN (255)
-# else
-# define DIRENT_MAXNAMLEN (12)
-# endif
-# endif
-
-# endif
-# endif
-
-/*** generic MS-DOS and MS-Windows stuff ***/
-# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
-# define NAME_MAX DIRENT_MAXNAMLEN
-# endif
-# if NAME_MAX < DIRENT_MAXNAMLEN
-# error "assertion failed: NAME_MAX >= DIRENT_MAXNAMLEN"
-# endif
-
-
-/*
- * Substitute for real dirent structure. Note that `d_name' field is a
- * true character array although we have it copied in the implementation
- * dependent data. We could save some memory if we had declared `d_name'
- * as a pointer refering the name within implementation dependent data.
- * We have not done that since some code may rely on sizeof(d_name) to be
- * something other than four. Besides, directory entries are typically so
- * small that it takes virtually no time to copy them from place to place.
- */
-typedef struct dirent {
- char d_name[NAME_MAX + 1];
-
- /*** Operating system specific part ***/
-# if defined(DIRENT_WIN32_INTERFACE) /*WIN32*/
- WIN32_FIND_DATA data;
-# elif defined(DIRENT_MSDOS_INTERFACE) /*MSDOS*/
-# if defined(DIRENT_USE_FFBLK)
- struct ffblk data;
-# else
- struct _find_t data;
-# endif
-# endif
-} dirent;
-
-/* DIR substitute structure containing directory name. The name is
- * essential for the operation of ``rewinndir'' function. */
-typedef struct DIR {
- char *dirname; /* directory being scanned */
- dirent current; /* current entry */
- int dirent_filled; /* is current un-processed? */
-
- /*** Operating system specific part ***/
-# if defined(DIRENT_WIN32_INTERFACE)
- HANDLE search_handle;
-# elif defined(DIRENT_MSDOS_INTERFACE)
-# endif
-} DIR;
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* supply prototypes for dirent functions */
-static DIR *opendir (const char *dirname);
-static struct dirent *readdir (DIR *dirp);
-static int closedir (DIR *dirp);
-static void rewinddir (DIR *dirp);
-
-/*
- * Implement dirent interface as static functions so that the user does not
- * need to change his project in any way to use dirent function. With this
- * it is sufficient to include this very header from source modules using
- * dirent functions and the functions will be pulled in automatically.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-/* use ffblk instead of _find_t if requested */
-#if defined(DIRENT_USE_FFBLK)
-# define _A_ARCH (FA_ARCH)
-# define _A_HIDDEN (FA_HIDDEN)
-# define _A_NORMAL (0)
-# define _A_RDONLY (FA_RDONLY)
-# define _A_SUBDIR (FA_DIREC)
-# define _A_SYSTEM (FA_SYSTEM)
-# define _A_VOLID (FA_LABEL)
-# define _dos_findnext(dest) findnext(dest)
-# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
-#endif
-
-static int _initdir (DIR *p);
-static const char *_getdirname (const struct dirent *dp);
-static void _setdirname (struct DIR *dirp);
-
-/*
- * <function name="opendir">
- * <intro>open directory stream for reading
- * <syntax>DIR *opendir (const char *dirname);
- *
- * <desc>Open named directory stream for read and return pointer to the
- * internal working area that is used for retrieving individual directory
- * entries. The internal working area has no fields of your interest.
- *
- * <ret>Returns a pointer to the internal working area or NULL in case the
- * directory stream could not be opened. Global `errno' variable will set
- * in case of error as follows:
- *
- * <table>
- * [EACESS |Permission denied.
- * [EMFILE |Too many open files used by the process.
- * [ENFILE |Too many open files in system.
- * [ENOENT |Directory does not exist.
- * [ENOMEM |Insufficient memory.
- * [ENOTDIR |dirname does not refer to directory. This value is not
- * reliable on MS-DOS and MS-Windows platforms. Many
- * implementations return ENOENT even when the name refers to a
- * file.]
- * </table>
- * </function>
- */
-static DIR *
-opendir(
- const char *dirname) {
- DIR *dirp;
- assert (dirname != NULL);
-
- dirp = (DIR*)malloc (sizeof (struct DIR));
- if (dirp != NULL) {
- char *p;
-
- /* allocate room for directory name */
- dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
- if (dirp->dirname == NULL) {
- /* failed to duplicate directory name. errno set by malloc() */
- free (dirp);
- return NULL;
- }
- /* Copy directory name while appending directory separator and "*.*".
- * Directory separator is not appended if the name already ends with
- * drive or directory separator. Directory separator is assumed to be
- * '/' or '\' and drive separator is assumed to be ':'. */
- strcpy (dirp->dirname, dirname);
- p = strchr (dirp->dirname, '\0');
- if (dirp->dirname < p &&
- *(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') {
- strcpy (p++, "/");
- }
-# ifdef DIRENT_WIN32_INTERFACE
- strcpy (p, "*"); /*scan files with and without extension in win32*/
-# else
- strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
-# endif
-
- /* open stream */
- if (_initdir (dirp) == 0) {
- /* initialization failed */
- free (dirp->dirname);
- free (dirp);
- return NULL;
- }
- }
- return dirp;
-}
-
-
-/*
- * <function name="readdir">
- * <intro>read a directory entry
- * <syntax>struct dirent *readdir (DIR *dirp);
- *
- * <desc>Read individual directory entry and return pointer to a structure
- * containing the name of the entry. Individual directory entries returned
- * include normal files, sub-directories, pseudo-directories "." and ".."
- * and also volume labels, hidden files and system files in MS-DOS and
- * MS-Windows. You might want to use stat(2) function to determinate which
- * one are you dealing with. Many dirent implementations already contain
- * equivalent information in dirent structure but you cannot depend on
- * this.
- *
- * The dirent structure contains several system dependent fields that
- * generally have no interest to you. The only interesting one is char
- * d_name[] that is also portable across different systems. The d_name
- * field contains the name of the directory entry without leading path.
- * While d_name is portable across different systems the actual storage
- * capacity of d_name varies from system to system and there is no portable
- * way to find out it at compile time as different systems define the
- * capacity of d_name with different macros and some systems do not define
- * capacity at all (besides actual declaration of the field). If you really
- * need to find out storage capacity of d_name then you might want to try
- * NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
- * there are many MS-DOS and MS-Windows implementations those do not define
- * it. There are also systems that declare d_name as "char d_name[1]" and
- * then allocate suitable amount of memory at run-time. Thanks to Alain
- * Decamps (Alain.Decamps@advalvas.be) for pointing it out to me.
- *
- * This all leads to the fact that it is difficult to allocate space
- * for the directory names when the very same program is being compiled on
- * number of operating systems. Therefore I suggest that you always
- * allocate space for directory names dynamically.
- *
- * <ret>
- * Returns a pointer to a structure containing name of the directory entry
- * in `d_name' field or NULL if there was an error. In case of an error the
- * global `errno' variable will set as follows:
- *
- * <table>
- * [EBADF |dir parameter refers to an invalid directory stream. This value
- * is not set reliably on all implementations.]
- * </table>
- * </function>
- */
-static struct dirent *
-readdir (DIR *dirp) {
- assert (dirp != NULL);
- if (dirp == NULL) {
- errno = EBADF;
- return NULL;
- }
-
-#if defined(DIRENT_WIN32_INTERFACE)
- if (dirp->search_handle == INVALID_HANDLE_VALUE) {
- /* directory stream was opened/rewound incorrectly or it ended normally */
- errno = EBADF;
- return NULL;
- }
-#endif
-
- if (dirp->dirent_filled != 0) {
- /*
- * Directory entry has already been retrieved and there is no need to
- * retrieve a new one. Directory entry will be retrieved in advance
- * when the user calls readdir function for the first time. This is so
- * because real dirent has separate functions for opening and reading
- * the stream whereas Win32 and DOS dirents open the stream
- * automatically when we retrieve the first file. Therefore, we have to
- * save the first file when opening the stream and later we have to
- * return the saved entry when the user tries to read the first entry.
- */
- dirp->dirent_filled = 0;
- } else {
- /* fill in entry and return that */
-#if defined(DIRENT_WIN32_INTERFACE)
- if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
- /* Last file has been processed or an error occured */
- FindClose (dirp->search_handle);
- dirp->search_handle = INVALID_HANDLE_VALUE;
- errno = ENOENT;
- return NULL;
- }
-
-# elif defined(DIRENT_MSDOS_INTERFACE)
- if (_dos_findnext (&dirp->current.data) != 0) {
- /* _dos_findnext and findnext will set errno to ENOENT when no
- * more entries could be retrieved. */
- return NULL;
- }
-# endif
-
- _setdirname (dirp);
- assert (dirp->dirent_filled == 0);
- }
- return &dirp->current;
-}
-
-
-/*
- * <function name="closedir">
- * <intro>close directory stream.
- * <syntax>int closedir (DIR *dirp);
- *
- * <desc>Close directory stream opened by the `opendir' function. Close of
- * directory stream invalidates the DIR structure as well as previously read
- * dirent entry.
- *
- * <ret>The function typically returns 0 on success and -1 on failure but
- * the function may be declared to return void on same systems. At least
- * Borland C/C++ and some UNIX implementations use void as a return type.
- * The dirent wrapper tries to define VOID_CLOSEDIR whenever closedir is
- * known to return nothing. The very same definition is made by the GNU
- * autoconf if you happen to use it.
- *
- * The global `errno' variable will set to EBADF in case of error.
- * </function>
- */
-static int
-closedir (DIR *dirp) {
- int retcode = 0;
-
- /* make sure that dirp points to legal structure */
- assert (dirp != NULL);
- if (dirp == NULL) {
- errno = EBADF;
- return -1;
- }
-
- /* free directory name and search handles */
- if (dirp->dirname != NULL) free (dirp->dirname);
-
-#if defined(DIRENT_WIN32_INTERFACE)
- if (dirp->search_handle != INVALID_HANDLE_VALUE) {
- if (FindClose (dirp->search_handle) == FALSE) {
- /* Unknown error */
- retcode = -1;
- errno = EBADF;
- }
- }
-#endif
-
- /* clear dirp structure to make sure that it cannot be used anymore*/
- memset (dirp, 0, sizeof (*dirp));
-# if defined(DIRENT_WIN32_INTERFACE)
- dirp->search_handle = INVALID_HANDLE_VALUE;
-# endif
-
- free (dirp);
- return retcode;
-}
-
-
-/*
- * <function name="rewinddir">
- * <intro>rewind directory stream to the beginning
- * <syntax>void rewinddir (DIR *dirp);
- *
- * <desc>Rewind directory stream to the beginning so that the next call of
- * readdir() returns the very first directory entry again. However, note
- * that next call of readdir() may not return the same directory entry as it
- * did in first time. The directory stream may have been affected by newly
- * created files.
- *
- * Almost every dirent implementation ensure that rewinddir will update
- * the directory stream to reflect any changes made to the directory entries
- * since the previous ``opendir'' or ``rewinddir'' call. Keep an eye on
- * this if your program depends on the feature. I know at least one dirent
- * implementation where you are required to close and re-open the stream to
- * see the changes.
- *
- * <ret>Returns nothing. If something went wrong while rewinding, you will
- * notice it later when you try to retrieve the first directory entry.
- */
-static void
-rewinddir (DIR *dirp) {
- /* make sure that dirp is legal */
- assert (dirp != NULL);
- if (dirp == NULL) {
- errno = EBADF;
- return;
- }
- assert (dirp->dirname != NULL);
-
- /* close previous stream */
-#if defined(DIRENT_WIN32_INTERFACE)
- if (dirp->search_handle != INVALID_HANDLE_VALUE) {
- if (FindClose (dirp->search_handle) == FALSE) {
- /* Unknown error */
- errno = EBADF;
- }
- }
-#endif
-
- /* re-open previous stream */
- if (_initdir (dirp) == 0) {
- /* initialization failed but we cannot deal with error. User will notice
- * error later when she tries to retrieve first directory enty. */
- /*EMPTY*/;
- }
-}
-
-
-/*
- * Open native directory stream object and retrieve first file.
- * Be sure to close previous stream before opening new one.
- */
-static int
-_initdir (DIR *dirp) {
- assert (dirp != NULL);
- assert (dirp->dirname != NULL);
- dirp->dirent_filled = 0;
-
-# if defined(DIRENT_WIN32_INTERFACE)
- /* Open stream and retrieve first file */
- dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
- if (dirp->search_handle == INVALID_HANDLE_VALUE) {
- /* something went wrong but we don't know what. GetLastError() could
- * give us more information about the error, but then we should map
- * the error code into errno. */
- errno = ENOENT;
- return 0;
- }
-
-# elif defined(DIRENT_MSDOS_INTERFACE)
- if (_dos_findfirst (dirp->dirname,
- _A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
- &dirp->current.data) != 0) {
- /* _dos_findfirst and findfirst will set errno to ENOENT when no
- * more entries could be retrieved. */
- return 0;
- }
-# endif
-
- /* initialize DIR and it's first entry */
- _setdirname (dirp);
- dirp->dirent_filled = 1;
- return 1;
-}
-
-
-/*
- * Return implementation dependent name of the current directory entry.
- */
-static const char *
-_getdirname (const struct dirent *dp) {
-#if defined(DIRENT_WIN32_INTERFACE)
- return dp->data.cFileName;
-
-#elif defined(DIRENT_USE_FFBLK)
- return dp->data.ff_name;
-
-#else
- return dp->data.name;
-#endif
-}
-
-
-/*
- * Copy name of implementation dependent directory entry to the d_name field.
- */
-static void
-_setdirname (struct DIR *dirp) {
- /* make sure that d_name is long enough */
- assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
-
- strncpy (dirp->current.d_name,
- _getdirname (&dirp->current),
- NAME_MAX);
- dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
-}
-
-# ifdef __cplusplus
-}
-# endif
-# define NAMLEN(dp) ((int)(strlen((dp)->d_name)))
-
-#else
-# error "missing dirent interface"
-#endif
-
-
-#endif /*DIRENT_H*/
-
diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt
index 2570dda..b004a33 100644
--- a/src/uscxml/plugins/datamodel/CMakeLists.txt
+++ b/src/uscxml/plugins/datamodel/CMakeLists.txt
@@ -1,99 +1,3 @@
-if (BUILD_DM_ECMA)
- if (JSC_FOUND)
- set(USCXML_DATAMODELS "ecmascript(JSC) ${USCXML_DATAMODELS}")
- # JavaScriptCore ecmascript datamodel
- file(GLOB JSC_DATAMODEL
- ecmascript/JavaScriptCore/*.cpp
- ecmascript/JavaScriptCore/*.h
- ecmascript/*.cpp
- ecmascript/*.h
- )
- file(GLOB_RECURSE JSC_DOM
- ecmascript/JavaScriptCore/dom/*.cpp
- ecmascript/JavaScriptCore/dom/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("JavaScriptCore" FILES ${JSC_DATAMODEL})
- source_group("dom" FILES ${JSC_DOM})
-
- add_library(
- datamodel_jsc SHARED
- ${JSC_DATAMODEL}
- ${JSC_DOM}
- "../Plugins.cpp")
- target_link_libraries(datamodel_jsc uscxml ${JSC_LIBRARY})
- set_target_properties(datamodel_jsc PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_jsc PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_jsc PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${JSC_DATAMODEL})
- list (APPEND USCXML_FILES ${JSC_DOM})
- list (APPEND USCXML_OPT_LIBS ${JSC_LIBRARY})
- endif()
-
- elseif(V8_FOUND)
-
- # GOOGLE V8 ecmascript datamodel
- set(USCXML_DATAMODELS "ecmascript(V8) ${USCXML_DATAMODELS}")
- # set(ENV{V8_SRC} ${CMAKE_SOURCE_DIR}/../v8)
- if (V8_FOUND AND BUILD_DM_ECMA)
- file(GLOB V8_DATAMODEL
- ecmascript/v8/*.cpp
- ecmascript/v8/*.h
- ecmascript/*.cpp
- ecmascript/*.h
- )
- file(GLOB_RECURSE V8_DOM
- ecmascript/v8/dom/*.cpp
- ecmascript/v8/dom/*.h
- )
-
- if (BUILD_AS_PLUGINS)
- source_group("V8" FILES ${V8_DATAMODEL})
- source_group("dom" FILES ${V8_DOM})
-
- add_library(
- datamodel_v8 SHARED
- ${V8_DATAMODEL}
- ${V8_DOM}
- "../Plugins.cpp")
- target_link_libraries(datamodel_v8 uscxml ${V8_LIBRARY})
- set_target_properties(datamodel_v8 PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_v8 PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_v8 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${V8_DATAMODEL})
- list (APPEND USCXML_FILES ${V8_DOM})
- endif()
- endif()
- elseif(SPIDERMONKEY_FOUND)
- set(USCXML_DATAMODELS "ecmascript(SpiderMonkey) ${USCXML_DATAMODELS}")
- # set(ENV{V8_SRC} ${CMAKE_SOURCE_DIR}/../v8)
- file(GLOB SPIDERMONKEY_DATAMODEL
- ecmascript/SpiderMonkey/*.cpp
- ecmascript/SpiderMonkey/*.h
- ecmascript/*.cpp
- ecmascript/*.h
- )
-
- if (BUILD_AS_PLUGINS)
- source_group("SpiderMonkey" FILES ${SPIDERMONKEY_DATAMODEL})
-
- add_library(
- datamodel_spidermonkey SHARED
- ${SPIDERMONKEY_DATAMODEL}
- "../Plugins.cpp")
- target_link_libraries(datamodel_spidermonkey uscxml ${SPIDERMONKEY_LIBRARY})
- set_target_properties(datamodel_spidermonkey PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_spidermonkey PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_spidermonkey PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SPIDERMONKEY_DATAMODEL})
- endif()
- endif()
-endif()
-
-
# NULL datamodel (not useful as plugin)
set(USCXML_DATAMODELS "null ${USCXML_DATAMODELS}")
@@ -104,115 +8,109 @@ file(GLOB NULL_DATAMODEL
list (APPEND USCXML_FILES ${NULL_DATAMODEL})
-# Lua datamodel
+if (JSC_FOUND)
+ set(USCXML_DATAMODELS "ecmascript(JSC) ${USCXML_DATAMODELS}")
+ # JavaScriptCore ecmascript datamodel
+ file(GLOB JSC_DATAMODEL
+ ecmascript/JavaScriptCore/*.cpp
+ ecmascript/JavaScriptCore/*.h
+ ecmascript/*.cpp
+ ecmascript/*.h
+ )
+ list (APPEND USCXML_FILES ${JSC_DATAMODEL})
+ list (APPEND USCXML_OPT_LIBS ${JSC_LIBRARY})
+endif()
+
+
+if (V8_FOUND)
+ set(USCXML_DATAMODELS "ecmascript(V8) ${USCXML_DATAMODELS}")
+ # JavaScriptCore ecmascript datamodel
+ file(GLOB V8_DATAMODEL
+ ecmascript/v8/*.cpp
+ ecmascript/v8/*.h
+ ecmascript/*.cpp
+ ecmascript/*.h
+ )
+ list (APPEND USCXML_FILES ${V8_DATAMODEL})
+ list (APPEND USCXML_OPT_LIBS ${V8_LIBRARY})
+endif()
+
-if (BUILD_DM_LUA AND LUA_FOUND AND NOT BUILD_MINIMAL)
+if (LUA_FOUND)
set(USCXML_DATAMODELS "lua ${USCXML_DATAMODELS}")
+ # Lua ecmascript datamodel
file(GLOB LUA_DATAMODEL
lua/*.cpp
lua/*.h
)
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${LUA_DATAMODEL})
- add_library(datamodel_lua SHARED ${LUA_DATAMODEL} "../Plugins.cpp")
- target_link_libraries(datamodel_lua
- uscxml
- ${LUA_LIBRARIES}
- )
- set_target_properties(datamodel_lua PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_lua PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_lua PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${LUA_DATAMODEL})
- endif()
+ list (APPEND USCXML_FILES ${LUA_DATAMODEL})
+ list (APPEND USCXML_OPT_LIBS ${LUA_LIBRARY})
endif()
-# XPath datamodel
-
-if (BUILD_DM_XPATH AND NOT BUILD_MINIMAL)
- set(USCXML_DATAMODELS "xpath ${USCXML_DATAMODELS}")
- file(GLOB XPATH_DATAMODEL
- xpath/*.cpp
- xpath/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${XPATH_DATAMODEL})
- add_library(datamodel_xpath SHARED ${XPATH_DATAMODEL} "../Plugins.cpp")
- target_link_libraries(datamodel_xpath uscxml)
- set_target_properties(datamodel_xpath PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_xpath PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_xpath PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${XPATH_DATAMODEL})
+find_package(SWIG)
+if (NOT SWIG_FOUND)
+ message(STATUS "No swig binary found, not generating DOM classes")
+elseif(SWIG_VERSION VERSION_LESS 3.0.8)
+ message(STATUS "SWIG version > 3.0.8 is recommended, found ${SWIG_VERSION} - skipping DOM generation")
+else()
+ if (JSC_FOUND)
+ add_custom_target(jsc-bindings
+ COMMAND ${SWIG_EXECUTABLE}
+ -I${XercesC_INCLUDE_DIRS}
+ -I${PROJECT_SOURCE_DIR}/src
+ -I${CMAKE_BINARY_DIR}
+ -javascript
+ -jsc
+ -c++
+ -o ${CMAKE_CURRENT_SOURCE_DIR}/ecmascript/JavaScriptCore/JSCDOM.cpp.inc
+ ecmascript/JavaScriptCore/bindings.i
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Creating the DOM for JavaScriptCore ...")
+
+ # list (APPEND JSC_DATAMODEL ${CMAKE_CURRENT_SOURCE_DIR}/ecmascript/JavaScriptCore/JSCDOM.cpp.inc)
+ set_target_properties(jsc-bindings PROPERTIES FOLDER "Bindings")
endif()
-endif()
-# SWI PROLOG datamodel
-
-if (SWI_FOUND AND BUILD_DM_PROLOG AND NOT BUILD_MINIMAL)
- set(USCXML_DATAMODELS "prolog ${USCXML_DATAMODELS}")
-
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/prolog/swi/SWIConfig.h.in ${CMAKE_BINARY_DIR}/uscxml/SWIConfig.h)
-
-# message(FATAL_ERROR "SWI_INCLUDE_DIR: ${SWI_INCLUDE_DIR}")
-
- # if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -read_only_relocs suppress")
- # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -read_only_relocs suppress")
- # set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -read_only_relocs suppress")
- # set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -read_only_relocs suppress")
- # endif()
- file(GLOB_RECURSE SWI_DATAMODEL
- prolog/swi/*.cpp
- prolog/swi/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${SWI_DATAMODEL})
- add_library(
- datamodel_swi SHARED
- ${SWI_DATAMODEL}
- "../Plugins.cpp")
- target_link_libraries(datamodel_swi
- uscxml
- ${GMP_LIBRARY}
- ${CURSES_LIBRARIES}
- ${SWI_LIBRARY})
- set_target_properties(datamodel_swi PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_swi PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_swi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SWI_DATAMODEL})
+ if (V8_FOUND)
+ add_custom_target(v8-bindings
+ COMMAND ${SWIG_EXECUTABLE}
+ -I${XercesC_INCLUDE_DIRS}
+ -I${PROJECT_SOURCE_DIR}/src
+ -I${CMAKE_BINARY_DIR}
+ -javascript
+ -v8
+ -c++
+ -o ${CMAKE_CURRENT_SOURCE_DIR}/ecmascript/v8/V8DOM.cpp.inc
+ ecmascript/v8/bindings.i
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Creating the DOM for V8 ...")
+
+ # list (APPEND V8_DATAMODEL ${CMAKE_CURRENT_SOURCE_DIR}/ecmascript/v8/V8DOM.cpp.inc)
+ set_target_properties(v8-bindings PROPERTIES FOLDER "Bindings")
+
endif()
-endif()
-
-# Promela datamodel
-
-if (BUILD_DM_PROMELA AND NOT BUILD_MINIMAL)
- set(USCXML_DATAMODELS "promela ${USCXML_DATAMODELS}")
-
- file(GLOB_RECURSE PROMELA_DATAMODEL
- promela/*.cpp
- promela/*.c
- promela/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES PROMELA_DATAMODEL)
- add_library(
- datamodel_promela SHARED
- ${PROMELA_DATAMODEL}
- "../Plugins.cpp")
- target_link_libraries(datamodel_promela uscxml)
- set_target_properties(datamodel_promela PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_promela PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_promela PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${PROMELA_DATAMODEL})
+ if (LUA_FOUND)
+ add_custom_target(lua-bindings
+ COMMAND ${SWIG_EXECUTABLE}
+ -I${XercesC_INCLUDE_DIRS}
+ -I${PROJECT_SOURCE_DIR}/src
+ -I${CMAKE_BINARY_DIR}
+ -lua
+ -c++
+ -o ${CMAKE_CURRENT_SOURCE_DIR}/lua/LuaDOM.cpp.inc
+ lua/bindings.i
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Creating the DOM for Lua ...")
+
+ # list (APPEND V8_DATAMODEL ${CMAKE_CURRENT_SOURCE_DIR}/ecmascript/v8/V8DOM.cpp.inc)
+ set_target_properties(lua-bindings PROPERTIES FOLDER "Bindings")
endif()
endif()
+
set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE)
set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
set(USCXML_DATAMODELS ${USCXML_DATAMODELS} PARENT_SCOPE)
diff --git a/src/uscxml/plugins/datamodel/common/bindings/dom/defines.i b/src/uscxml/plugins/datamodel/common/bindings/dom/defines.i
new file mode 100644
index 0000000..0ef7f0e
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/common/bindings/dom/defines.i
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * defines.i - This file contains all directives included
+ * verbatim into the C++ output file
+ */
+
+%{
+#include "xercesc/sax/InputSource.hpp"
+#include "xercesc/sax/SAXException.hpp"
+#include "xercesc/sax/SAXParseException.hpp"
+#include "xercesc/sax/Locator.hpp"
+#include "xercesc/sax/HandlerBase.hpp"
+#include "xercesc/sax2/Attributes.hpp"
+#include "xercesc/sax2/ContentHandler.hpp"
+#include "xercesc/sax2/LexicalHandler.hpp"
+#include "xercesc/sax2/DefaultHandler.hpp"
+#include "xercesc/sax2/SAX2XMLReader.hpp"
+#include "xercesc/sax2/XMLReaderFactory.hpp"
+#include "xercesc/util/PlatformUtils.hpp"
+#include "xercesc/util/TransService.hpp"
+#include "xercesc/util/XMLString.hpp"
+#include "xercesc/util/XMLUri.hpp"
+#include "xercesc/util/QName.hpp"
+#include "xercesc/util/HexBin.hpp"
+#include "xercesc/util/Base64.hpp"
+#include "xercesc/parsers/AbstractDOMParser.hpp"
+#include "xercesc/parsers/XercesDOMParser.hpp"
+#include "xercesc/parsers/SAXParser.hpp"
+#include "xercesc/dom/DOM.hpp"
+#include "xercesc/framework/LocalFileInputSource.hpp"
+#include "xercesc/framework/MemBufInputSource.hpp"
+#include "xercesc/framework/StdInInputSource.hpp"
+#include "xercesc/framework/URLInputSource.hpp"
+#include "xercesc/framework/XMLGrammarDescription.hpp"
+#include "xercesc/framework/XMLDTDDescription.hpp"
+#include "xercesc/framework/XMLSchemaDescription.hpp"
+#include "xercesc/util/NameIdPool.hpp"
+#include "xercesc/util/XMLEnumerator.hpp"
+#include "xercesc/framework/XMLValidator.hpp"
+#include "xercesc/validators/common/Grammar.hpp"
+#include "xercesc/validators/DTD/DTDAttDef.hpp"
+#include "xercesc/validators/DTD/DTDAttDefList.hpp"
+#include "xercesc/validators/DTD/DTDGrammar.hpp"
+#include "xercesc/validators/DTD/DTDValidator.hpp"
+#include "xercesc/validators/schema/SchemaGrammar.hpp"
+#include "xercesc/validators/schema/SchemaValidator.hpp"
+#include "xercesc/validators/schema/SchemaAttDefList.hpp"
+#include "xercesc/validators/schema/SchemaAttDef.hpp"
+#include "xercesc/framework/XMLFormatter.hpp"
+#include "xercesc/framework/MemBufFormatTarget.hpp"
+#include "xercesc/framework/LocalFileFormatTarget.hpp"
+#include "xercesc/framework/StdOutFormatTarget.hpp"
+#include "xercesc/framework/Wrapper4InputSource.hpp"
+#include "xercesc/framework/psvi/PSVIHandler.hpp"
+
+// for resolving XMLExceptions
+#include "xercesc/util/ArrayIndexOutOfBoundsException.hpp"
+#include "xercesc/util/EmptyStackException.hpp"
+#include "xercesc/util/IllegalArgumentException.hpp"
+#include "xercesc/util/InvalidCastException.hpp"
+#include "xercesc/util/IOException.hpp"
+#include "xercesc/util/NoSuchElementException.hpp"
+#include "xercesc/util/NullPointerException.hpp"
+#include "xercesc/util/NumberFormatException.hpp"
+#include "xercesc/util/ParseException.hpp"
+#include "xercesc/util/RuntimeException.hpp"
+#include "xercesc/util/SchemaDateTimeException.hpp"
+#include "xercesc/util/TranscodingException.hpp"
+#include "xercesc/util/UnexpectedEOFException.hpp"
+#include "xercesc/util/UnsupportedEncodingException.hpp"
+#include "xercesc/util/UTFDataFormatException.hpp"
+#include "xercesc/util/XMLNetAccessor.hpp"
+#include "xercesc/internal/XSerializationException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeFacetException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeValueException.hpp"
+#include "xercesc/validators/schema/identity/XPathException.hpp"
+
+XERCES_CPP_NAMESPACE_USE
+
+// we initialize the static UTF-8 transcoding info
+// these are used by the typemaps to convert between
+// Xerces internal UTF-16 and Perl's internal UTF-8
+static XMLCh* UTF8_ENCODING = NULL;
+static XMLTranscoder* UTF8_TRANSCODER = NULL;
+
+static bool DEBUG_UTF8_OUT = 0;
+static bool DEBUG_UTF8_IN = 0;
+
+%}
+
+/*
+ * Import the language specific includes
+ */
+
+#ifdef SWIGPERL
+%include "interface/Perl/defines.i"
+%include "interface/Perl/transcode.i"
+%include "interface/Perl/errors.i"
+#endif
+
+
+// These get wrapped by SWIG so that we can modify them from the scripting language
+bool DEBUG_UTF8_OUT;
+bool DEBUG_UTF8_IN;
+
+/*
+
+%{
+XMLException*
+copyXMLException(const XMLException& e)
+{
+ if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgArrayIndexOutOfBoundsException_Name)
+ {
+ return (XMLException*)((ArrayIndexOutOfBoundsException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgEmptyStackException_Name)
+ {
+ return (XMLException*)((EmptyStackException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgIllegalArgumentException_Name)
+ {
+ return (XMLException*)((IllegalArgumentException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgInvalidCastException_Name)
+ {
+ return (XMLException*)((InvalidCastException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgIOException_Name)
+ {
+ return (XMLException*)((IOException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNoSuchElementException_Name)
+ {
+ return (XMLException*)((NoSuchElementException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNullPointerException_Name)
+ {
+ return (XMLException*)((NullPointerException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNumberFormatException_Name)
+ {
+ return (XMLException*)((NumberFormatException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgParseException_Name)
+ {
+ return (XMLException*)((ParseException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgXMLPlatformUtilsException_Name)
+ {
+ return (XMLException*)((XMLPlatformUtilsException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgRuntimeException_Name)
+ {
+ return (XMLException*)((RuntimeException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgSchemaDateTimeException_Name)
+ {
+ return (XMLException*)((SchemaDateTimeException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgTranscodingException_Name)
+ {
+ return (XMLException*)((TranscodingException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgUnexpectedEOFException_Name)
+ {
+ return (XMLException*)((UnexpectedEOFException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgUnsupportedEncodingException_Name)
+ {
+ return (XMLException*)((UnsupportedEncodingException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgUTFDataFormatException_Name)
+ {
+ return (XMLException*)((UTFDataFormatException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgNetAccessorException_Name)
+ {
+ return (XMLException*)((NetAccessorException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgMalformedURLException_Name)
+ {
+ return (XMLException*)((MalformedURLException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgXSerializationException_Name)
+ {
+ return (XMLException*)((XSerializationException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgInvalidDatatypeFacetException_Name)
+ {
+ return (XMLException*)((InvalidDatatypeFacetException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgInvalidDatatypeValueException_Name)
+ {
+ return (XMLException*)((InvalidDatatypeValueException*)&e)->duplicate();
+ }
+ else if(e.getType() == XERCES_CPP_NAMESPACE::XMLUni::fgXPathException_Name)
+ {
+ return (XMLException*)((XPathException*)&e)->duplicate();
+ }
+ else
+ {
+ SWIG_Perl_SetErrorf("Unknown Exception type: %d", e.getType());
+ }
+}
+
+void
+makeXMLException(const XMLException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) copyXMLException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__XMLException, SWIG_SHADOW|0);
+}
+
+void
+makeDOMException(const DOMException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) new DOMException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_SHADOW|0);
+}
+
+void
+makeSAXNotRecognizedException(const SAXNotRecognizedException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) new SAXNotRecognizedException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__SAXNotRecognizedException, SWIG_SHADOW|0);
+}
+
+void
+makeSAXNotSupportedException(const SAXNotSupportedException& e){
+ SV *error = ERRSV;
+ SWIG_MakePtr(error, (void *) new SAXNotSupportedException(e), SWIGTYPE_p_XERCES_CPP_NAMESPACE__SAXNotSupportedException, SWIG_SHADOW|0);
+}
+
+%}
+
+*/ \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/common/bindings/dom/dom.i b/src/uscxml/plugins/datamodel/common/bindings/dom/dom.i
new file mode 100644
index 0000000..abe808b
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/common/bindings/dom/dom.i
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * All DOM classes and their related SWIG alterations go in this interface file
+ */
+
+/*
+ * the DOM classes gets a special exception handler
+ * 'goto fail' must be called - either explicitly, or via SWIG_croak()
+ * to ensure that any variable cleanup is done - to avoid memory leaks.
+ * By making these macros, it reduces the code size dramatically
+ */
+/*
+%{
+#define CATCH_DOM_EXCEPTION \
+ catch (const XMLException& e) \
+ { \
+ makeXMLException(e); \
+ goto fail; \
+ } \
+ catch (const DOMException& e) \
+ { \
+ makeDOMException(e); \
+ goto fail; \
+ } \
+ catch (...) \
+ { \
+ SWIG_croak("Handling Unknown exception"); \
+ goto fail; \
+ }
+%}
+
+%exception {
+ try
+ {
+ $action
+ }
+ CATCH_DOM_EXCEPTION
+}
+*/
+// Introduced in DOM Level 1
+%include "xercesc/dom/DOMException.hpp"
+%include "xercesc/dom/DOMNode.hpp"
+%include "xercesc/dom/DOMAttr.hpp"
+%include "xercesc/dom/DOMElement.hpp"
+%include "xercesc/dom/DOMEntity.hpp"
+%include "xercesc/dom/DOMDocumentType.hpp"
+%include "xercesc/dom/DOMCharacterData.hpp"
+%include "xercesc/dom/DOMComment.hpp"
+%include "xercesc/dom/DOMText.hpp"
+%include "xercesc/dom/DOMCDATASection.hpp"
+%include "xercesc/dom/DOMNodeList.hpp"
+%include "xercesc/dom/DOMNamedNodeMap.hpp"
+%include "xercesc/dom/DOMDocumentFragment.hpp"
+%include "xercesc/dom/DOMDocumentType.hpp"
+%include "xercesc/dom/DOMEntityReference.hpp"
+%include "xercesc/dom/DOMNotation.hpp"
+%include "xercesc/dom/DOMProcessingInstruction.hpp"
+
+// Introduced in DOM Level 2
+/*
+%include "xercesc/dom/DOMDocumentRange.hpp"
+%include "xercesc/dom/DOMDocumentTraversal.hpp"
+%include "xercesc/dom/DOMNodeIterator.hpp"
+%include "xercesc/dom/DOMNodeFilter.hpp"
+%include "xercesc/dom/DOMRange.hpp"
+%include "xercesc/dom/DOMRangeException.hpp"
+%include "xercesc/dom/DOMTreeWalker.hpp"
+%include "xercesc/dom/DOMDocumentTraversal.hpp"
+
+%ignore XERCES_CPP_NAMESPACE::DOMImplementation::loadDOMExceptionMsg;
+*/
+
+/*
+ * Introduced in DOM Level 3
+ */
+/*
+%include "xercesc/dom/DOMImplementationLS.hpp"
+%include "xercesc/dom/DOMImplementation.hpp"
+%include "xercesc/dom/DOMImplementationSource.hpp"
+%include "xercesc/dom/DOMImplementationRegistry.hpp"
+
+%include "xercesc/dom/DOMErrorHandler.hpp"
+%include "xercesc/dom/DOMEntityResolver.hpp"
+%include "xercesc/dom/DOMDocument.hpp"
+%include "xercesc/dom/DOMLocator.hpp"
+
+// DOMBuiler
+%include "xercesc/dom/DOMInputSource.hpp"
+%include "xercesc/framework/Wrapper4InputSource.hpp"
+%include "xercesc/framework/Wrapper4DOMInputSource.hpp"
+%include "xercesc/dom/DOMBuilder.hpp"
+
+// DOMWriter
+%import "xercesc/framework/XMLFormatter.hpp"
+%include "xercesc/framework/StdOutFormatTarget.hpp"
+%include "xercesc/framework/LocalFileFormatTarget.hpp"
+%include "xercesc/framework/MemBufFormatTarget.hpp"
+%include "xercesc/dom/DOMWriter.hpp"
+%include "xercesc/dom/DOMWriterFilter.hpp"
+*/
+
+%extend XERCES_CPP_NAMESPACE::DOMNode {
+ bool operator==(const DOMNode *other) {
+ return self->isSameNode(other);
+ }
+ bool operator!=(const DOMNode *other) {
+ return !self->isSameNode(other);
+ }
+};
+
diff --git a/src/uscxml/plugins/datamodel/common/bindings/dom/ignore.i b/src/uscxml/plugins/datamodel/common/bindings/dom/ignore.i
new file mode 100644
index 0000000..a4a6194
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/common/bindings/dom/ignore.i
@@ -0,0 +1,392 @@
+// Operators we don't want to wrap
+%ignore operator =;
+%ignore operator new;
+%ignore operator delete;
+%ignore operator <<;
+
+
+// both of these static variables cause trouble
+// the transcoding service is only useful to C++ anyway.
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgTransService;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgNetAccessor;
+
+// these are other static variables that are useless to Perl
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgUserPanicHandler;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgDefaultPanicHandler;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgMemoryManager;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgDefaulPanicHandler;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgArrayMemoryManager;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgAtomicMutex;
+
+// these are methods that are useless in Perl
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::curFilePos;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::closeFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::fileSize;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::openFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::openFileToWrite;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::openStdInHandle;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::readFileBuffer;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::writeBufferToFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::resetFile;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::getFullPath;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::getCurrentDirectory;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isAnySlash;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::removeDotSlash;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::removeDotDotSlash;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isRelative;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::weavePaths;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::getCurrentMillis;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::closeMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::lockMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::makeMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::unlockMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::loadMsgSet;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::compareAndSwap;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::atomicIncrement;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::atomicDecrement;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::recognizeNEL;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isNELRecognized;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::strictIANAEncoding;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::isStrictIANAEncoding;
+%ignore XERCES_CPP_NAMESPACE::XMLPlatformUtils::alignPointerForNewBlockAllocation;
+
+%ignore PerlErrorCallbackHandler::warning(const SAXParseException&);
+%ignore PerlErrorCallbackHandler::error(const SAXParseException&);
+%ignore PerlErrorCallbackHandler::fatalError(const SAXParseException&);
+
+// ignore the char* versions of ALL constructors
+%ignore XERCES_CPP_NAMESPACE::DOMBuilder::parseURI(const char *const );
+%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const char* const,
+ const bool foo=false,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+
+%ignore XMLURL(const XMLURL&,const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore XMLURL(const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore XMLURL(const XMLCh* const, const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore URLInputSource(const XMLCh* const, const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore URLInputSource(const XMLCh* const, const char* const, const char* const,
+ MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
+%ignore XMLFormatter(
+ const char* const outEncoding
+ , const char* const docVersion
+ , XMLFormatTarget* const target
+ , const EscapeFlags escapeFlags = NoEscapes
+ , const UnRepFlags unrepFlags = UnRep_Fail
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+%ignore XMLFormatter(
+ const char* const outEncoding
+ , XMLFormatTarget* const target
+ , const EscapeFlags escapeFlags = NoEscapes
+ , const UnRepFlags unrepFlags = UnRep_Fail
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+%ignore XERCES_CPP_NAMESPACE::AttributeList::getValue(const char* const) const;
+%ignore setExternalSchemaLocation(const char* const);
+%ignore setExternalNoNamespaceSchemaLocation(const char* const);
+
+/*
+ * Ignore these char* methods for all Parsers
+ */
+%ignore loadGrammar(const char* const systemId,
+ const short grammarType,
+ const bool toCache = false);
+
+
+%ignore parse(const char* const);
+%ignore parseFirst(const char *const,XMLPScanToken&,const bool);
+
+/*
+ * We need these constructors to always adopt the input strings
+ * unfortunately, the default is set to FALSE, so we must ignore
+ * all constructors that use the default, and explicitly set it
+ * in a typemap. While we are at it, we also ignore the constructor
+ * that sets the MemoryManager
+ */
+%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const XMLCh* const);
+%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const XMLCh* const,
+ const bool, MemoryManager *const);
+%ignore Wrapper4InputSource(InputSource* const);
+%ignore Wrapper4InputSource(InputSource* const, const bool adoptFlag
+ , MemoryManager* const);
+%ignore Wrapper4DOMInputSource(
+ DOMInputSource* const inputSource
+ , const bool
+ , MemoryManager* const);
+%ignore Wrapper4DOMInputSource(
+ DOMInputSource* const inputSource);
+
+// These are odd cases. We want access to skip the method with the
+// memory manager argument, but we want access to the optional argument
+// *after* the memory manager. So we just ignore the method that doesn't
+// include the memory manager - since our typemap defaults that argument
+// they are redundant
+%ignore createDOMBuilder(short const,const XMLCh* const);
+%ignore SAXParser(XMLValidator* const);
+%ignore createXMLReader();
+
+/*
+ * ignore the constructors which set the MemoryManager
+ */
+%ignore createDocument(const XMLCh *,const XMLCh *,DOMDocumentType *,MemoryManager *const);
+%ignore createDocument(MemoryManager *const);
+%ignore createDOMWriter(MemoryManager *const);
+%ignore XMLFormatter(
+ const XMLCh* const
+ , const XMLCh* const
+ , XMLFormatTarget* const
+ , const EscapeFlags
+ , const UnRepFlags
+ , MemoryManager* const);
+%ignore XMLFormatter(
+ const XMLCh* const
+ , XMLFormatTarget* const
+ , const EscapeFlags
+ , const UnRepFlags
+ , MemoryManager* const);
+%ignore LocalFileFormatTarget(const XMLCh* const, MemoryManager* const);
+%ignore LocalFileFormatTarget(const char* const,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+%ignore MemBufFormatTarget(int, MemoryManager* const);
+%ignore XercesDOMParser(XMLValidator* const, MemoryManager* const);
+%ignore URLInputSource(const XMLURL&, MemoryManager *const);
+%ignore URLInputSource(const XMLCh* const, MemoryManager *const);
+%ignore URLInputSource(const XMLCh* const, const XMLCh* const,MemoryManager *const);
+%ignore URLInputSource(const XMLCh* const, const XMLCh* const, const XMLCh* const,MemoryManager *const);
+%ignore StdInInputSource(MemoryManager* const);
+%ignore LocalFileInputSource(const XMLCh* const,MemoryManager* const);
+%ignore LocalFileInputSource(const XMLCh* const,const XMLCh* const,MemoryManager* const);
+%ignore XMLUri(MemoryManager* const);
+%ignore XMLUri(const XMLCh* const,MemoryManager* const);
+%ignore XMLUri(const XMLUri* const,const XMLCh* const,MemoryManager* const);
+%ignore XMLURL(MemoryManager* const);
+%ignore XMLURL(const XMLCh* const,MemoryManager* const);
+%ignore XMLURL(const XMLCh* const,const XMLCh* const,MemoryManager* const);
+%ignore XMLNotationDecl(MemoryManager* const);
+%ignore XMLNotationDecl(
+ const XMLCh* const
+ , const XMLCh* const
+ , const XMLCh* const
+ , const XMLCh* const
+ , MemoryManager* const
+ );
+%ignore getAttTypeString(const AttTypes
+ , MemoryManager* const);
+%ignore getDefAttTypeString(const DefAttTypes
+ , MemoryManager* const);
+
+%ignore DTDGrammar(MemoryManager *const);
+%ignore SchemaValidator(XMLErrorReporter *const,MemoryManager *const);
+%ignore SchemaGrammar(MemoryManager *const);
+%ignore QName(MemoryManager* const);
+%ignore QName
+ (
+ const XMLCh* const prefix
+ , const XMLCh* const localPart
+ , const unsigned int uriId
+ , MemoryManager* const
+ );
+%ignore QName
+ (
+ const XMLCh* const rawName
+ , const unsigned int uriId
+ , MemoryManager* const
+ );
+
+
+// changing the locale and the NLS home is probably useful
+// but changing the panic manager and memory manager is not
+%ignore Initialize(const char* const
+ , const char* const
+ , PanicHandler* const
+ , MemoryManager* const);
+%ignore Initialize(const char* const
+ , const char* const
+ , PanicHandler* const);
+
+// this constructor has a single XMLCh that interfers with another bool constructor
+%ignore DTDEntityDecl(
+ const XMLCh* const
+ , const XMLCh
+ , const bool fromIntSubset = false
+ , const bool specialChar = false);
+
+/*
+ * Perl won't need to create exceptions
+ */
+
+%ignore DOMException();
+%ignore DOMException(
+ short code
+ , const XMLCh* message
+ , MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager
+ );
+
+%ignore DOMException(const DOMException &other);
+
+%ignore DOMRangeException();
+%ignore DOMRangeException(
+ RangeExceptionCode code
+ , const XMLCh* message
+ , MemoryManager* const memoryManager
+ );
+%ignore DOMRangeException(const DOMRangeException &other);
+
+%ignore SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXException(const XMLCh* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXException(const char* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXException(const SAXException& toCopy) ;
+
+%ignore SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotSupportedException(const XMLCh* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotSupportedException(const char* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+
+%ignore SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotRecognizedException(const XMLCh* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+%ignore SAXNotRecognizedException(const char* const msg,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) ;
+
+%ignore SAXParseException(const XMLCh* const message, const Locator& locator,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+%ignore SAXParseException
+ (
+ const XMLCh* const message
+ , const XMLCh* const publicId
+ , const XMLCh* const systemId
+ , const XMLSSize_t lineNumber
+ , const XMLSSize_t columnNumber
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+%ignore SAXParseException(const SAXParseException& toCopy);
+
+/*
+ * methods not needed by the XMLValidator interfaces
+ */
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::emitError;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::checkRootElement;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::reinitMsgMutex;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::reinitMsgLoader;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::setErrorReporter;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::setScannerInfo;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::handlesSchema;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::handlesDTD;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::validateElement;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::validateAttrValue;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::requiresNamespaces;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::reset;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::postParseValidation;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::preContentValidation;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::faultInAttr;
+%ignore XERCES_CPP_NAMESPACE::XMLValidator::checkContent;
+
+// ignore all the constructors for the Grammar components
+%ignore XERCES_CPP_NAMESPACE::DTDAttDef::DTDAttDef;
+%ignore XERCES_CPP_NAMESPACE::DTDElementDecl::DTDElementDecl;
+%ignore XERCES_CPP_NAMESPACE::DTDEntityDecl::DTDEntityDecl;
+%ignore XERCES_CPP_NAMESPACE::SchemaElementDecl::SchemaElementDecl;
+%ignore XERCES_CPP_NAMESPACE::SchemaAttDef::SchemaAttDef;
+%ignore XERCES_CPP_NAMESPACE::DTDAttDefList::DTDAttDefList;
+%ignore XERCES_CPP_NAMESPACE::SchemaAttDefList::SchemaAttDefList;
+
+// desperate attempt to get this working
+// FIXME
+%ignore SchemaAttDefList
+ (
+ RefHash2KeysTableOf<SchemaAttDef>* const listToUse,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+%ignore DTDAttDefList
+ (
+ RefHashTableOf<DTDAttDef>* const listToUse,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+/*
+ * methods not needed by the public Parser interfaces
+ *
+ * this is probably because I'm not using AdvDocHandlers and things
+ * that want to control the parsing process, but until someone asks
+ * for them, I'm going to leave them out.
+ */
+
+// XMLEntityHandler interface
+%ignore endInputSource;
+%ignore expandSystemId;
+%ignore resetEntities;
+%ignore resolveEntity;
+%ignore startInputSource;
+
+// XMLDocumentHandler interface.
+%ignore docCharacters;
+%ignore docComment;
+%ignore docPI;
+%ignore endDocument;
+%ignore endElement;
+%ignore endEntityReference;
+%ignore ignorableWhitespace;
+%ignore resetDocument;
+%ignore startDocument;
+%ignore startElement;
+%ignore startEntityReference;
+%ignore XMLDecl;
+
+// depricated methods - don't ask me to include these
+%ignore getDoValidation;
+%ignore setDoValidation;
+%ignore attDef;
+%ignore doctypeComment;
+%ignore doctypeDecl;
+%ignore doctypePI;
+%ignore doctypeWhitespace;
+%ignore elementDecl;
+%ignore endAttList;
+%ignore endIntSubset;
+%ignore endExtSubset;
+%ignore entityDecl;
+%ignore resetDocType;
+%ignore notationDecl;
+%ignore startAttList;
+%ignore startIntSubset;
+%ignore startExtSubset;
+%ignore TextDecl;
+
+// const methods
+%ignore getDocumentHandler() const;
+%ignore getErrorHandler() const;
+%ignore getEntityResolver() const;
+%ignore getXMLEntityResolver() const;
+%ignore getPSVIHandler() const;
+
+%ignore getContentSpec() const;
+%ignore getBaseName() const;
+%ignore getElementName() const;
+%ignore findAttDef(unsigned long const,XMLCh const *const) const;
+%ignore findAttDef(XMLCh const *const,XMLCh const *const) const;
+%ignore getAttDef(unsigned int) const;
+%ignore getAttDef(XMLCh const *const) const;
+%ignore getAttDef(XMLCh const *const,int const) const;
+%ignore getElemDecl(unsigned int const) const;
+%ignore getElemDecl(unsigned int const,XMLCh const *const,XMLCh const *const,unsigned int) const;
+%ignore getNotationDecl(XMLCh const *const) const;
+%ignore getEntityDecl(XMLCh const *const) const;
+%ignore getEntityDeclPool() const;
+%ignore getAttWildCard() const;
+%ignore getAnnotation() const;
+%ignore getAnnotation(void const *const) const;
+%ignore getAnnotations() const;
+%ignore findAttDefLocalPart(unsigned long const,XMLCh const *const) const;
+%ignore getBaseAttDecl() const;
+%ignore getFilter() const;
+%ignore getPrefix() const;
+%ignore getLocalPart() const;
+%ignore getRawName() const;
diff --git a/src/uscxml/plugins/datamodel/common/bindings/dom/typemaps-general.i b/src/uscxml/plugins/datamodel/common/bindings/dom/typemaps-general.i
new file mode 100644
index 0000000..d82e508
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/common/bindings/dom/typemaps-general.i
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * Scripting languages are not going to change the default memory manager
+ * so we always default this argument
+ */
+/*%typemap(in,numinputs=0) XERCES_CPP_NAMESPACE::MemoryManager* const manager "$1 = XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgMemoryManager;"*/
+
+/*
+ * MemBufInputSource::MemBufInputSource()
+ *
+ * ALWAYS ADOPT BUFFER (I.E. MAKE A COPY OF IT) SINCE IT IS TAKEN FROM
+ * THE SCRIPTING LANGUAGE, AND WHO KNOWS WHAT WILL HAPPEN TO IT AFTER
+ * IT IS GIVEN TO THE
+ * CONSTRUCTOR
+ */
+
+// %typemap(in,numinputs=0) (unsigned int byteCount) "$1 = 0;"
+
+/*
+ * These arguments are used to indicate that Xerces-C should
+ * adopt a resource being passed as an argument. We should
+ * *always* tell Xerces-C to adopt.
+ */
+/*%typemap(in,numinputs=0) const bool adoptFlag "$1 = true;" // for Wrapper4InputSource
+ // and Wrapper4DOMInputSource
+%typemap(in,numinputs=0) const bool adoptBuffer "$1 = true;" // for MemBufInputSource
+*/
+// SAX2XMLReader::setProperty() should refuse the option to set the
+// security manager
+
+/*%extend XERCES_CPP_NAMESPACE::SAX2XMLReader {
+%typemap(check) (const XMLCh* const name, void* value) {
+ if (XMLString::compareIStringASCII($1, XMLUni::fgXercesSecurityManager) == 0) {
+ makeSAXNotSupportedException(SAXNotSupportedException("Setting security manager not supported"));
+ goto fail;
+ }
+}
+}
+*/
+/*
+ * Enable conversion of void* => XMLCh* in setProperty()
+ *
+ * The in typemap converts the void* to an XMLCh*
+ *
+ * The freearg typemap deletes the transcoded string
+ *
+ */
+/*%typemap(in) (void* value) {
+ // now check the value
+ if ($input == &PL_sv_undef) {
+ SWIG_Perl_NullRef("perl-string",$argnum,"$symname");
+ goto fail;
+ } else {
+ // we convert *everything* into a string that isn't undef
+ $1 = Perl2XMLString($input);
+ }
+}
+
+%typemap(freearg) void * %{
+ delete[] $1;
+%}
+*/
+/*
+ * Dynamic Casts
+ *
+ * This very cool SWIG feature enables use to return the correct object
+ * type to Perl when a C++ method is defined as returning a base class
+ * object. We define a method that tells what type subclass the object
+ * is in.
+ */
+
+/*
+ * Grammar*
+ */
+
+/*%typemap(out) XERCES_CPP_NAMESPACE::Grammar * = SWIGTYPE *DYNAMIC;
+
+DYNAMIC_CAST(SWIGTYPE_p_XERCES_CPP_NAMESPACE__Grammar, Grammar_dynamic_cast);
+
+%{
+static swig_type_info *
+Grammar_dynamic_cast(void **ptr) {
+ Grammar **nptr = (Grammar **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getGrammarType();
+ if (type == Grammar::DTDGrammarType) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DTDGrammar;
+ }
+ if (type == Grammar::SchemaGrammarType) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__SchemaGrammar;
+ }
+ return NULL;
+}
+%}
+*/
+
+/*
+ * DOM_Node*
+ */
+
+%typemap(out) XERCES_CPP_NAMESPACE::DOMNode * = SWIGTYPE *DYNAMIC;
+
+DYNAMIC_CAST(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, DOMNode_dynamic_cast);
+
+%{
+static swig_type_info *
+DOMNode_dynamic_cast(void **ptr) {
+ DOMNode **nptr = (DOMNode **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getNodeType();
+ if (type == DOMNode::TEXT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText;
+ }
+ if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction;
+ }
+ if (type == DOMNode::DOCUMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument;
+ }
+ if (type == DOMNode::ELEMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement;
+ }
+ if (type == DOMNode::ENTITY_REFERENCE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::COMMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment;
+ }
+ if (type == DOMNode::DOCUMENT_TYPE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType;
+ }
+ if (type == DOMNode::ENTITY_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity;
+ }
+ if (type == DOMNode::ATTRIBUTE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr;
+ }
+ if (type == DOMNode::NOTATION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation;
+ }
+ return NULL;
+}
+%}
+
diff --git a/src/uscxml/plugins/datamodel/common/bindings/event.i b/src/uscxml/plugins/datamodel/common/bindings/event.i
new file mode 100644
index 0000000..b7ef165
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/common/bindings/event.i
@@ -0,0 +1,22 @@
+/*
+ * we will have to manage these by hand
+ */
+
+%ignore uscxml::Event::data; // too ambituous
+%ignore uscxml::Event::namelist; // not needed
+%ignore uscxml::Event::params; // not needed
+%ignore uscxml::Event::uuid; // only for internal use
+
+%ignore uscxml::Event::hideSendId; // not needed
+%ignore uscxml::Event::sendid; // supposed to be undef not empty string
+%ignore uscxml::Event::invokeid; // supposed to be undef not empty string
+
+%ignore uscxml::Event::eventtype; // not an enum but a string
+%ignore uscxml::Event::origin; // supposed to be undef not empty string
+%ignore uscxml::Event::origintype; // supposed to be undef not empty string
+
+%{
+using uscxml::Data;
+%}
+
+%include "uscxml/messages/Event.h"
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp
deleted file mode 100644
index 402152d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSCDOM::JSCDOM() {
- nsInfo = NULL;
- xpath = NULL;
- storage = NULL;
-}
-
-JSCDOM::~JSCDOM() {
- if (nsInfo)
- delete(nsInfo);
- if (xpath)
- delete(xpath);
- if (storage)
- delete(storage);
-
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp.inc b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp.inc
new file mode 100644
index 0000000..11a8863
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.cpp.inc
@@ -0,0 +1,9576 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.8
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+ struct SwigMovePointer {
+ T *ptr;
+ SwigMovePointer(T *p) : ptr(p) { }
+ ~SwigMovePointer() { delete ptr; }
+ SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+ } pointer;
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+ SwigValueWrapper() : pointer(0) { }
+ SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+ operator T&() const { return *pointer.ptr; }
+ T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+ return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * This section contains generic SWIG labels for method/variable
+ * declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+# define SWIGINLINE inline
+# else
+# define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+# elif defined(__ICC)
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+# pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+# define SWIGUNUSEDPARM(p)
+# else
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# ifndef GCC_HASCLASSVISIBILITY
+# define GCC_HASCLASSVISIBILITY
+# endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT
+# else
+# define SWIGEXPORT __declspec(dllexport)
+# endif
+# else
+# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+# define SWIGEXPORT __attribute__ ((visibility("default")))
+# else
+# define SWIGEXPORT
+# endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# define SWIGSTDCALL __stdcall
+# else
+# define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
+#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
+# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
+#endif
+
+/* Intel's compiler complains if a variable which was never initialised is
+ * cast to void, which is a common idiom which we use to indicate that we
+ * are aware a variable isn't used. So we just silence that warning.
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
+ */
+#ifdef __INTEL_COMPILER
+# pragma warning disable 592
+#endif
+
+
+#define SWIG_AsCharPtrAndSize(val, cptr, psize, alloc) SWIG_JSC_AsCharPtrAndSize(context, val, cptr, psize, alloc)
+#define SWIG_FromCharPtrAndSize(cptr, size) SWIG_JSC_FromCharPtrAndSize(context, cptr, size)
+#define SWIG_FromCharPtr(cptr) SWIG_JSC_FromCharPtr(context, cptr)
+
+
+#define SWIG_JSC_FROM_DECL_ARGS(arg1) (JSContextRef context, arg1)
+#define SWIG_JSC_FROM_CALL_ARGS(arg1) (context, arg1)
+#define SWIG_JSC_AS_DECL_ARGS(arg1, arg2) (JSContextRef context, arg1, arg2)
+#define SWIG_JSC_AS_CALL_ARGS(arg1, arg2) (context, arg1, arg2)
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+
+
+
+#include <JavaScriptCore/JavaScript.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <limits.h>
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+ or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+ creating a static or dynamic library from the SWIG runtime code.
+ In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+ But only do this if strictly necessary, ie, if you have problems
+ with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/* Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN 0x1
+
+
+/*
+ Flags/methods for returning states.
+
+ The SWIG conversion methods, as ConvertPtr, return an integer
+ that tells if the conversion was successful or not. And if not,
+ an error code can be returned (see swigerrors.swg for the codes).
+
+ Use the following macros/flags to set or process the returning
+ states.
+
+ In old versions of SWIG, code such as the following was usually written:
+
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+ // success code
+ } else {
+ //fail code
+ }
+
+ Now you can be more explicit:
+
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ } else {
+ // fail code
+ }
+
+ which is the same really, but now you can also do
+
+ Type *ptr;
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ if (SWIG_IsNewObj(res) {
+ ...
+ delete *ptr;
+ } else {
+ ...
+ }
+ } else {
+ // fail code
+ }
+
+ I.e., now SWIG_ConvertPtr can return new objects and you can
+ identify the case and take care of the deallocation. Of course that
+ also requires SWIG_ConvertPtr to return new result values, such as
+
+ int SWIG_ConvertPtr(obj, ptr,...) {
+ if (<obj is ok>) {
+ if (<need new object>) {
+ *ptr = <ptr to new allocated object>;
+ return SWIG_NEWOBJ;
+ } else {
+ *ptr = <ptr to old object>;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ return SWIG_BADOBJ;
+ }
+ }
+
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+ SWIG errors code.
+
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+ allows to return the 'cast rank', for example, if you have this
+
+ int food(double)
+ int fooi(int);
+
+ and you call
+
+ food(1) // cast rank '1' (1 -> 1.0)
+ fooi(1) // cast rank '0'
+
+ just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK (0)
+#define SWIG_ERROR (-1)
+#define SWIG_IsOK(r) (r >= 0)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ (SWIG_ERROR)
+#define SWIG_OLDOBJ (SWIG_OK)
+#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+# ifndef SWIG_TypeRank
+# define SWIG_TypeRank unsigned long
+# endif
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# define SWIG_MAXCASTRANK (2)
+# endif
+# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
+# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+# define SWIG_AddCast(r) (r)
+# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+} swig_module_info;
+
+/*
+ Compare two type names skipping the space characters, therefore
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+ Return 0 when the two name types are equivalent, as in
+ strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+ const char *f2, const char *l2) {
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+ }
+ return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+ int equiv = 1;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (equiv != 0 && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
+ }
+ equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+ if (*ne) ++ne;
+ }
+ return equiv;
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+ return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+ Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+ if (ty) {
+ swig_cast_info *iter = ty->cast;
+ while (iter) {
+ if (strcmp(iter->type->name, c) == 0) {
+ if (iter == ty->cast)
+ return iter;
+ /* Move iter to the top of the linked list */
+ iter->prev->next = iter->next;
+ if (iter->next)
+ iter->next->prev = iter->prev;
+ iter->next = ty->cast;
+ iter->prev = 0;
+ if (ty->cast) ty->cast->prev = iter;
+ ty->cast = iter;
+ return iter;
+ }
+ iter = iter->next;
+ }
+ }
+ return 0;
+}
+
+/*
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+ if (ty) {
+ swig_cast_info *iter = ty->cast;
+ while (iter) {
+ if (iter->type == from) {
+ if (iter == ty->cast)
+ return iter;
+ /* Move iter to the top of the linked list */
+ iter->prev->next = iter->next;
+ if (iter->next)
+ iter->next->prev = iter->prev;
+ iter->next = ty->cast;
+ iter->prev = 0;
+ if (ty->cast) ty->cast->prev = iter;
+ ty->cast = iter;
+ return iter;
+ }
+ iter = iter->next;
+ }
+ }
+ return 0;
+}
+
+/*
+ Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+ Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast) return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast)(ptr);
+ if (ty) lastty = ty;
+ }
+ return lastty;
+}
+
+/*
+ Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
+
+/*
+ Return the pretty name associated with this type,
+ that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type) return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|') last_name = s+1;
+ return last_name;
+ }
+ else
+ return type->name;
+}
+
+/*
+ Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+}
+
+/*
+ Search for a swig_type_info structure only by mangled name
+ Search is a O(log #types)
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ size_t l = 0;
+ size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
+}
+
+/*
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
+ It first searches the mangled names of the types, which is a O(log #types)
+ If a type is not found it then searches the human readable names, which is O(#types).
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+}
+
+/*
+ Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
+
+/*
+ Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ char d = *(c++);
+ unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+}
+
+/*
+ Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+ strcpy(r,name);
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2*sz + 2 + lname) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ if (lname) {
+ strncpy(r,name,lname+1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ memset(ptr,0,sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Errors in SWIG */
+#define SWIG_UnknownError -1
+#define SWIG_IOError -2
+#define SWIG_RuntimeError -3
+#define SWIG_IndexError -4
+#define SWIG_TypeError -5
+#define SWIG_DivisionByZero -6
+#define SWIG_OverflowError -7
+#define SWIG_SyntaxError -8
+#define SWIG_ValueError -9
+#define SWIG_SystemError -10
+#define SWIG_AttributeError -11
+#define SWIG_MemoryError -12
+#define SWIG_NullReferenceError -13
+
+
+
+/* ----------------------------------------------------------------------------
+ * Errors and exceptions
+ *
+ * ---------------------------------------------------------------------------*/
+
+#define SWIG_Error(code, msg) SWIG_JSC_exception(context, exception, code, msg)
+#define SWIG_exception(code, msg) SWIG_JSC_exception(context, exception, code, msg)
+#define SWIG_fail goto fail
+
+SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
+ JSStringRef message = JSStringCreateWithUTF8CString(type);
+ JSValueRef error_arguments[1];
+ JSObjectRef exception_object;
+ JSValueRef exception_value;
+ exception_value = JSValueMakeString(context, message);
+ /* Converting the result to an object will let JavascriptCore add
+ "sourceURL" (file) and "line" (number) and "message" to the exception,
+ instead of just returning a raw string. This is extremely important for debugging your errors.
+ Using JSObjectMakeError is better than JSValueToObject because the latter only populates
+ "sourceURL" and "line", but not "message" or any others I don't know about.
+ */
+ error_arguments[0] = exception_value;
+ exception_object = JSObjectMakeError(context, 1, error_arguments, NULL);
+
+ /* Return the exception_object */
+ *exception = exception_object;
+
+ JSStringRelease(message);
+}
+
+SWIGRUNTIME void SWIG_JSC_exception(JSContextRef context, JSValueRef *exception, int code, const char* msg) {
+ SWIG_Javascript_Raise(context, exception, msg);
+}
+
+/* ----------------------------------------------------------------------------
+ * The parent class of all Proxies
+ *
+ * ---------------------------------------------------------------------------*/
+
+typedef struct {
+ bool swigCMemOwn;
+ void *swigCObject;
+ swig_type_info *info;
+} SwigPrivData;
+
+SWIGRUNTIME JSValueRef _wrap_SwigObject_disown(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ JSObjectRef obj = JSValueToObject(context, thisObject, NULL);
+ SwigPrivData *cdata = (SwigPrivData *) JSObjectGetPrivate(obj);
+
+ cdata->swigCMemOwn = false;
+
+ jsresult = JSValueMakeUndefined(context);
+ return jsresult;
+}
+
+SWIGRUNTIME JSValueRef _wrap_SwigObject_getCPtr(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSValueRef jsresult;
+ long result;
+
+ JSObjectRef obj = JSValueToObject(context, thisObject, NULL);
+ SwigPrivData *cdata = (SwigPrivData*) JSObjectGetPrivate(obj);
+
+ result = (long) cdata->swigCObject;
+ jsresult = JSValueMakeNumber(context, result);
+
+ return jsresult;
+}
+
+SWIGRUNTIME JSValueRef _wrap_SwigObject_equals(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSValueRef jsresult;
+ bool result;
+
+ JSObjectRef obj = JSValueToObject(context, thisObject, NULL);
+ SwigPrivData *cdata = (SwigPrivData*) JSObjectGetPrivate(obj);
+
+ JSObjectRef obj2 = JSValueToObject(context, argv[0], NULL);
+ SwigPrivData *cdata2 = (SwigPrivData*) JSObjectGetPrivate(obj2);
+
+ result = (cdata->swigCObject == cdata2->swigCObject);
+ jsresult = JSValueMakeBoolean(context, result);
+
+ return jsresult;
+}
+
+SWIGRUNTIME JSStaticValue _SwigObject_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+SWIGRUNTIME JSStaticFunction _SwigObject_functions[] = {
+ {
+ "disown",_wrap_SwigObject_disown, kJSPropertyAttributeNone
+ },
+ {
+ "equals",_wrap_SwigObject_equals, kJSPropertyAttributeNone
+ },
+ {
+ "getCPtr",_wrap_SwigObject_getCPtr, kJSPropertyAttributeNone
+ },
+ {
+ 0, 0, 0
+ }
+};
+
+SWIGRUNTIME JSClassDefinition _SwigObject_objectDefinition;
+
+SWIGRUNTIME JSClassRef _SwigObject_classRef;
+
+
+SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef objRef, void** ptr, swig_type_info *info, int flags) {
+ SwigPrivData *cdata;
+
+ cdata = (SwigPrivData *) JSObjectGetPrivate(objRef);
+ if(cdata == NULL) {
+ return SWIG_ERROR;
+ }
+ if(cdata->info != info) {
+ bool type_valid = false;
+ swig_cast_info *t = info->cast;
+ while(t != NULL) {
+ if(t->type == cdata->info) {
+ type_valid = true;
+ break;
+ }
+ t = t->next;
+ }
+ if(!type_valid) {
+ return SWIG_TypeError;
+ }
+ }
+
+ *ptr = cdata->swigCObject;
+
+ if(flags & SWIG_POINTER_DISOWN) {
+ cdata->swigCMemOwn = false;
+ }
+
+ return SWIG_OK;
+}
+
+SWIGRUNTIME int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, void** ptr, swig_type_info *info, int flags) {
+ JSObjectRef objRef;
+
+ /* special case: JavaScript null => C NULL pointer */
+ if(JSValueIsNull(context, valRef)) {
+ *ptr=0;
+ return SWIG_OK;
+ }
+
+ if(!JSValueIsObject(context, valRef)) {
+ return SWIG_TypeError;
+ }
+
+ objRef = JSValueToObject(context, valRef, NULL);
+ if(objRef == NULL) {
+ return SWIG_ERROR;
+ }
+
+ return SWIG_JSC_ConvertInstancePtr(context, objRef, ptr, info, flags);
+}
+
+SWIGRUNTIME JSObjectRef SWIG_JSC_NewPointerObj(JSContextRef context, void *ptr, swig_type_info *info, int flags) {
+ JSClassRef classRef;
+ JSObjectRef result;
+ SwigPrivData *cdata;
+
+ if (ptr == NULL) {
+ // HACK: it is not possible to use JSValueToObject (causing seg-fault)
+ // This static cast turned out to be a workaround
+ // In future, we should change the interface of this method
+ // to return JSValueRef instead of JSObjectRef.
+ return (JSObjectRef) JSValueMakeNull(context);
+ }
+
+ if(info->clientdata == NULL) {
+ classRef = _SwigObject_classRef;
+ } else {
+ classRef = (JSClassRef) info->clientdata;
+ }
+
+ result = JSObjectMake(context, classRef, NULL);
+
+ cdata = (SwigPrivData*) malloc(sizeof(SwigPrivData));
+ cdata->swigCObject = ptr;
+ cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
+ cdata->info = info;
+
+ JSObjectSetPrivate(result, cdata);
+
+ return result;
+}
+
+#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_JSC_ConvertPtr(context, obj, ptr, info, flags)
+#define SWIG_NewPointerObj(ptr, info, flags) SWIG_JSC_NewPointerObj(context, ptr, info, flags)
+
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_JSC_ConvertInstancePtr(context, obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_JSC_NewPointerObj(context, thisvalue, type, flags)
+
+#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_JSC_ConvertPtr(context, obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_JSC_NewPointerObj(context, ptr, type, 0)
+
+/* ----------------------------------------------------------------------------
+ * A class for packed data
+ *
+ * ---------------------------------------------------------------------------*/
+
+typedef struct {
+ void *data;
+ size_t size;
+ swig_type_info *type;
+} SwigPackedData;
+
+SWIGRUNTIME JSStaticValue _SwigPackedData_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+SWIGRUNTIME JSStaticFunction _SwigPackedData_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+SWIGRUNTIME JSClassDefinition _SwigPackedData_objectDefinition;
+SWIGRUNTIME JSClassRef _SwigPackedData_classRef;
+
+SWIGRUNTIMEINLINE
+int SwigJSCPacked_Check(JSContextRef context, JSValueRef valRef) {
+ return JSValueIsObjectOfClass(context, valRef, _SwigPackedData_classRef);
+}
+
+SWIGRUNTIME
+swig_type_info* SwigJSCPacked_UnpackData(JSContextRef context, JSValueRef valRef, void *ptr, size_t size) {
+ if (SwigJSCPacked_Check(context, valRef)) {
+ JSObjectRef objRef = JSValueToObject(context, valRef, NULL);
+ SwigPackedData *sobj = (SwigPackedData *) JSObjectGetPrivate(objRef);
+ if (sobj->size != size) return 0;
+ memcpy(ptr, sobj->data, size);
+ return sobj->type;
+ } else {
+ return 0;
+ }
+}
+
+SWIGRUNTIME
+int SWIG_JSC_ConvertPacked(JSContextRef context, JSValueRef valRef, void *ptr, size_t sz, swig_type_info *ty) {
+ swig_type_info *to = SwigJSCPacked_UnpackData(context, valRef, ptr, sz);
+ if (!to) return SWIG_ERROR;
+ if (ty) {
+ if (to != ty) {
+ /* check type cast? */
+ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+ if (!tc) return SWIG_ERROR;
+ }
+ }
+ return SWIG_OK;
+}
+
+SWIGRUNTIME
+JSValueRef SWIG_JSC_NewPackedObj(JSContextRef context, void *data, size_t size, swig_type_info *type) {
+
+ JSClassRef classRef = _SwigObject_classRef;
+ JSObjectRef result = JSObjectMake(context, classRef, NULL);
+
+ SwigPackedData* cdata = (SwigPackedData*) malloc(sizeof(SwigPackedData));
+ cdata->data = data;
+ cdata->size = size;
+ cdata->type = type;
+
+ JSObjectSetPrivate(result, cdata);
+
+ return result;
+}
+
+/* SwigPackedData wrappers */
+SWIGRUNTIME
+void _wrap_SwigPackedData_delete(JSObjectRef obj)
+{
+ SwigPackedData* cdata = (SwigPackedData*) JSObjectGetPrivate(obj);
+ if (cdata) {
+ free(cdata->data);
+ }
+}
+
+/* for C++ member pointers, ie, member methods */
+
+#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_JSC_ConvertPacked(context, obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type) SWIG_JSC_NewPackedObj(context, ptr, sz, type)
+
+
+/* ---------------------------------------------------------------------------
+ * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg)
+ *
+ * ---------------------------------------------------------------------------*/
+SWIGRUNTIME
+unsigned int SWIGJSC_ArrayLength(JSContextRef context, JSObjectRef arr) {
+ static JSStringRef LENGTH = 0;
+ JSValueRef exception = NULL;
+ JSValueRef js_length;
+ double length;
+
+ if (LENGTH == 0) {
+ LENGTH = JSStringCreateWithUTF8CString("length");
+ }
+
+ js_length = JSObjectGetProperty(context, arr, LENGTH, &exception);
+ if (exception == 0 && JSValueIsNumber(context, js_length)) {
+ length = JSValueToNumber(context, js_length, 0);
+ return (unsigned int) length;
+ } else {
+ return 0;
+ }
+}
+
+SWIGRUNTIME
+JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueRef obj) {
+ JSObjectRef arr;
+ unsigned int length;
+
+ if (JSValueIsUndefined(context, value)) {
+ arr = JSObjectMakeArray(context, 0, 0, 0);
+ } else {
+ arr = JSValueToObject(context, value, 0);
+ }
+
+ length = SWIGJSC_ArrayLength(context, arr);
+ JSObjectSetPropertyAtIndex(context, arr, length, obj, 0);
+ return arr;
+}
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_Data swig_types[0]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr swig_types[1]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection swig_types[2]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData swig_types[3]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment swig_types[4]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument swig_types[5]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment swig_types[6]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType swig_types[7]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement swig_types[8]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity swig_types[9]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference swig_types[10]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException swig_types[11]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap swig_types[12]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode swig_types[13]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList swig_types[14]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation swig_types[15]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction swig_types[16]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText swig_types[17]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo swig_types[18]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler swig_types[19]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager swig_types[20]
+#define SWIGTYPE_p_bool swig_types[21]
+#define SWIGTYPE_p_char swig_types[22]
+#define SWIGTYPE_p_int16_t swig_types[23]
+#define SWIGTYPE_p_int32_t swig_types[24]
+#define SWIGTYPE_p_int64_t swig_types[25]
+#define SWIGTYPE_p_namelist_t swig_types[26]
+#define SWIGTYPE_p_params_t swig_types[27]
+#define SWIGTYPE_p_size_t swig_types[28]
+#define SWIGTYPE_p_ssize_t swig_types[29]
+#define SWIGTYPE_p_std__listT_Data_t swig_types[30]
+#define SWIGTYPE_p_std__multimapT_std__string_Data_t swig_types[31]
+#define SWIGTYPE_p_uint16_t swig_types[32]
+#define SWIGTYPE_p_uint32_t swig_types[33]
+#define SWIGTYPE_p_uint64_t swig_types[34]
+#define SWIGTYPE_p_unsigned_char swig_types[35]
+#define SWIGTYPE_p_uscxml__ErrorEvent swig_types[36]
+#define SWIGTYPE_p_uscxml__Event swig_types[37]
+#define SWIGTYPE_p_void swig_types[38]
+static swig_type_info *swig_types[40];
+static swig_module_info swig_module = {swig_types, 39, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+
+
+#define SWIGVERSION 0x030008
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
+
+
+#include <stdexcept>
+
+
+SWIGINTERNINLINE JSValueRef
+ SWIG_From_int SWIG_JSC_FROM_DECL_ARGS(int value)
+{
+ return JSValueMakeNumber(context, value);
+}
+
+
+#include <string>
+
+
+#include "xercesc/sax/InputSource.hpp"
+#include "xercesc/sax/SAXException.hpp"
+#include "xercesc/sax/SAXParseException.hpp"
+#include "xercesc/sax/Locator.hpp"
+#include "xercesc/sax/HandlerBase.hpp"
+#include "xercesc/sax2/Attributes.hpp"
+#include "xercesc/sax2/ContentHandler.hpp"
+#include "xercesc/sax2/LexicalHandler.hpp"
+#include "xercesc/sax2/DefaultHandler.hpp"
+#include "xercesc/sax2/SAX2XMLReader.hpp"
+#include "xercesc/sax2/XMLReaderFactory.hpp"
+#include "xercesc/util/PlatformUtils.hpp"
+#include "xercesc/util/TransService.hpp"
+#include "xercesc/util/XMLString.hpp"
+#include "xercesc/util/XMLUri.hpp"
+#include "xercesc/util/QName.hpp"
+#include "xercesc/util/HexBin.hpp"
+#include "xercesc/util/Base64.hpp"
+#include "xercesc/parsers/AbstractDOMParser.hpp"
+#include "xercesc/parsers/XercesDOMParser.hpp"
+#include "xercesc/parsers/SAXParser.hpp"
+#include "xercesc/dom/DOM.hpp"
+#include "xercesc/framework/LocalFileInputSource.hpp"
+#include "xercesc/framework/MemBufInputSource.hpp"
+#include "xercesc/framework/StdInInputSource.hpp"
+#include "xercesc/framework/URLInputSource.hpp"
+#include "xercesc/framework/XMLGrammarDescription.hpp"
+#include "xercesc/framework/XMLDTDDescription.hpp"
+#include "xercesc/framework/XMLSchemaDescription.hpp"
+#include "xercesc/util/NameIdPool.hpp"
+#include "xercesc/util/XMLEnumerator.hpp"
+#include "xercesc/framework/XMLValidator.hpp"
+#include "xercesc/validators/common/Grammar.hpp"
+#include "xercesc/validators/DTD/DTDAttDef.hpp"
+#include "xercesc/validators/DTD/DTDAttDefList.hpp"
+#include "xercesc/validators/DTD/DTDGrammar.hpp"
+#include "xercesc/validators/DTD/DTDValidator.hpp"
+#include "xercesc/validators/schema/SchemaGrammar.hpp"
+#include "xercesc/validators/schema/SchemaValidator.hpp"
+#include "xercesc/validators/schema/SchemaAttDefList.hpp"
+#include "xercesc/validators/schema/SchemaAttDef.hpp"
+#include "xercesc/framework/XMLFormatter.hpp"
+#include "xercesc/framework/MemBufFormatTarget.hpp"
+#include "xercesc/framework/LocalFileFormatTarget.hpp"
+#include "xercesc/framework/StdOutFormatTarget.hpp"
+#include "xercesc/framework/Wrapper4InputSource.hpp"
+#include "xercesc/framework/psvi/PSVIHandler.hpp"
+
+// for resolving XMLExceptions
+#include "xercesc/util/ArrayIndexOutOfBoundsException.hpp"
+#include "xercesc/util/EmptyStackException.hpp"
+#include "xercesc/util/IllegalArgumentException.hpp"
+#include "xercesc/util/InvalidCastException.hpp"
+#include "xercesc/util/IOException.hpp"
+#include "xercesc/util/NoSuchElementException.hpp"
+#include "xercesc/util/NullPointerException.hpp"
+#include "xercesc/util/NumberFormatException.hpp"
+#include "xercesc/util/ParseException.hpp"
+#include "xercesc/util/RuntimeException.hpp"
+#include "xercesc/util/SchemaDateTimeException.hpp"
+#include "xercesc/util/TranscodingException.hpp"
+#include "xercesc/util/UnexpectedEOFException.hpp"
+#include "xercesc/util/UnsupportedEncodingException.hpp"
+#include "xercesc/util/UTFDataFormatException.hpp"
+#include "xercesc/util/XMLNetAccessor.hpp"
+#include "xercesc/internal/XSerializationException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeFacetException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeValueException.hpp"
+#include "xercesc/validators/schema/identity/XPathException.hpp"
+
+XERCES_CPP_NAMESPACE_USE
+
+// we initialize the static UTF-8 transcoding info
+// these are used by the typemaps to convert between
+// Xerces internal UTF-16 and Perl's internal UTF-8
+static XMLCh* UTF8_ENCODING = NULL;
+static XMLTranscoder* UTF8_TRANSCODER = NULL;
+
+static bool DEBUG_UTF8_OUT = 0;
+static bool DEBUG_UTF8_IN = 0;
+
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, double *val)
+{
+ if(!JSValueIsNumber(context, obj)) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = JSValueToNumber(context, obj, NULL);
+
+ return SWIG_OK;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+ double x = *d;
+ if ((min <= x && x <= max)) {
+ double fx = floor(x);
+ double cx = ceil(x);
+ double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+ if ((errno == EDOM) || (errno == ERANGE)) {
+ errno = 0;
+ } else {
+ double summ, reps, diff;
+ if (rd < x) {
+ diff = x - rd;
+ } else if (rd > x) {
+ diff = rd - x;
+ } else {
+ return 1;
+ }
+ summ = rd + x;
+ reps = diff/summ;
+ if (reps < 8*DBL_EPSILON) {
+ *d = rd;
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, long* val)
+{
+ if (!JSValueIsNumber(context, obj)) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = (long) JSValueToNumber(context, obj, NULL);
+
+ return SWIG_OK;
+}
+
+
+SWIGINTERN
+int SWIG_AsVal_bool SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, bool *val)
+{
+ if(!JSValueIsBoolean(context, obj)) {
+ return SWIG_ERROR;
+ }
+ if (val) *val = JSValueToBoolean(context, obj);
+ return SWIG_OK;
+}
+
+
+SWIGINTERNINLINE
+JSValueRef SWIG_From_bool SWIG_JSC_FROM_DECL_ARGS(bool value)
+{
+ return JSValueMakeBoolean(context, value);
+}
+
+
+static swig_type_info *
+DOMNode_dynamic_cast(void **ptr) {
+ DOMNode **nptr = (DOMNode **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getNodeType();
+ if (type == DOMNode::TEXT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText;
+ }
+ if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction;
+ }
+ if (type == DOMNode::DOCUMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument;
+ }
+ if (type == DOMNode::ELEMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement;
+ }
+ if (type == DOMNode::ENTITY_REFERENCE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::COMMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment;
+ }
+ if (type == DOMNode::DOCUMENT_TYPE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType;
+ }
+ if (type == DOMNode::ENTITY_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity;
+ }
+ if (type == DOMNode::ATTRIBUTE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr;
+ }
+ if (type == DOMNode::NOTATION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation;
+ }
+ return NULL;
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_short SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, short *val)
+{
+ long v;
+ int res = SWIG_AsVal_long SWIG_JSC_AS_CALL_ARGS(obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v < SHRT_MIN || v > SHRT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = (short)(v);
+ }
+ }
+ return res;
+}
+
+
+SWIGINTERNINLINE JSValueRef
+SWIG_From_long SWIG_JSC_FROM_DECL_ARGS(long value)
+{
+ return JSValueMakeNumber(context, value);
+}
+
+
+SWIGINTERNINLINE JSValueRef
+SWIG_From_short SWIG_JSC_FROM_DECL_ARGS(short value)
+{
+ return SWIG_From_long SWIG_JSC_FROM_CALL_ARGS(value);
+}
+
+
+SWIGINTERNINLINE JSValueRef
+SWIG_From_unsigned_SS_long SWIG_JSC_FROM_DECL_ARGS(unsigned long value)
+{
+ return (value > LONG_MAX) ?
+ JSValueMakeNumber(context, value) : JSValueMakeNumber(context, (long)(value));
+}
+
+
+SWIGINTERNINLINE JSValueRef
+SWIG_From_size_t SWIG_JSC_FROM_DECL_ARGS(size_t value)
+{
+ return SWIG_From_unsigned_SS_long SWIG_JSC_FROM_CALL_ARGS((unsigned long)(value));
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, unsigned long *val)
+{
+ long longVal;
+ if(!JSValueIsNumber(context, obj)) {
+ return SWIG_TypeError;
+ }
+
+ longVal = (long) JSValueToNumber(context, obj, NULL);
+
+ if(longVal < 0) {
+ return SWIG_OverflowError;
+ }
+
+ if(val) *val = longVal;
+
+ return SWIG_OK;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_size_t SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, size_t *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long SWIG_JSC_AS_CALL_ARGS(obj, val ? &v : 0);
+ if (SWIG_IsOK(res) && val) *val = (size_t)(v);
+ return res;
+}
+
+
+using uscxml::Data;
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+ static int init = 0;
+ static swig_type_info* info = 0;
+ if (!init) {
+ info = SWIG_TypeQuery("_p_char");
+ init = 1;
+ }
+ return info;
+}
+
+
+SWIGINTERN int
+SWIG_JSC_AsCharPtrAndSize(JSContextRef context, JSValueRef valRef, char** cptr, size_t* psize, int *alloc)
+{
+ if(JSValueIsString(context, valRef)) {
+ JSStringRef js_str = JSValueToStringCopy(context, valRef, NULL);
+ size_t len = JSStringGetMaximumUTF8CStringSize(js_str);
+ char* cstr = (char*) (new char[len]);
+ /* JSStringGetUTF8CString returns the length including 0-terminator */
+ len = JSStringGetUTF8CString(js_str, cstr, len);
+
+ if(alloc) *alloc = SWIG_NEWOBJ;
+ if(psize) *psize = len;
+ if(cptr) *cptr = cstr;
+
+ return SWIG_OK;
+ } else {
+ if(JSValueIsObject(context, valRef)) {
+ JSObjectRef obj = JSValueToObject(context, valRef, NULL);
+ // try if the object is a wrapped char[]
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ if (pchar_descriptor) {
+ void* vptr = 0;
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+ if (cptr) *cptr = (char *) vptr;
+ if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
+ if (alloc) *alloc = SWIG_OLDOBJ;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+ } else {
+ return SWIG_TypeError;
+ }
+ }
+}
+
+
+SWIGINTERN int
+SWIG_AsPtr_std_string SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, std::string **val)
+{
+ char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
+ if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
+ if (buf) {
+ if (val) *val = new std::string(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) delete[] buf;
+ return SWIG_NEWOBJ;
+ } else {
+ if (val) *val = 0;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ static int init = 0;
+ static swig_type_info* descriptor = 0;
+ if (!init) {
+ descriptor = SWIG_TypeQuery("std::string" " *");
+ init = 1;
+ }
+ if (descriptor) {
+ std::string *vptr;
+ int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
+ if (SWIG_IsOK(res) && val) *val = vptr;
+ return res;
+ }
+ }
+ return SWIG_ERROR;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_JSC_AS_DECL_ARGS(JSValueRef obj, int *val)
+{
+ long v;
+ int res = SWIG_AsVal_long SWIG_JSC_AS_CALL_ARGS(obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v < INT_MIN || v > INT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = (int)(v);
+ }
+ }
+ return res;
+}
+
+
+SWIGINTERNINLINE JSValueRef
+SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t size)
+{
+ if (carray) {
+ if (size > INT_MAX) {
+ // TODO: handle extra long strings
+ //swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ //return pchar_descriptor ?
+ // SWIG_InternalNewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void();
+ return JSValueMakeUndefined(context);
+ } else {
+ JSStringRef jsstring;
+ JSValueRef result;
+ if(size < 2) {
+ char c[2];
+ int i;
+ for(i=0;i<size;++i) {
+ c[i] = carray[i];
+ }
+ c[size] = 0;
+ jsstring = JSStringCreateWithUTF8CString(c);
+ } else {
+ jsstring = JSStringCreateWithUTF8CString(carray);
+ }
+ result = JSValueMakeString(context, jsstring);
+ JSStringRelease(jsstring);
+ return result;
+ }
+ } else {
+ return JSValueMakeUndefined(context);
+ }
+}
+
+
+SWIGINTERNINLINE JSValueRef
+SWIG_From_std_string SWIG_JSC_FROM_DECL_ARGS(const std::string& s)
+{
+ return SWIG_FromCharPtrAndSize(s.data(), s.size());
+}
+
+
+#define SWIGJSC_INIT JSCDOM_initialize
+
+
+
+
+SWIGINTERN bool JS_registerClass(JSGlobalContextRef context, JSObjectRef parentObject,
+ const char* className,
+ JSClassDefinition* definition) {
+
+ JSStringRef js_className = JSStringCreateWithUTF8CString(className);
+ JSObjectRef classObject = JSObjectMake(context, JSClassCreate(definition), NULL);
+ JSObjectSetProperty(context, parentObject,
+ js_className, classObject,
+ kJSPropertyAttributeNone, NULL);
+ JSStringRelease(js_className);
+
+ return true;
+}
+
+SWIGINTERN bool JS_registerNamespace(JSGlobalContextRef context,
+ JSObjectRef namespaceObj, JSObjectRef parentNamespace,
+ const char* name)
+{
+ JSStringRef js_name = JSStringCreateWithUTF8CString(name);
+ JSObjectSetProperty(context, parentNamespace,
+ js_name, namespaceObj,
+ kJSPropertyAttributeNone, NULL);
+ JSStringRelease(js_name);
+
+ return true;
+}
+
+
+SWIGINTERN bool JS_registerFunction(JSGlobalContextRef context, JSObjectRef object,
+ const char* functionName, JSObjectCallAsFunctionCallback callback)
+{
+ JSStringRef js_functionName = JSStringCreateWithUTF8CString(functionName);
+ JSObjectSetProperty(context, object, js_functionName,
+ JSObjectMakeFunctionWithCallback(context, js_functionName, callback),
+ kJSPropertyAttributeNone, NULL);
+ JSStringRelease(js_functionName);
+ return true;
+}
+
+SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ char buffer[256];
+ char msg[512];
+ int res;
+
+ JSStringGetUTF8CString(propertyName, buffer, 256);
+ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+
+ if(res<0) {
+ SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
+ } else {
+ SWIG_exception(SWIG_ERROR, msg);
+ }
+
+ return false;
+}
+
+SWIGINTERN JSValueRef JS_CharPtrToJSValue(JSContextRef context, char* cstr) {
+ JSValueRef val;
+
+ JSStringRef jsstring = JSStringCreateWithUTF8CString((char*) cstr);
+ val = JSValueMakeString(context, jsstring);
+ JSStringRelease(jsstring);
+
+ return val;
+}
+
+
+static JSValueRef _wrap_XERCES_HAS_CPP_NAMESPACE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(1));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_DEBUG_UTF8_OUT_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ bool arg1 ;
+ bool val1 ;
+ int ecode1 = 0 ;
+
+ ecode1 = SWIG_AsVal_bool SWIG_JSC_AS_CALL_ARGS(value, &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DEBUG_UTF8_OUT_set" "', argument " "1"" of type '" "bool""'");
+ }
+ arg1 = (bool)(val1);
+ DEBUG_UTF8_OUT = arg1;
+
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_DEBUG_UTF8_OUT_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ bool result;
+
+ JSValueRef jsresult;
+
+ result = (bool)DEBUG_UTF8_OUT;
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_DEBUG_UTF8_IN_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ bool arg1 ;
+ bool val1 ;
+ int ecode1 = 0 ;
+
+ ecode1 = SWIG_AsVal_bool SWIG_JSC_AS_CALL_ARGS(value, &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DEBUG_UTF8_IN_set" "', argument " "1"" of type '" "bool""'");
+ }
+ arg1 = (bool)(val1);
+ DEBUG_UTF8_IN = arg1;
+
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_DEBUG_UTF8_IN_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ bool result;
+
+ JSValueRef jsresult;
+
+ result = (bool)DEBUG_UTF8_IN;
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSClassDefinition _exports_DOMException_classDefinition;
+
+static JSClassDefinition _exports_DOMException_objectDefinition;
+
+static JSClassRef _exports_DOMException_classRef;
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_INDEX_SIZE_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::INDEX_SIZE_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_DOMSTRING_SIZE_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::DOMSTRING_SIZE_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_HIERARCHY_REQUEST_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::HIERARCHY_REQUEST_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_WRONG_DOCUMENT_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::WRONG_DOCUMENT_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_CHARACTER_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_CHARACTER_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_DATA_ALLOWED_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::NO_DATA_ALLOWED_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_MODIFICATION_ALLOWED_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::NO_MODIFICATION_ALLOWED_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_FOUND_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::NOT_FOUND_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_SUPPORTED_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::NOT_SUPPORTED_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_INUSE_ATTRIBUTE_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::INUSE_ATTRIBUTE_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_STATE_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_STATE_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_SYNTAX_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::SYNTAX_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_MODIFICATION_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_MODIFICATION_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_NAMESPACE_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::NAMESPACE_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_ACCESS_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_ACCESS_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_VALIDATION_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::VALIDATION_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMException_TYPE_MISMATCH_ERR(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMException::TYPE_MISMATCH_ERR));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSObjectRef _wrap_new_DOMException__SWIG_0(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ short arg1 ;
+ short arg2 ;
+ XERCES_CPP_NAMESPACE::MemoryManager *arg3 = (XERCES_CPP_NAMESPACE::MemoryManager *) (XERCES_CPP_NAMESPACE::MemoryManager *)0 ;
+ short val1 ;
+ int ecode1 = 0 ;
+ short val2 ;
+ int ecode2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result;
+ ecode1 = SWIG_AsVal_short SWIG_JSC_AS_CALL_ARGS(argv[0], &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DOMException" "', argument " "1"" of type '" "short""'");
+ }
+ arg1 = (short)(val1);
+ ecode2 = SWIG_AsVal_short SWIG_JSC_AS_CALL_ARGS(argv[1], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DOMException" "', argument " "2"" of type '" "short""'");
+ }
+ arg2 = (short)(val2);
+ res3 = SWIG_ConvertPtr(argv[2], &argp3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager, 0 | 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_DOMException" "', argument " "3"" of type '" "XERCES_CPP_NAMESPACE::MemoryManager *const""'");
+ }
+ arg3 = (XERCES_CPP_NAMESPACE::MemoryManager *)(argp3);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1,arg2,arg3);
+
+
+
+
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_DOMException__SWIG_1(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ short arg1 ;
+ short arg2 ;
+ short val1 ;
+ int ecode1 = 0 ;
+ short val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result;
+ ecode1 = SWIG_AsVal_short SWIG_JSC_AS_CALL_ARGS(argv[0], &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DOMException" "', argument " "1"" of type '" "short""'");
+ }
+ arg1 = (short)(val1);
+ ecode2 = SWIG_AsVal_short SWIG_JSC_AS_CALL_ARGS(argv[1], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DOMException" "', argument " "2"" of type '" "short""'");
+ }
+ arg2 = (short)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1,arg2);
+
+
+
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_DOMException__SWIG_2(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ short arg1 ;
+ short val1 ;
+ int ecode1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result;
+ ecode1 = SWIG_AsVal_short SWIG_JSC_AS_CALL_ARGS(argv[0], &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DOMException" "', argument " "1"" of type '" "short""'");
+ }
+ arg1 = (short)(val1);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1);
+
+
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_DOMException(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSObjectRef thisObject = NULL;
+
+ // switch all cases by means of series of if-returns.
+
+ if(argc == 3) {
+ thisObject = _wrap_new_DOMException__SWIG_0(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+ if(argc == 2) {
+ thisObject = _wrap_new_DOMException__SWIG_1(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+ if(argc == 1) {
+ thisObject = _wrap_new_DOMException__SWIG_2(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+
+ // default:
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of $jsname");
+
+fail:
+ return thisObject;
+}
+
+
+static void _wrap_delete_DOMException(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMException * arg1 = (XERCES_CPP_NAMESPACE::DOMException *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMException_getMessage(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMException_getMessage.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_getMessage" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMException const *)arg1)->getMessage();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_DOMException_code_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ short arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ short val2 ;
+ int ecode2 = 0 ;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_code_set" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ ecode2 = SWIG_AsVal_short SWIG_JSC_AS_CALL_ARGS(value, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMException_code_set" "', argument " "2"" of type '" "short""'");
+ }
+ arg2 = (short)(val2);
+ if (arg1) (arg1)->code = arg2;
+
+
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_DOMException_code_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ short result;
+
+ JSValueRef jsresult;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_code_get" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ result = (short) ((arg1)->code);
+ jsresult = SWIG_From_short SWIG_JSC_FROM_CALL_ARGS((short)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_DOMException_msg_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_msg_set" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+
+ arg2 = JS2XMLString(value, context);
+
+ if (arg1) (arg1)->msg = (XMLCh const *)arg2;
+
+
+ delete[] arg2;
+
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_DOMException_msg_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_msg_get" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ result = (XMLCh *) ((arg1)->msg);
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMException_staticValues[] = {
+ {
+ "INDEX_SIZE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INDEX_SIZE_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOMSTRING_SIZE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_DOMSTRING_SIZE_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "HIERARCHY_REQUEST_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_HIERARCHY_REQUEST_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "WRONG_DOCUMENT_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_WRONG_DOCUMENT_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "INVALID_CHARACTER_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_CHARACTER_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "NO_DATA_ALLOWED_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_DATA_ALLOWED_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "NO_MODIFICATION_ALLOWED_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_MODIFICATION_ALLOWED_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "NOT_FOUND_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_FOUND_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "NOT_SUPPORTED_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_SUPPORTED_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "INUSE_ATTRIBUTE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INUSE_ATTRIBUTE_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "INVALID_STATE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_STATE_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "SYNTAX_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_SYNTAX_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "INVALID_MODIFICATION_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_MODIFICATION_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "NAMESPACE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NAMESPACE_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "INVALID_ACCESS_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_ACCESS_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "VALIDATION_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_VALIDATION_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "TYPE_MISMATCH_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_TYPE_MISMATCH_ERR, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMException_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMException_values[] = {
+ {
+ "code", _wrap_DOMException_code_get, _wrap_DOMException_code_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "msg", _wrap_DOMException_msg_get, _wrap_DOMException_msg_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMException_functions[] = {
+ {
+ "getMessage", _wrap_DOMException_getMessage, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSClassDefinition _exports_DOMNode_classDefinition;
+
+static JSClassDefinition _exports_DOMNode_objectDefinition;
+
+static JSClassRef _exports_DOMNode_classRef;
+
+
+static void _wrap_delete_DOMNode(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMNode * arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_ELEMENT_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::ELEMENT_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_ATTRIBUTE_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::ATTRIBUTE_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_TEXT_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::TEXT_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_CDATA_SECTION_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::CDATA_SECTION_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_REFERENCE_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::ENTITY_REFERENCE_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::ENTITY_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_PROCESSING_INSTRUCTION_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::PROCESSING_INSTRUCTION_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_COMMENT_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::COMMENT_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_TYPE_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_TYPE_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_FRAGMENT_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_FRAGMENT_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_NOTATION_NODE(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::NOTATION_NODE));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_DISCONNECTED(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_DISCONNECTED));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_PRECEDING(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_PRECEDING));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_FOLLOWING(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_FOLLOWING));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINS(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINS));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINED_BY(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINED_BY));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getNodeName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNodeName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNodeName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeName();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getNodeValue(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNodeValue.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNodeValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeValue();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getNodeType(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode::NodeType result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNodeType.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNodeType" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode::NodeType)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeType();
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getParentNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getParentNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getParentNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getParentNode();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getChildNodes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getChildNodes.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getChildNodes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getChildNodes();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getFirstChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getFirstChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getFirstChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getFirstChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getLastChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getLastChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getLastChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getLastChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getPreviousSibling(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getPreviousSibling.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getPreviousSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getPreviousSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getNextSibling(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNextSibling.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNextSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNextSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getAttributes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getAttributes.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getAttributes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getAttributes();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getOwnerDocument(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMDocument *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getOwnerDocument.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getOwnerDocument" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMDocument *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getOwnerDocument();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_cloneNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_cloneNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_cloneNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ ecode2 = SWIG_AsVal_bool SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMNode_cloneNode" "', argument " "2"" of type '" "bool""'");
+ }
+ arg2 = (bool)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->cloneNode(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_insertBefore(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg3 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_insertBefore.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_insertBefore" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_insertBefore" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DOMNode_insertBefore" "', argument " "3"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg3 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp3);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->insertBefore(arg2,arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_replaceChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg3 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_replaceChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_replaceChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_replaceChild" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DOMNode_replaceChild" "', argument " "3"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg3 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp3);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->replaceChild(arg2,arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_removeChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_removeChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_removeChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_removeChild" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeChild(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_appendChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_appendChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_appendChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_appendChild" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->appendChild(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_hasChildNodes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_hasChildNodes.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_hasChildNodes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->hasChildNodes();
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_setNodeValue(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setNodeValue.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setNodeValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->setNodeValue((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_normalize(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_normalize.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_normalize" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ (arg1)->normalize();
+ jsresult = JSValueMakeUndefined(context);
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_isSupported(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isSupported.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isSupported" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isSupported((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getNamespaceURI(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNamespaceURI.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNamespaceURI" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNamespaceURI();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getLocalName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getLocalName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getLocalName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getLocalName();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_setPrefix(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setPrefix.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setPrefix" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->setPrefix((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_hasAttributes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_hasAttributes.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_hasAttributes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->hasAttributes();
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_isSameNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isSameNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isSameNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_isSameNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isSameNode((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_isEqualNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isEqualNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isEqualNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_isEqualNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isEqualNode((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_setUserData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *arg3 = (void *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMUserDataHandler *arg4 = (XERCES_CPP_NAMESPACE::DOMUserDataHandler *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res3 ;
+ void *argp4 = 0 ;
+ int res4 = 0 ;
+ void *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setUserData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setUserData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ res3 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg3), 0, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DOMNode_setUserData" "', argument " "3"" of type '" "void *""'");
+ }
+ res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler, 0 | 0 );
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DOMNode_setUserData" "', argument " "4"" of type '" "XERCES_CPP_NAMESPACE::DOMUserDataHandler *""'");
+ }
+ arg4 = (XERCES_CPP_NAMESPACE::DOMUserDataHandler *)(argp4);
+ result = (void *)(arg1)->setUserData((XMLCh const *)arg2,arg3,arg4);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getUserData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getUserData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getUserData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (void *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getUserData((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getBaseURI(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getBaseURI.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getBaseURI" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getBaseURI();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_compareDocumentPosition(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ short result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_compareDocumentPosition.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_compareDocumentPosition" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_compareDocumentPosition" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (short)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->compareDocumentPosition((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ jsresult = SWIG_From_short SWIG_JSC_FROM_CALL_ARGS((short)(result));
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getTextContent(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getTextContent.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getTextContent" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getTextContent();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_setTextContent(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setTextContent.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setTextContent" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->setTextContent((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_lookupPrefix(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_lookupPrefix.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_lookupPrefix" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->lookupPrefix((XMLCh const *)arg2);
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_isDefaultNamespace(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isDefaultNamespace.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isDefaultNamespace" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isDefaultNamespace((XMLCh const *)arg2);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_lookupNamespaceURI(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_lookupNamespaceURI.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_lookupNamespaceURI" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->lookupNamespaceURI((XMLCh const *)arg2);
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_getFeature(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getFeature.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getFeature" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (void *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getFeature((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNode_release(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_release.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_release" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ (arg1)->release();
+ jsresult = JSValueMakeUndefined(context);
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMNode_staticValues[] = {
+ {
+ "ELEMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ELEMENT_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "ATTRIBUTE_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ATTRIBUTE_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "TEXT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_TEXT_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "CDATA_SECTION_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_CDATA_SECTION_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "ENTITY_REFERENCE_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_REFERENCE_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "ENTITY_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "PROCESSING_INSTRUCTION_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_PROCESSING_INSTRUCTION_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "COMMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_COMMENT_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_TYPE_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_TYPE_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_FRAGMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_FRAGMENT_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "NOTATION_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_NOTATION_NODE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_POSITION_DISCONNECTED", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_DISCONNECTED, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_POSITION_PRECEDING", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_PRECEDING, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_POSITION_FOLLOWING", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_FOLLOWING, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_POSITION_CONTAINS", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINS, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_POSITION_CONTAINED_BY", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINED_BY, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNode_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMNode_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNode_functions[] = {
+ {
+ "getNodeName", _wrap_DOMNode_getNodeName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNodeValue", _wrap_DOMNode_getNodeValue, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNodeType", _wrap_DOMNode_getNodeType, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getParentNode", _wrap_DOMNode_getParentNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getChildNodes", _wrap_DOMNode_getChildNodes, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getFirstChild", _wrap_DOMNode_getFirstChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getLastChild", _wrap_DOMNode_getLastChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getPreviousSibling", _wrap_DOMNode_getPreviousSibling, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNextSibling", _wrap_DOMNode_getNextSibling, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getAttributes", _wrap_DOMNode_getAttributes, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getOwnerDocument", _wrap_DOMNode_getOwnerDocument, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "cloneNode", _wrap_DOMNode_cloneNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "insertBefore", _wrap_DOMNode_insertBefore, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "replaceChild", _wrap_DOMNode_replaceChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "removeChild", _wrap_DOMNode_removeChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "appendChild", _wrap_DOMNode_appendChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "hasChildNodes", _wrap_DOMNode_hasChildNodes, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setNodeValue", _wrap_DOMNode_setNodeValue, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "normalize", _wrap_DOMNode_normalize, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "isSupported", _wrap_DOMNode_isSupported, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNamespaceURI", _wrap_DOMNode_getNamespaceURI, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getLocalName", _wrap_DOMNode_getLocalName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setPrefix", _wrap_DOMNode_setPrefix, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "hasAttributes", _wrap_DOMNode_hasAttributes, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "isSameNode", _wrap_DOMNode_isSameNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "isEqualNode", _wrap_DOMNode_isEqualNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setUserData", _wrap_DOMNode_setUserData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getUserData", _wrap_DOMNode_getUserData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getBaseURI", _wrap_DOMNode_getBaseURI, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "compareDocumentPosition", _wrap_DOMNode_compareDocumentPosition, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getTextContent", _wrap_DOMNode_getTextContent, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setTextContent", _wrap_DOMNode_setTextContent, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "lookupPrefix", _wrap_DOMNode_lookupPrefix, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "isDefaultNamespace", _wrap_DOMNode_isDefaultNamespace, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "lookupNamespaceURI", _wrap_DOMNode_lookupNamespaceURI, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getFeature", _wrap_DOMNode_getFeature, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "release", _wrap_DOMNode_release, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMNode(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMNode can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMAttr_classDefinition;
+
+static JSClassDefinition _exports_DOMAttr_objectDefinition;
+
+static JSClassRef _exports_DOMAttr_classRef;
+
+
+static void _wrap_delete_DOMAttr(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMAttr * arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMAttr_getName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getName();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMAttr_getSpecified(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getSpecified.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getSpecified" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getSpecified();
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMAttr_getValue(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getValue.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getValue();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMAttr_setValue(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_setValue.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_setValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->setValue((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMAttr_getOwnerElement(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getOwnerElement.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getOwnerElement" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getOwnerElement();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMAttr_isId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_isId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_isId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->isId();
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMAttr_getSchemaTypeInfo(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMTypeInfo *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getSchemaTypeInfo.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getSchemaTypeInfo" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMTypeInfo *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getSchemaTypeInfo();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMAttr_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMAttr_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMAttr_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMAttr_functions[] = {
+ {
+ "getName", _wrap_DOMAttr_getName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getSpecified", _wrap_DOMAttr_getSpecified, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getValue", _wrap_DOMAttr_getValue, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setValue", _wrap_DOMAttr_setValue, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getOwnerElement", _wrap_DOMAttr_getOwnerElement, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "isId", _wrap_DOMAttr_isId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getSchemaTypeInfo", _wrap_DOMAttr_getSchemaTypeInfo, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMAttr(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMAttr can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMElement_classDefinition;
+
+static JSClassDefinition _exports_DOMElement_objectDefinition;
+
+static JSClassRef _exports_DOMElement_classRef;
+
+
+static void _wrap_delete_DOMElement(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMElement * arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMElement_getTagName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getTagName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getTagName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getTagName();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getAttribute(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttribute.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttribute((XMLCh const *)arg2);
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getAttributeNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNode((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getElementsByTagName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getElementsByTagName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getElementsByTagName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getElementsByTagName((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setAttribute(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttribute.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ (arg1)->setAttribute((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setAttributeNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_setAttributeNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->setAttributeNode(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_removeAttributeNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_removeAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_removeAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_removeAttributeNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->removeAttributeNode(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_removeAttribute(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_removeAttribute.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_removeAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->removeAttribute((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getAttributeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setAttributeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XMLCh *arg4 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+
+ arg4 = JS2XMLString(argv[2], context);
+
+ (arg1)->setAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3,(XMLCh const *)arg4);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ delete[] arg4;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_removeAttributeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_removeAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_removeAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ (arg1)->removeAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getAttributeNodeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttributeNodeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttributeNodeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNodeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setAttributeNodeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttributeNodeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttributeNodeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_setAttributeNodeNS" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->setAttributeNodeNS(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getElementsByTagNameNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getElementsByTagNameNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getElementsByTagNameNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getElementsByTagNameNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_hasAttribute(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_hasAttribute.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_hasAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->hasAttribute((XMLCh const *)arg2);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_hasAttributeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_hasAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_hasAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->hasAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setIdAttribute(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ bool arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool val3 ;
+ int ecode3 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setIdAttribute.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setIdAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ ecode3 = SWIG_AsVal_bool SWIG_JSC_AS_CALL_ARGS(argv[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMElement_setIdAttribute" "', argument " "3"" of type '" "bool""'");
+ }
+ arg3 = (bool)(val3);
+ (arg1)->setIdAttribute((XMLCh const *)arg2,arg3);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setIdAttributeNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ bool arg4 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool val4 ;
+ int ecode4 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setIdAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setIdAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ ecode4 = SWIG_AsVal_bool SWIG_JSC_AS_CALL_ARGS(argv[2], &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DOMElement_setIdAttributeNS" "', argument " "4"" of type '" "bool""'");
+ }
+ arg4 = (bool)(val4);
+ (arg1)->setIdAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3,arg4);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_setIdAttributeNode(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ bool arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ bool val3 ;
+ int ecode3 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setIdAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setIdAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_setIdAttributeNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ ecode3 = SWIG_AsVal_bool SWIG_JSC_AS_CALL_ARGS(argv[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMElement_setIdAttributeNode" "', argument " "3"" of type '" "bool""'");
+ }
+ arg3 = (bool)(val3);
+ (arg1)->setIdAttributeNode((XERCES_CPP_NAMESPACE::DOMAttr const *)arg2,arg3);
+ jsresult = JSValueMakeUndefined(context);
+
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getSchemaTypeInfo(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMTypeInfo *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getSchemaTypeInfo.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getSchemaTypeInfo" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMTypeInfo *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getSchemaTypeInfo();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getFirstElementChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getFirstElementChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getFirstElementChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getFirstElementChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getLastElementChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getLastElementChild.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getLastElementChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getLastElementChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getPreviousElementSibling(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getPreviousElementSibling.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getPreviousElementSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getPreviousElementSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getNextElementSibling(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getNextElementSibling.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getNextElementSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getNextElementSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMElement_getChildElementCount(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getChildElementCount.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getChildElementCount" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getChildElementCount();
+ jsresult = SWIG_From_size_t SWIG_JSC_FROM_CALL_ARGS((size_t)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMElement_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMElement_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMElement_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMElement_functions[] = {
+ {
+ "getTagName", _wrap_DOMElement_getTagName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getAttribute", _wrap_DOMElement_getAttribute, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getAttributeNode", _wrap_DOMElement_getAttributeNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getElementsByTagName", _wrap_DOMElement_getElementsByTagName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setAttribute", _wrap_DOMElement_setAttribute, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setAttributeNode", _wrap_DOMElement_setAttributeNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "removeAttributeNode", _wrap_DOMElement_removeAttributeNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "removeAttribute", _wrap_DOMElement_removeAttribute, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getAttributeNS", _wrap_DOMElement_getAttributeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setAttributeNS", _wrap_DOMElement_setAttributeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "removeAttributeNS", _wrap_DOMElement_removeAttributeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getAttributeNodeNS", _wrap_DOMElement_getAttributeNodeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setAttributeNodeNS", _wrap_DOMElement_setAttributeNodeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getElementsByTagNameNS", _wrap_DOMElement_getElementsByTagNameNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "hasAttribute", _wrap_DOMElement_hasAttribute, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "hasAttributeNS", _wrap_DOMElement_hasAttributeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setIdAttribute", _wrap_DOMElement_setIdAttribute, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setIdAttributeNS", _wrap_DOMElement_setIdAttributeNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setIdAttributeNode", _wrap_DOMElement_setIdAttributeNode, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getSchemaTypeInfo", _wrap_DOMElement_getSchemaTypeInfo, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getFirstElementChild", _wrap_DOMElement_getFirstElementChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getLastElementChild", _wrap_DOMElement_getLastElementChild, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getPreviousElementSibling", _wrap_DOMElement_getPreviousElementSibling, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNextElementSibling", _wrap_DOMElement_getNextElementSibling, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getChildElementCount", _wrap_DOMElement_getChildElementCount, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMElement(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMElement can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMEntity_classDefinition;
+
+static JSClassDefinition _exports_DOMEntity_objectDefinition;
+
+static JSClassRef _exports_DOMEntity_classRef;
+
+
+static void _wrap_delete_DOMEntity(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMEntity * arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMEntity_getPublicId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getPublicId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getPublicId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getPublicId();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMEntity_getSystemId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getSystemId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getSystemId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getSystemId();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMEntity_getNotationName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getNotationName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getNotationName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getNotationName();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMEntity_getInputEncoding(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getInputEncoding.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getInputEncoding" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getInputEncoding();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMEntity_getXmlEncoding(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getXmlEncoding.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getXmlEncoding" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getXmlEncoding();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMEntity_getXmlVersion(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getXmlVersion.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getXmlVersion" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getXmlVersion();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMEntity_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMEntity_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMEntity_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMEntity_functions[] = {
+ {
+ "getPublicId", _wrap_DOMEntity_getPublicId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getSystemId", _wrap_DOMEntity_getSystemId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNotationName", _wrap_DOMEntity_getNotationName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getInputEncoding", _wrap_DOMEntity_getInputEncoding, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getXmlEncoding", _wrap_DOMEntity_getXmlEncoding, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getXmlVersion", _wrap_DOMEntity_getXmlVersion, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMEntity(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMEntity can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMDocumentType_classDefinition;
+
+static JSClassDefinition _exports_DOMDocumentType_objectDefinition;
+
+static JSClassRef _exports_DOMDocumentType_classRef;
+
+
+static void _wrap_delete_DOMDocumentType(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMDocumentType * arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMDocumentType_getName(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getName.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getName();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMDocumentType_getEntities(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getEntities.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getEntities" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getEntities();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMDocumentType_getNotations(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getNotations.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getNotations" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getNotations();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMDocumentType_getPublicId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getPublicId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getPublicId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getPublicId();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMDocumentType_getSystemId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getSystemId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getSystemId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getSystemId();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMDocumentType_getInternalSubset(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getInternalSubset.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getInternalSubset" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getInternalSubset();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMDocumentType_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMDocumentType_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMDocumentType_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMDocumentType_functions[] = {
+ {
+ "getName", _wrap_DOMDocumentType_getName, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getEntities", _wrap_DOMDocumentType_getEntities, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNotations", _wrap_DOMDocumentType_getNotations, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getPublicId", _wrap_DOMDocumentType_getPublicId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getSystemId", _wrap_DOMDocumentType_getSystemId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getInternalSubset", _wrap_DOMDocumentType_getInternalSubset, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMDocumentType(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMDocumentType can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMCharacterData_classDefinition;
+
+static JSClassDefinition _exports_DOMCharacterData_objectDefinition;
+
+static JSClassRef _exports_DOMCharacterData_classRef;
+
+
+static void _wrap_delete_DOMCharacterData(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMCharacterData * arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_getData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_getData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_getData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->getData();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_getLength(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_getLength.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_getLength" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->getLength();
+ jsresult = SWIG_From_size_t SWIG_JSC_FROM_CALL_ARGS((size_t)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_substringData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ size_t val3 ;
+ int ecode3 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_substringData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_substringData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_substringData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ ecode3 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMCharacterData_substringData" "', argument " "3"" of type '" "XMLSize_t""'");
+ }
+ arg3 = (XMLSize_t)(val3);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->substringData(arg2,arg3);
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_appendData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_appendData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_appendData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->appendData((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_insertData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_insertData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_insertData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_insertData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ (arg1)->insertData(arg2,(XMLCh const *)arg3);
+ jsresult = JSValueMakeUndefined(context);
+
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_deleteData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ size_t val3 ;
+ int ecode3 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_deleteData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_deleteData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_deleteData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ ecode3 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMCharacterData_deleteData" "', argument " "3"" of type '" "XMLSize_t""'");
+ }
+ arg3 = (XMLSize_t)(val3);
+ (arg1)->deleteData(arg2,arg3);
+ jsresult = JSValueMakeUndefined(context);
+
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_replaceData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ XMLCh *arg4 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ size_t val3 ;
+ int ecode3 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_replaceData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_replaceData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_replaceData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ ecode3 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMCharacterData_replaceData" "', argument " "3"" of type '" "XMLSize_t""'");
+ }
+ arg3 = (XMLSize_t)(val3);
+
+ arg4 = JS2XMLString(argv[2], context);
+
+ (arg1)->replaceData(arg2,arg3,(XMLCh const *)arg4);
+ jsresult = JSValueMakeUndefined(context);
+
+
+
+
+ delete[] arg4;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMCharacterData_setData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_setData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_setData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->setData((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMCharacterData_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMCharacterData_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMCharacterData_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMCharacterData_functions[] = {
+ {
+ "getData", _wrap_DOMCharacterData_getData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getLength", _wrap_DOMCharacterData_getLength, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "substringData", _wrap_DOMCharacterData_substringData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "appendData", _wrap_DOMCharacterData_appendData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "insertData", _wrap_DOMCharacterData_insertData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "deleteData", _wrap_DOMCharacterData_deleteData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "replaceData", _wrap_DOMCharacterData_replaceData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setData", _wrap_DOMCharacterData_setData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMCharacterData(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMCharacterData can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMComment_classDefinition;
+
+static JSClassDefinition _exports_DOMComment_objectDefinition;
+
+static JSClassRef _exports_DOMComment_classRef;
+
+
+static void _wrap_delete_DOMComment(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMComment * arg1 = (XERCES_CPP_NAMESPACE::DOMComment *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSStaticValue _exports_DOMComment_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMComment_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMComment_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMComment_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMComment(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMComment can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMText_classDefinition;
+
+static JSClassDefinition _exports_DOMText_objectDefinition;
+
+static JSClassRef _exports_DOMText_classRef;
+
+
+static void _wrap_delete_DOMText(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMText * arg1 = (XERCES_CPP_NAMESPACE::DOMText *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMText_splitText(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLSize_t arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMText *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_splitText.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_splitText" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMText_splitText" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMText *)(arg1)->splitText(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMText_getIsElementContentWhitespace(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_getIsElementContentWhitespace.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_getIsElementContentWhitespace" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->getIsElementContentWhitespace();
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMText_getWholeText(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_getWholeText.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_getWholeText" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->getWholeText();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMText_replaceWholeText(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMText *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_replaceWholeText.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_replaceWholeText" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMText *)(arg1)->replaceWholeText((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMText_isIgnorableWhitespace(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_isIgnorableWhitespace.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_isIgnorableWhitespace" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->isIgnorableWhitespace();
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMText_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMText_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMText_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMText_functions[] = {
+ {
+ "splitText", _wrap_DOMText_splitText, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getIsElementContentWhitespace", _wrap_DOMText_getIsElementContentWhitespace, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getWholeText", _wrap_DOMText_getWholeText, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "replaceWholeText", _wrap_DOMText_replaceWholeText, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "isIgnorableWhitespace", _wrap_DOMText_isIgnorableWhitespace, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMText(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMText can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMCDATASection_classDefinition;
+
+static JSClassDefinition _exports_DOMCDATASection_objectDefinition;
+
+static JSClassRef _exports_DOMCDATASection_classRef;
+
+
+static void _wrap_delete_DOMCDATASection(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMCDATASection * arg1 = (XERCES_CPP_NAMESPACE::DOMCDATASection *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSStaticValue _exports_DOMCDATASection_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMCDATASection_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMCDATASection_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMCDATASection_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMCDATASection(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMCDATASection can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMNodeList_classDefinition;
+
+static JSClassDefinition _exports_DOMNodeList_objectDefinition;
+
+static JSClassRef _exports_DOMNodeList_classRef;
+
+
+static void _wrap_delete_DOMNodeList(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMNodeList * arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMNodeList_item(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) 0 ;
+ XMLSize_t arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNodeList_item.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNodeList_item" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNodeList const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMNodeList_item" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNodeList const *)arg1)->item(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNodeList_getLength(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNodeList_getLength.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNodeList_getLength" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNodeList const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMNodeList const *)arg1)->getLength();
+ jsresult = SWIG_From_size_t SWIG_JSC_FROM_CALL_ARGS((size_t)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMNodeList_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNodeList_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMNodeList_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNodeList_functions[] = {
+ {
+ "item", _wrap_DOMNodeList_item, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getLength", _wrap_DOMNodeList_getLength, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMNodeList(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMNodeList can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMNamedNodeMap_classDefinition;
+
+static JSClassDefinition _exports_DOMNamedNodeMap_objectDefinition;
+
+static JSClassRef _exports_DOMNamedNodeMap_classRef;
+
+
+static void _wrap_delete_DOMNamedNodeMap(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap * arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_setNamedItem(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_setNamedItem.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_setNamedItem" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNamedNodeMap_setNamedItem" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->setNamedItem(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_item(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLSize_t arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_item.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_item" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ ecode2 = SWIG_AsVal_size_t SWIG_JSC_AS_CALL_ARGS(argv[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMNamedNodeMap_item" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->item(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_getNamedItem(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_getNamedItem.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_getNamedItem" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getNamedItem((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_getLength(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_getLength.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_getLength" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getLength();
+ jsresult = SWIG_From_size_t SWIG_JSC_FROM_CALL_ARGS((size_t)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_removeNamedItem(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_removeNamedItem.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_removeNamedItem" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeNamedItem((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_getNamedItemNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_getNamedItemNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_getNamedItemNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getNamedItemNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_setNamedItemNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_setNamedItemNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_setNamedItemNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNamedNodeMap_setNamedItemNS" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->setNamedItemNS(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNamedNodeMap_removeNamedItemNS(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_removeNamedItemNS.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_removeNamedItemNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+
+ arg3 = JS2XMLString(argv[1], context);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeNamedItemNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMNamedNodeMap_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNamedNodeMap_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMNamedNodeMap_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNamedNodeMap_functions[] = {
+ {
+ "setNamedItem", _wrap_DOMNamedNodeMap_setNamedItem, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "item", _wrap_DOMNamedNodeMap_item, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNamedItem", _wrap_DOMNamedNodeMap_getNamedItem, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getLength", _wrap_DOMNamedNodeMap_getLength, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "removeNamedItem", _wrap_DOMNamedNodeMap_removeNamedItem, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getNamedItemNS", _wrap_DOMNamedNodeMap_getNamedItemNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setNamedItemNS", _wrap_DOMNamedNodeMap_setNamedItemNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "removeNamedItemNS", _wrap_DOMNamedNodeMap_removeNamedItemNS, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMNamedNodeMap(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMNamedNodeMap can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMDocumentFragment_classDefinition;
+
+static JSClassDefinition _exports_DOMDocumentFragment_objectDefinition;
+
+static JSClassRef _exports_DOMDocumentFragment_classRef;
+
+
+static void _wrap_delete_DOMDocumentFragment(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMDocumentFragment * arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentFragment *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSStaticValue _exports_DOMDocumentFragment_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMDocumentFragment_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMDocumentFragment_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMDocumentFragment_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMDocumentFragment(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMDocumentFragment can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMEntityReference_classDefinition;
+
+static JSClassDefinition _exports_DOMEntityReference_objectDefinition;
+
+static JSClassRef _exports_DOMEntityReference_classRef;
+
+
+static void _wrap_delete_DOMEntityReference(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMEntityReference * arg1 = (XERCES_CPP_NAMESPACE::DOMEntityReference *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSStaticValue _exports_DOMEntityReference_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMEntityReference_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMEntityReference_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMEntityReference_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMEntityReference(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMEntityReference can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMNotation_classDefinition;
+
+static JSClassDefinition _exports_DOMNotation_objectDefinition;
+
+static JSClassRef _exports_DOMNotation_classRef;
+
+
+static void _wrap_delete_DOMNotation(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMNotation * arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMNotation_getPublicId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNotation_getPublicId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNotation_getPublicId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNotation const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNotation const *)arg1)->getPublicId();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMNotation_getSystemId(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNotation_getSystemId.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNotation_getSystemId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNotation const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNotation const *)arg1)->getSystemId();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMNotation_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNotation_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMNotation_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMNotation_functions[] = {
+ {
+ "getPublicId", _wrap_DOMNotation_getPublicId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getSystemId", _wrap_DOMNotation_getSystemId, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMNotation(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMNotation can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_DOMProcessingInstruction_classDefinition;
+
+static JSClassDefinition _exports_DOMProcessingInstruction_objectDefinition;
+
+static JSClassRef _exports_DOMProcessingInstruction_classRef;
+
+
+static void _wrap_delete_DOMProcessingInstruction(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction * arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSValueRef _wrap_DOMProcessingInstruction_getTarget(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMProcessingInstruction_getTarget.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMProcessingInstruction_getTarget" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *)arg1)->getTarget();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMProcessingInstruction_getData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMProcessingInstruction_getData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMProcessingInstruction_getData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *)arg1)->getData();
+
+ jsresult = XMLString2JS(result, context);
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_DOMProcessingInstruction_setData(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMProcessingInstruction_setData.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMProcessingInstruction_setData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMProcessingInstruction *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)(argp1);
+
+ arg2 = JS2XMLString(argv[0], context);
+
+ (arg1)->setData((XMLCh const *)arg2);
+ jsresult = JSValueMakeUndefined(context);
+
+
+ delete[] arg2;
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSStaticValue _exports_DOMProcessingInstruction_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMProcessingInstruction_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_DOMProcessingInstruction_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_DOMProcessingInstruction_functions[] = {
+ {
+ "getTarget", _wrap_DOMProcessingInstruction_getTarget, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "getData", _wrap_DOMProcessingInstruction_getData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "setData", _wrap_DOMProcessingInstruction_setData, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSObjectRef _wrap_new_veto_DOMProcessingInstruction(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ SWIG_exception(SWIG_ERROR, "Class DOMProcessingInstruction can not be instantiated");
+ return 0;
+}
+
+
+static JSClassDefinition _exports_Event_classDefinition;
+
+static JSClassDefinition _exports_Event_objectDefinition;
+
+static JSClassRef _exports_Event_classRef;
+
+
+static JSValueRef _wrap_uscxml_Event_INTERNAL(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(uscxml::Event::INTERNAL));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_uscxml_Event_EXTERNAL(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(uscxml::Event::EXTERNAL));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_uscxml_Event_PLATFORM(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ JSValueRef jsresult;
+
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(uscxml::Event::PLATFORM));
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSObjectRef _wrap_new_Event__SWIG_0(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ uscxml::Event *result;
+ result = (uscxml::Event *)new uscxml::Event();
+
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_Event__SWIG_1(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ std::string *arg1 = 0 ;
+ uscxml::Event::Type arg2 ;
+ int res1 = SWIG_OLDOBJ ;
+ int val2 ;
+ int ecode2 = 0 ;
+ uscxml::Event *result;
+ {
+ std::string *ptr = (std::string *)0;
+ res1 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(argv[0], &ptr);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ arg1 = ptr;
+ }
+ ecode2 = SWIG_AsVal_int SWIG_JSC_AS_CALL_ARGS(argv[1], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "uscxml::Event::Type""'");
+ }
+ arg2 = (uscxml::Event::Type)(val2);
+ result = (uscxml::Event *)new uscxml::Event((std::string const &)*arg1,arg2);
+
+ if (SWIG_IsNewObj(res1)) delete arg1;
+
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_Event__SWIG_2(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ std::string *arg1 = 0 ;
+ int res1 = SWIG_OLDOBJ ;
+ uscxml::Event *result;
+ {
+ std::string *ptr = (std::string *)0;
+ res1 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(argv[0], &ptr);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ arg1 = ptr;
+ }
+ result = (uscxml::Event *)new uscxml::Event((std::string const &)*arg1);
+
+ if (SWIG_IsNewObj(res1)) delete arg1;
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_Event(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSObjectRef thisObject = NULL;
+
+ // switch all cases by means of series of if-returns.
+
+ if(argc == 0) {
+ thisObject = _wrap_new_Event__SWIG_0(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+ if(argc == 2) {
+ thisObject = _wrap_new_Event__SWIG_1(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+ if(argc == 1) {
+ thisObject = _wrap_new_Event__SWIG_2(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+
+ // default:
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of $jsname");
+
+fail:
+ return thisObject;
+}
+
+
+static JSValueRef _wrap_Event_operator_equal_to(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 ;
+ int res2 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_operator_equal_to.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_operator_equal_to" "', argument " "1"" of type '" "uscxml::Event const *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_uscxml__Event, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_operator_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_operator_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ arg2 = (uscxml::Event *)(argp2);
+ result = (bool)((uscxml::Event const *)arg1)->operator ==((uscxml::Event const &)*arg2);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef _wrap_Event_operator_not_equal_to(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 ;
+ int res2 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_operator_not_equal_to.");
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_operator_not_equal_to" "', argument " "1"" of type '" "uscxml::Event const *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_uscxml__Event, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_operator_not_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_operator_not_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ arg2 = (uscxml::Event *)(argp2);
+ result = (bool)((uscxml::Event const *)arg1)->operator !=((uscxml::Event const &)*arg2);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static int _wrap_Event_getParam__SWIG_0(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception, JSValueRef* p_result)
+{
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ Data *arg3 = 0 ;
+ void *argp1 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_getParam__SWIG_0.");
+
+ res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ arg1 = (uscxml::Event::params_t *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(argv[1], &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ res3 = SWIG_ConvertPtr(argv[2], &argp3, SWIGTYPE_p_Data, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_getParam" "', argument " "3"" of type '" "Data &""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "3"" of type '" "Data &""'");
+ }
+ arg3 = (Data *)(argp3);
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ *p_result = jsresult;
+ return SWIG_OK;
+
+ goto fail;
+fail:
+ return SWIG_TypeError;
+}
+
+
+static int _wrap_Event_getParam__SWIG_1(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception, JSValueRef* p_result)
+{
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ std::list< Data > *arg3 = 0 ;
+ void *argp1 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_getParam__SWIG_1.");
+
+ res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ arg1 = (uscxml::Event::params_t *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(argv[1], &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ res3 = SWIG_ConvertPtr(argv[2], &argp3, SWIGTYPE_p_std__listT_Data_t, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_getParam" "', argument " "3"" of type '" "std::list< Data > &""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "3"" of type '" "std::list< Data > &""'");
+ }
+ arg3 = (std::list< Data > *)(argp3);
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ *p_result = jsresult;
+ return SWIG_OK;
+
+ goto fail;
+fail:
+ return SWIG_TypeError;
+}
+
+
+static int _wrap_Event_getParam__SWIG_3(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception, JSValueRef* p_result)
+{
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ bool *arg3 = 0 ;
+ void *argp1 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ bool result;
+
+ JSValueRef jsresult;
+
+ if(argc != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_getParam__SWIG_3.");
+
+ res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ arg1 = (uscxml::Event::params_t *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(argv[1], &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ res3 = SWIG_ConvertPtr(argv[2], &argp3, SWIGTYPE_p_bool, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_getParam" "', argument " "3"" of type '" "bool &""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "3"" of type '" "bool &""'");
+ }
+ arg3 = (bool *)(argp3);
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ jsresult = SWIG_From_bool SWIG_JSC_FROM_CALL_ARGS((bool)(result));
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ *p_result = jsresult;
+ return SWIG_OK;
+
+ goto fail;
+fail:
+ return SWIG_TypeError;
+}
+
+
+static JSValueRef _wrap_Event__wrap_Event_getParam(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSValueRef jsresult;
+ int res;
+
+ if(argc == 3) {
+ res = _wrap_Event_getParam__SWIG_0(context, function, thisObject, argc, argv, exception, &jsresult);
+ if(res == SWIG_OK) {
+ *exception = 0; return jsresult;
+ }
+ }
+
+ if(argc == 3) {
+ res = _wrap_Event_getParam__SWIG_1(context, function, thisObject, argc, argv, exception, &jsresult);
+ if(res == SWIG_OK) {
+ *exception = 0; return jsresult;
+ }
+ }
+
+ if(argc == 3) {
+ res = _wrap_Event_getParam__SWIG_3(context, function, thisObject, argc, argv, exception, &jsresult);
+ if(res == SWIG_OK) {
+ *exception = 0; return jsresult;
+ }
+ }
+
+
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for function getParam.");
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_Event_raw_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_raw_set" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(value, &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_raw_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_raw_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ if (arg1) (arg1)->raw = *arg2;
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_Event_raw_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ std::string *result = 0 ;
+
+ JSValueRef jsresult;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_raw_get" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ result = (std::string *) & ((arg1)->raw);
+ jsresult = SWIG_From_std_string SWIG_JSC_FROM_CALL_ARGS((std::string)(*result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_Event_name_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_name_set" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(value, &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_name_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_name_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ if (arg1) (arg1)->name = *arg2;
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_Event_name_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ std::string *result = 0 ;
+
+ JSValueRef jsresult;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_name_get" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ result = (std::string *) & ((arg1)->name);
+ jsresult = SWIG_From_std_string SWIG_JSC_FROM_CALL_ARGS((std::string)(*result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static bool _wrap_Event_eventType_set(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event::Type arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_eventType_set" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_JSC_AS_CALL_ARGS(value, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_eventType_set" "', argument " "2"" of type '" "uscxml::Event::Type""'");
+ }
+ arg2 = (uscxml::Event::Type)(val2);
+ if (arg1) (arg1)->eventType = arg2;
+
+
+
+
+ return true;
+
+ goto fail;
+fail:
+ return false;
+}
+
+
+static JSValueRef _wrap_Event_eventType_get(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ uscxml::Event::Type result;
+
+ JSValueRef jsresult;
+
+ res1 = SWIG_ConvertPtr(thisObject, &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_eventType_get" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ result = (uscxml::Event::Type) ((arg1)->eventType);
+ jsresult = SWIG_From_int SWIG_JSC_FROM_CALL_ARGS((int)(result));
+
+
+ return jsresult;
+
+ goto fail;
+fail:
+ return JSValueMakeUndefined(context);
+}
+
+
+static void _wrap_delete_Event(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ uscxml::Event * arg1 = (uscxml::Event *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSStaticValue _exports_Event_staticValues[] = {
+ {
+ "INTERNAL", _wrap_uscxml_Event_INTERNAL, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "EXTERNAL", _wrap_uscxml_Event_EXTERNAL, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "PLATFORM", _wrap_uscxml_Event_PLATFORM, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_Event_staticFunctions[] = {
+ {
+ "getParam", _wrap_Event__wrap_Event_getParam, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_Event_values[] = {
+ {
+ "raw", _wrap_Event_raw_get, _wrap_Event_raw_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "name", _wrap_Event_name_get, _wrap_Event_name_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "eventType", _wrap_Event_eventType_get, _wrap_Event_eventType_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_Event_functions[] = {
+ {
+ "operator_equal_to", _wrap_Event_operator_equal_to, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "operator_not_equal_to", _wrap_Event_operator_not_equal_to, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0
+ }
+};
+
+
+static JSClassDefinition _exports_ErrorEvent_classDefinition;
+
+static JSClassDefinition _exports_ErrorEvent_objectDefinition;
+
+static JSClassRef _exports_ErrorEvent_classRef;
+
+
+static JSObjectRef _wrap_new_ErrorEvent__SWIG_0(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ uscxml::ErrorEvent *result;
+ result = (uscxml::ErrorEvent *)new uscxml::ErrorEvent();
+
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_uscxml__ErrorEvent, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_ErrorEvent__SWIG_1(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ std::string *arg1 = 0 ;
+ int res1 = SWIG_OLDOBJ ;
+ uscxml::ErrorEvent *result;
+ {
+ std::string *ptr = (std::string *)0;
+ res1 = SWIG_AsPtr_std_string SWIG_JSC_AS_CALL_ARGS(argv[0], &ptr);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ErrorEvent" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ErrorEvent" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ arg1 = ptr;
+ }
+ result = (uscxml::ErrorEvent *)new uscxml::ErrorEvent((std::string const &)*arg1);
+
+ if (SWIG_IsNewObj(res1)) delete arg1;
+
+ return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_p_uscxml__ErrorEvent, SWIG_POINTER_OWN);
+
+ goto fail;
+fail:
+ return NULL;
+}
+
+
+static JSObjectRef _wrap_new_ErrorEvent(JSContextRef context, JSObjectRef ctorObject,
+ size_t argc, const JSValueRef argv[], JSValueRef* exception)
+{
+ JSObjectRef thisObject = NULL;
+
+ // switch all cases by means of series of if-returns.
+
+ if(argc == 0) {
+ thisObject = _wrap_new_ErrorEvent__SWIG_0(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+ if(argc == 1) {
+ thisObject = _wrap_new_ErrorEvent__SWIG_1(context, NULL, argc, argv, exception);
+ if(thisObject != NULL) {
+ *exception=0; return thisObject;
+ } /* reset exception and return */
+ }
+
+
+ // default:
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of $jsname");
+
+fail:
+ return thisObject;
+}
+
+
+static void _wrap_delete_ErrorEvent(JSObjectRef thisObject)
+{
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
+ if(t) {
+ if (t->swigCMemOwn) {
+ uscxml::ErrorEvent * arg1 = (uscxml::ErrorEvent *)t->swigCObject;
+ delete arg1;
+ }
+ /* remove the private data to make sure that it isn't accessed elsewhere */
+ JSObjectSetPrivate(thisObject, NULL);
+ free(t);
+ }
+}
+
+
+static JSStaticValue _exports_ErrorEvent_staticValues[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_ErrorEvent_staticFunctions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSStaticValue _exports_ErrorEvent_values[] = {
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction _exports_ErrorEvent_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMText(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMText *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMComment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) (XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMElementTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMElement *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMDocumentFragmentTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMDocumentFragment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMAttrTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMAttr *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMDocumentTypeTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMDocumentType *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCharacterDataTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMCharacterData *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMText *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMComment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMProcessingInstructionTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMEntityTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMEntity *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMEntityReferenceTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMEntityReference *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *)(XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMNotationTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMNotation *) x));
+}
+static void *_p_uscxml__ErrorEventTo_p_uscxml__Event(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((uscxml::Event *) ((uscxml::ErrorEvent *) x));
+}
+static swig_type_info _swigt__p_Data = {"_p_Data", "Data *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMAttr = {"_p_XERCES_CPP_NAMESPACE__DOMAttr", "XERCES_CPP_NAMESPACE::DOMAttr *|p_XERCES_CPP_NAMESPACE__DOMAttr", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection = {"_p_XERCES_CPP_NAMESPACE__DOMCDATASection", "p_XERCES_CPP_NAMESPACE__DOMCDATASection", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData = {"_p_XERCES_CPP_NAMESPACE__DOMCharacterData", "XERCES_CPP_NAMESPACE::DOMCharacterData *|p_XERCES_CPP_NAMESPACE__DOMCharacterData", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMComment = {"_p_XERCES_CPP_NAMESPACE__DOMComment", "p_XERCES_CPP_NAMESPACE__DOMComment", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocument = {"_p_XERCES_CPP_NAMESPACE__DOMDocument", "XERCES_CPP_NAMESPACE::DOMDocument *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment = {"_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment", "p_XERCES_CPP_NAMESPACE__DOMDocumentFragment", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType = {"_p_XERCES_CPP_NAMESPACE__DOMDocumentType", "XERCES_CPP_NAMESPACE::DOMDocumentType *|p_XERCES_CPP_NAMESPACE__DOMDocumentType", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMElement = {"_p_XERCES_CPP_NAMESPACE__DOMElement", "p_XERCES_CPP_NAMESPACE__DOMElement|XERCES_CPP_NAMESPACE::DOMElement *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMEntity = {"_p_XERCES_CPP_NAMESPACE__DOMEntity", "XERCES_CPP_NAMESPACE::DOMEntity *|p_XERCES_CPP_NAMESPACE__DOMEntity", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference = {"_p_XERCES_CPP_NAMESPACE__DOMEntityReference", "p_XERCES_CPP_NAMESPACE__DOMEntityReference", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMException = {"_p_XERCES_CPP_NAMESPACE__DOMException", "p_XERCES_CPP_NAMESPACE__DOMException|XERCES_CPP_NAMESPACE::DOMException *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap = {"_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap", "p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap|XERCES_CPP_NAMESPACE::DOMNamedNodeMap *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNode = {"_p_XERCES_CPP_NAMESPACE__DOMNode", "XERCES_CPP_NAMESPACE::DOMNode *|p_XERCES_CPP_NAMESPACE__DOMNode", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList = {"_p_XERCES_CPP_NAMESPACE__DOMNodeList", "p_XERCES_CPP_NAMESPACE__DOMNodeList|XERCES_CPP_NAMESPACE::DOMNodeList *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNotation = {"_p_XERCES_CPP_NAMESPACE__DOMNotation", "XERCES_CPP_NAMESPACE::DOMNotation *|p_XERCES_CPP_NAMESPACE__DOMNotation", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction = {"_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction", "XERCES_CPP_NAMESPACE::DOMProcessingInstruction *|p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMText = {"_p_XERCES_CPP_NAMESPACE__DOMText", "XERCES_CPP_NAMESPACE::DOMText *|p_XERCES_CPP_NAMESPACE__DOMText", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo = {"_p_XERCES_CPP_NAMESPACE__DOMTypeInfo", "XERCES_CPP_NAMESPACE::DOMTypeInfo *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler = {"_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler", "XERCES_CPP_NAMESPACE::DOMUserDataHandler *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__MemoryManager = {"_p_XERCES_CPP_NAMESPACE__MemoryManager", "XERCES_CPP_NAMESPACE::MemoryManager *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_bool = {"_p_bool", "bool *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int16_t = {"_p_int16_t", "XMLInt16 *|int16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int32_t = {"_p_int32_t", "int32_t *|XMLInt32 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int64_t = {"_p_int64_t", "int64_t *|XMLInt64 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_namelist_t = {"_p_namelist_t", "namelist_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_params_t = {"_p_params_t", "params_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *|XMLSize_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ssize_t = {"_p_ssize_t", "ssize_t *|XMLSSize_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__listT_Data_t = {"_p_std__listT_Data_t", "std::list< Data > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__multimapT_std__string_Data_t = {"_p_std__multimapT_std__string_Data_t", "uscxml::Event::params_t *|std::multimap< std::string,Data > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint16_t = {"_p_uint16_t", "XMLUInt16 *|UTF16Ch *|XMLCh *|uint16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *|XMLUInt32 *|UCS4Ch *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint64_t = {"_p_uint64_t", "uint64_t *|XMLUInt64 *|XMLFilePos *|XMLFileLoc *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|XMLByte *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uscxml__ErrorEvent = {"_p_uscxml__ErrorEvent", "p_uscxml__ErrorEvent", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uscxml__Event = {"_p_uscxml__Event", "uscxml::Event *|p_uscxml__Event", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_Data,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMComment,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocument,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMElement,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMException,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNode,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMText,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,
+ &_swigt__p_XERCES_CPP_NAMESPACE__MemoryManager,
+ &_swigt__p_bool,
+ &_swigt__p_char,
+ &_swigt__p_int16_t,
+ &_swigt__p_int32_t,
+ &_swigt__p_int64_t,
+ &_swigt__p_namelist_t,
+ &_swigt__p_params_t,
+ &_swigt__p_size_t,
+ &_swigt__p_ssize_t,
+ &_swigt__p_std__listT_Data_t,
+ &_swigt__p_std__multimapT_std__string_Data_t,
+ &_swigt__p_uint16_t,
+ &_swigt__p_uint32_t,
+ &_swigt__p_uint64_t,
+ &_swigt__p_unsigned_char,
+ &_swigt__p_uscxml__ErrorEvent,
+ &_swigt__p_uscxml__Event,
+ &_swigt__p_void,
+};
+
+static swig_cast_info _swigc__p_Data[] = { {&_swigt__p_Data, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMAttr[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMCDATASection[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMCharacterData[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, _p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, _p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMComment[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocument[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocument, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentType[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMElement[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMElement, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMEntity[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMEntityReference[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMException[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMException, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNode[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMElement, _p_XERCES_CPP_NAMESPACE__DOMElementTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, _p_XERCES_CPP_NAMESPACE__DOMDocumentFragmentTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr, _p_XERCES_CPP_NAMESPACE__DOMAttrTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType, _p_XERCES_CPP_NAMESPACE__DOMDocumentTypeTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData, _p_XERCES_CPP_NAMESPACE__DOMCharacterDataTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, _p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, _p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, _p_XERCES_CPP_NAMESPACE__DOMProcessingInstructionTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity, _p_XERCES_CPP_NAMESPACE__DOMEntityTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference, _p_XERCES_CPP_NAMESPACE__DOMEntityReferenceTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation, _p_XERCES_CPP_NAMESPACE__DOMNotationTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNodeList[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNotation[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMText[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMText, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMTypeInfo[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__MemoryManager[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__MemoryManager, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_bool[] = { {&_swigt__p_bool, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int16_t[] = { {&_swigt__p_int16_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int32_t[] = { {&_swigt__p_int32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int64_t[] = { {&_swigt__p_int64_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_namelist_t[] = { {&_swigt__p_namelist_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_params_t[] = { {&_swigt__p_params_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_size_t[] = { {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ssize_t[] = { {&_swigt__p_ssize_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__listT_Data_t[] = { {&_swigt__p_std__listT_Data_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__multimapT_std__string_Data_t[] = { {&_swigt__p_std__multimapT_std__string_Data_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint16_t[] = { {&_swigt__p_uint16_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint64_t[] = { {&_swigt__p_uint64_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uscxml__ErrorEvent[] = { {&_swigt__p_uscxml__ErrorEvent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uscxml__Event[] = { {&_swigt__p_uscxml__Event, 0, 0, 0}, {&_swigt__p_uscxml__ErrorEvent, _p_uscxml__ErrorEventTo_p_uscxml__Event, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_Data,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMAttr,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMCDATASection,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMCharacterData,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMComment,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocument,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentType,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMElement,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMEntity,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMEntityReference,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMException,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNode,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNodeList,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNotation,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMText,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMTypeInfo,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,
+ _swigc__p_XERCES_CPP_NAMESPACE__MemoryManager,
+ _swigc__p_bool,
+ _swigc__p_char,
+ _swigc__p_int16_t,
+ _swigc__p_int32_t,
+ _swigc__p_int64_t,
+ _swigc__p_namelist_t,
+ _swigc__p_params_t,
+ _swigc__p_size_t,
+ _swigc__p_ssize_t,
+ _swigc__p_std__listT_Data_t,
+ _swigc__p_std__multimapT_std__string_Data_t,
+ _swigc__p_uint16_t,
+ _swigc__p_uint32_t,
+ _swigc__p_uint64_t,
+ _swigc__p_unsigned_char,
+ _swigc__p_uscxml__ErrorEvent,
+ _swigc__p_uscxml__Event,
+ _swigc__p_void,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+
+
+static JSStaticValue exports_values[] = {
+ {
+ "XERCES_HAS_CPP_NAMESPACE", _wrap_XERCES_HAS_CPP_NAMESPACE, JS_veto_set_variable, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DEBUG_UTF8_OUT", _wrap_DEBUG_UTF8_OUT_get, _wrap_DEBUG_UTF8_OUT_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ "DEBUG_UTF8_IN", _wrap_DEBUG_UTF8_IN_get, _wrap_DEBUG_UTF8_IN_set, kJSPropertyAttributeNone
+ },
+
+
+ {
+ 0, 0, 0, 0
+ }
+};
+
+static JSStaticFunction exports_functions[] = {
+ {
+ 0, 0, 0
+ }
+};
+
+static JSClassDefinition exports_classDefinition;
+static JSObjectRef exports_object;
+
+
+SWIGRUNTIME void
+SWIG_JSC_SetModule(swig_module_info *swig_module) {}
+
+SWIGRUNTIME swig_module_info *
+SWIG_JSC_GetModule(void) {
+ return 0;
+}
+
+#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule()
+#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(pointer)
+
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned statically to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ * 1) If the cast->type has already been loaded AND the type we are adding
+ * casting info to has not been loaded (it is in this module), THEN we
+ * replace the cast->type pointer with the type pointer that has already
+ * been loaded.
+ * 2) If BOTH types (the one we are adding casting info to, and the
+ * cast->type) are loaded, THEN the cast info has already been loaded by
+ * the previous module so we just ignore it.
+ * 3) Finally, if cast->type has not already been loaded, then we add that
+ * swig_cast_info to the linked list (because the cast->type) pointer will
+ * be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int init;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
+
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ /* Our module is already in the list, so there's nothing more to do. */
+ return;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* otherwise we must add our module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
+
+ /* When multiple interpreters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
+ /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+
+ /* Don't need to add information already in the list */
+ ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+ if (!ocast) ret = 0;
+ }
+ }
+
+ if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n",j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types. It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run) return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool SWIGJSC_INIT (JSGlobalContextRef context, JSObjectRef *exports) {
+ SWIG_InitializeModule(0);
+
+
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->dcast = (swig_dycast_func) DOMNode_dynamic_cast;
+
+
+/* Initialize the base swig type object */
+_SwigObject_objectDefinition.staticFunctions = _SwigObject_functions;
+_SwigObject_objectDefinition.staticValues = _SwigObject_values;
+_SwigObject_classRef = JSClassCreate(&_SwigObject_objectDefinition);
+
+/* Initialize the PackedData class */
+_SwigPackedData_objectDefinition.staticFunctions = _SwigPackedData_functions;
+_SwigPackedData_objectDefinition.staticValues = _SwigPackedData_values;
+_SwigPackedData_objectDefinition.finalize = _wrap_SwigPackedData_delete;
+_SwigPackedData_classRef = JSClassCreate(&_SwigPackedData_objectDefinition);
+
+/* Create objects for namespaces */
+
+exports_classDefinition.staticFunctions = exports_functions;
+exports_classDefinition.staticValues = exports_values;
+exports_object = JSObjectMake(context, JSClassCreate(&exports_classDefinition), NULL);
+
+
+/* Register classes */
+
+_exports_DOMException_classDefinition.staticFunctions = _exports_DOMException_staticFunctions;
+_exports_DOMException_classDefinition.staticValues = _exports_DOMException_staticValues;
+_exports_DOMException_classDefinition.callAsConstructor = _wrap_new_DOMException;
+_exports_DOMException_objectDefinition.finalize = _wrap_delete_DOMException;
+_exports_DOMException_objectDefinition.staticValues = _exports_DOMException_values;
+_exports_DOMException_objectDefinition.staticFunctions = _exports_DOMException_functions;
+
+_exports_DOMException_objectDefinition.parentClass = _SwigObject_classRef;
+
+
+_exports_DOMException_classRef = JSClassCreate(&_exports_DOMException_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException->clientdata = _exports_DOMException_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMException", &_exports_DOMException_classDefinition);
+
+
+_exports_DOMNode_classDefinition.staticFunctions = _exports_DOMNode_staticFunctions;
+_exports_DOMNode_classDefinition.staticValues = _exports_DOMNode_staticValues;
+_exports_DOMNode_classDefinition.callAsConstructor = _wrap_new_veto_DOMNode;
+_exports_DOMNode_objectDefinition.finalize = _wrap_delete_DOMNode;
+_exports_DOMNode_objectDefinition.staticValues = _exports_DOMNode_values;
+_exports_DOMNode_objectDefinition.staticFunctions = _exports_DOMNode_functions;
+
+_exports_DOMNode_objectDefinition.parentClass = _SwigObject_classRef;
+
+
+_exports_DOMNode_classRef = JSClassCreate(&_exports_DOMNode_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata = _exports_DOMNode_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMNode", &_exports_DOMNode_classDefinition);
+
+
+_exports_DOMAttr_classDefinition.staticFunctions = _exports_DOMAttr_staticFunctions;
+_exports_DOMAttr_classDefinition.staticValues = _exports_DOMAttr_staticValues;
+_exports_DOMAttr_classDefinition.callAsConstructor = _wrap_new_veto_DOMAttr;
+_exports_DOMAttr_objectDefinition.finalize = _wrap_delete_DOMAttr;
+_exports_DOMAttr_objectDefinition.staticValues = _exports_DOMAttr_values;
+_exports_DOMAttr_objectDefinition.staticFunctions = _exports_DOMAttr_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMAttr_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMAttr_classRef = JSClassCreate(&_exports_DOMAttr_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr->clientdata = _exports_DOMAttr_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMAttr", &_exports_DOMAttr_classDefinition);
+
+
+_exports_DOMElement_classDefinition.staticFunctions = _exports_DOMElement_staticFunctions;
+_exports_DOMElement_classDefinition.staticValues = _exports_DOMElement_staticValues;
+_exports_DOMElement_classDefinition.callAsConstructor = _wrap_new_veto_DOMElement;
+_exports_DOMElement_objectDefinition.finalize = _wrap_delete_DOMElement;
+_exports_DOMElement_objectDefinition.staticValues = _exports_DOMElement_values;
+_exports_DOMElement_objectDefinition.staticFunctions = _exports_DOMElement_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMElement_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMElement_classRef = JSClassCreate(&_exports_DOMElement_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement->clientdata = _exports_DOMElement_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMElement", &_exports_DOMElement_classDefinition);
+
+
+_exports_DOMEntity_classDefinition.staticFunctions = _exports_DOMEntity_staticFunctions;
+_exports_DOMEntity_classDefinition.staticValues = _exports_DOMEntity_staticValues;
+_exports_DOMEntity_classDefinition.callAsConstructor = _wrap_new_veto_DOMEntity;
+_exports_DOMEntity_objectDefinition.finalize = _wrap_delete_DOMEntity;
+_exports_DOMEntity_objectDefinition.staticValues = _exports_DOMEntity_values;
+_exports_DOMEntity_objectDefinition.staticFunctions = _exports_DOMEntity_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMEntity_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMEntity_classRef = JSClassCreate(&_exports_DOMEntity_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity->clientdata = _exports_DOMEntity_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMEntity", &_exports_DOMEntity_classDefinition);
+
+
+_exports_DOMDocumentType_classDefinition.staticFunctions = _exports_DOMDocumentType_staticFunctions;
+_exports_DOMDocumentType_classDefinition.staticValues = _exports_DOMDocumentType_staticValues;
+_exports_DOMDocumentType_classDefinition.callAsConstructor = _wrap_new_veto_DOMDocumentType;
+_exports_DOMDocumentType_objectDefinition.finalize = _wrap_delete_DOMDocumentType;
+_exports_DOMDocumentType_objectDefinition.staticValues = _exports_DOMDocumentType_values;
+_exports_DOMDocumentType_objectDefinition.staticFunctions = _exports_DOMDocumentType_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMDocumentType_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMDocumentType_classRef = JSClassCreate(&_exports_DOMDocumentType_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType->clientdata = _exports_DOMDocumentType_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMDocumentType", &_exports_DOMDocumentType_classDefinition);
+
+
+_exports_DOMCharacterData_classDefinition.staticFunctions = _exports_DOMCharacterData_staticFunctions;
+_exports_DOMCharacterData_classDefinition.staticValues = _exports_DOMCharacterData_staticValues;
+_exports_DOMCharacterData_classDefinition.callAsConstructor = _wrap_new_veto_DOMCharacterData;
+_exports_DOMCharacterData_objectDefinition.finalize = _wrap_delete_DOMCharacterData;
+_exports_DOMCharacterData_objectDefinition.staticValues = _exports_DOMCharacterData_values;
+_exports_DOMCharacterData_objectDefinition.staticFunctions = _exports_DOMCharacterData_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMCharacterData_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMCharacterData_classRef = JSClassCreate(&_exports_DOMCharacterData_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata = _exports_DOMCharacterData_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMCharacterData", &_exports_DOMCharacterData_classDefinition);
+
+
+_exports_DOMComment_classDefinition.staticFunctions = _exports_DOMComment_staticFunctions;
+_exports_DOMComment_classDefinition.staticValues = _exports_DOMComment_staticValues;
+_exports_DOMComment_classDefinition.callAsConstructor = _wrap_new_veto_DOMComment;
+_exports_DOMComment_objectDefinition.finalize = _wrap_delete_DOMComment;
+_exports_DOMComment_objectDefinition.staticValues = _exports_DOMComment_values;
+_exports_DOMComment_objectDefinition.staticFunctions = _exports_DOMComment_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData != NULL) {
+ _exports_DOMComment_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata;
+}
+
+
+_exports_DOMComment_classRef = JSClassCreate(&_exports_DOMComment_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment->clientdata = _exports_DOMComment_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMComment", &_exports_DOMComment_classDefinition);
+
+
+_exports_DOMText_classDefinition.staticFunctions = _exports_DOMText_staticFunctions;
+_exports_DOMText_classDefinition.staticValues = _exports_DOMText_staticValues;
+_exports_DOMText_classDefinition.callAsConstructor = _wrap_new_veto_DOMText;
+_exports_DOMText_objectDefinition.finalize = _wrap_delete_DOMText;
+_exports_DOMText_objectDefinition.staticValues = _exports_DOMText_values;
+_exports_DOMText_objectDefinition.staticFunctions = _exports_DOMText_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData != NULL) {
+ _exports_DOMText_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata;
+}
+
+
+_exports_DOMText_classRef = JSClassCreate(&_exports_DOMText_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata = _exports_DOMText_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMText", &_exports_DOMText_classDefinition);
+
+
+_exports_DOMCDATASection_classDefinition.staticFunctions = _exports_DOMCDATASection_staticFunctions;
+_exports_DOMCDATASection_classDefinition.staticValues = _exports_DOMCDATASection_staticValues;
+_exports_DOMCDATASection_classDefinition.callAsConstructor = _wrap_new_veto_DOMCDATASection;
+_exports_DOMCDATASection_objectDefinition.finalize = _wrap_delete_DOMCDATASection;
+_exports_DOMCDATASection_objectDefinition.staticValues = _exports_DOMCDATASection_values;
+_exports_DOMCDATASection_objectDefinition.staticFunctions = _exports_DOMCDATASection_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText != NULL) {
+ _exports_DOMCDATASection_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata;
+}
+
+
+_exports_DOMCDATASection_classRef = JSClassCreate(&_exports_DOMCDATASection_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection->clientdata = _exports_DOMCDATASection_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMCDATASection", &_exports_DOMCDATASection_classDefinition);
+
+
+_exports_DOMNodeList_classDefinition.staticFunctions = _exports_DOMNodeList_staticFunctions;
+_exports_DOMNodeList_classDefinition.staticValues = _exports_DOMNodeList_staticValues;
+_exports_DOMNodeList_classDefinition.callAsConstructor = _wrap_new_veto_DOMNodeList;
+_exports_DOMNodeList_objectDefinition.finalize = _wrap_delete_DOMNodeList;
+_exports_DOMNodeList_objectDefinition.staticValues = _exports_DOMNodeList_values;
+_exports_DOMNodeList_objectDefinition.staticFunctions = _exports_DOMNodeList_functions;
+
+_exports_DOMNodeList_objectDefinition.parentClass = _SwigObject_classRef;
+
+
+_exports_DOMNodeList_classRef = JSClassCreate(&_exports_DOMNodeList_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList->clientdata = _exports_DOMNodeList_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMNodeList", &_exports_DOMNodeList_classDefinition);
+
+
+_exports_DOMNamedNodeMap_classDefinition.staticFunctions = _exports_DOMNamedNodeMap_staticFunctions;
+_exports_DOMNamedNodeMap_classDefinition.staticValues = _exports_DOMNamedNodeMap_staticValues;
+_exports_DOMNamedNodeMap_classDefinition.callAsConstructor = _wrap_new_veto_DOMNamedNodeMap;
+_exports_DOMNamedNodeMap_objectDefinition.finalize = _wrap_delete_DOMNamedNodeMap;
+_exports_DOMNamedNodeMap_objectDefinition.staticValues = _exports_DOMNamedNodeMap_values;
+_exports_DOMNamedNodeMap_objectDefinition.staticFunctions = _exports_DOMNamedNodeMap_functions;
+
+_exports_DOMNamedNodeMap_objectDefinition.parentClass = _SwigObject_classRef;
+
+
+_exports_DOMNamedNodeMap_classRef = JSClassCreate(&_exports_DOMNamedNodeMap_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap->clientdata = _exports_DOMNamedNodeMap_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMNamedNodeMap", &_exports_DOMNamedNodeMap_classDefinition);
+
+
+_exports_DOMDocumentFragment_classDefinition.staticFunctions = _exports_DOMDocumentFragment_staticFunctions;
+_exports_DOMDocumentFragment_classDefinition.staticValues = _exports_DOMDocumentFragment_staticValues;
+_exports_DOMDocumentFragment_classDefinition.callAsConstructor = _wrap_new_veto_DOMDocumentFragment;
+_exports_DOMDocumentFragment_objectDefinition.finalize = _wrap_delete_DOMDocumentFragment;
+_exports_DOMDocumentFragment_objectDefinition.staticValues = _exports_DOMDocumentFragment_values;
+_exports_DOMDocumentFragment_objectDefinition.staticFunctions = _exports_DOMDocumentFragment_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMDocumentFragment_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMDocumentFragment_classRef = JSClassCreate(&_exports_DOMDocumentFragment_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment->clientdata = _exports_DOMDocumentFragment_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMDocumentFragment", &_exports_DOMDocumentFragment_classDefinition);
+
+
+_exports_DOMEntityReference_classDefinition.staticFunctions = _exports_DOMEntityReference_staticFunctions;
+_exports_DOMEntityReference_classDefinition.staticValues = _exports_DOMEntityReference_staticValues;
+_exports_DOMEntityReference_classDefinition.callAsConstructor = _wrap_new_veto_DOMEntityReference;
+_exports_DOMEntityReference_objectDefinition.finalize = _wrap_delete_DOMEntityReference;
+_exports_DOMEntityReference_objectDefinition.staticValues = _exports_DOMEntityReference_values;
+_exports_DOMEntityReference_objectDefinition.staticFunctions = _exports_DOMEntityReference_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMEntityReference_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMEntityReference_classRef = JSClassCreate(&_exports_DOMEntityReference_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference->clientdata = _exports_DOMEntityReference_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMEntityReference", &_exports_DOMEntityReference_classDefinition);
+
+
+_exports_DOMNotation_classDefinition.staticFunctions = _exports_DOMNotation_staticFunctions;
+_exports_DOMNotation_classDefinition.staticValues = _exports_DOMNotation_staticValues;
+_exports_DOMNotation_classDefinition.callAsConstructor = _wrap_new_veto_DOMNotation;
+_exports_DOMNotation_objectDefinition.finalize = _wrap_delete_DOMNotation;
+_exports_DOMNotation_objectDefinition.staticValues = _exports_DOMNotation_values;
+_exports_DOMNotation_objectDefinition.staticFunctions = _exports_DOMNotation_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMNotation_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMNotation_classRef = JSClassCreate(&_exports_DOMNotation_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation->clientdata = _exports_DOMNotation_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMNotation", &_exports_DOMNotation_classDefinition);
+
+
+_exports_DOMProcessingInstruction_classDefinition.staticFunctions = _exports_DOMProcessingInstruction_staticFunctions;
+_exports_DOMProcessingInstruction_classDefinition.staticValues = _exports_DOMProcessingInstruction_staticValues;
+_exports_DOMProcessingInstruction_classDefinition.callAsConstructor = _wrap_new_veto_DOMProcessingInstruction;
+_exports_DOMProcessingInstruction_objectDefinition.finalize = _wrap_delete_DOMProcessingInstruction;
+_exports_DOMProcessingInstruction_objectDefinition.staticValues = _exports_DOMProcessingInstruction_values;
+_exports_DOMProcessingInstruction_objectDefinition.staticFunctions = _exports_DOMProcessingInstruction_functions;
+
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode != NULL) {
+ _exports_DOMProcessingInstruction_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata;
+}
+
+
+_exports_DOMProcessingInstruction_classRef = JSClassCreate(&_exports_DOMProcessingInstruction_objectDefinition);
+SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction->clientdata = _exports_DOMProcessingInstruction_classRef;
+
+
+JS_registerClass(context, exports_object, "DOMProcessingInstruction", &_exports_DOMProcessingInstruction_classDefinition);
+
+
+_exports_Event_classDefinition.staticFunctions = _exports_Event_staticFunctions;
+_exports_Event_classDefinition.staticValues = _exports_Event_staticValues;
+_exports_Event_classDefinition.callAsConstructor = _wrap_new_Event;
+_exports_Event_objectDefinition.finalize = _wrap_delete_Event;
+_exports_Event_objectDefinition.staticValues = _exports_Event_values;
+_exports_Event_objectDefinition.staticFunctions = _exports_Event_functions;
+
+_exports_Event_objectDefinition.parentClass = _SwigObject_classRef;
+
+
+_exports_Event_classRef = JSClassCreate(&_exports_Event_objectDefinition);
+SWIGTYPE_p_uscxml__Event->clientdata = _exports_Event_classRef;
+
+
+JS_registerClass(context, exports_object, "Event", &_exports_Event_classDefinition);
+
+
+_exports_ErrorEvent_classDefinition.staticFunctions = _exports_ErrorEvent_staticFunctions;
+_exports_ErrorEvent_classDefinition.staticValues = _exports_ErrorEvent_staticValues;
+_exports_ErrorEvent_classDefinition.callAsConstructor = _wrap_new_ErrorEvent;
+_exports_ErrorEvent_objectDefinition.finalize = _wrap_delete_ErrorEvent;
+_exports_ErrorEvent_objectDefinition.staticValues = _exports_ErrorEvent_values;
+_exports_ErrorEvent_objectDefinition.staticFunctions = _exports_ErrorEvent_functions;
+
+if (SWIGTYPE_p_uscxml__Event != NULL) {
+ _exports_ErrorEvent_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p_uscxml__Event->clientdata;
+}
+
+
+_exports_ErrorEvent_classRef = JSClassCreate(&_exports_ErrorEvent_objectDefinition);
+SWIGTYPE_p_uscxml__ErrorEvent->clientdata = _exports_ErrorEvent_classRef;
+
+
+JS_registerClass(context, exports_object, "ErrorEvent", &_exports_ErrorEvent_classDefinition);
+
+
+
+/* Register namespaces */
+
+
+*exports = exports_object;
+
+return true;
+}
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h
deleted file mode 100644
index 0b49c92..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCDOM_H_1RC5LCG8
-#define JSCDOM_H_1RC5LCG8
-
-#include "uscxml/InterpreterInfo.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include <XPath/XPath.hpp>
-#include "../Storage.h"
-
-#define JSC_DESTRUCTOR(type) \
-static void jsDestructor(JSObjectRef object) { \
- type* thing = static_cast<type*>(JSObjectGetPrivate(object)); \
- if (thing) {\
- delete thing->nativeObj; \
- delete thing; \
- JSObjectSetPrivate(object, NULL);\
- }\
-}
-
-#define JSC_DESTRUCTOR_KEEP_WRAPPED(type) \
-static void jsDestructor(JSObjectRef object) { \
-type* thing = static_cast<type*>(JSObjectGetPrivate(object)); \
-delete thing; \
-}
-
-namespace Arabica {
-namespace DOM {
-
-class JSCDOM {
-public:
- JSCDOM();
- virtual ~JSCDOM();
- uscxml::Storage* storage;
- uscxml::NameSpaceInfo* nsInfo;
- Arabica::XPath::XPath<std::string>* xpath;
-
-};
-
-}
-}
-
-#endif /* end of include guard: JSCDOM_H_1RC5LCG8 */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index d3eb0ef..d43efbe 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -18,55 +18,66 @@
*/
#include "uscxml/Common.h"
-#include "uscxml/config.h"
-#include "uscxml/URL.h"
+#include "uscxml/util/URL.h"
#include "uscxml/util/String.h"
#include "JSCDataModel.h"
-#include "JSCDOM.h"
-#include "dom/JSCDocument.h"
-#include "dom/JSCElement.h"
-#include "dom/JSCText.h"
-#include "dom/JSCCDATASection.h"
-#include "dom/JSCSCXMLEvent.h"
-
-#include "dom/JSCArrayBuffer.h"
-#include "dom/JSCInt8Array.h"
-#include "dom/JSCUint8Array.h"
-#include "dom/JSCUint8ClampedArray.h"
-#include "dom/JSCInt16Array.h"
-#include "dom/JSCUint16Array.h"
-#include "dom/JSCInt32Array.h"
-#include "dom/JSCUint32Array.h"
-#include "dom/JSCFloat32Array.h"
-#include "dom/JSCFloat64Array.h"
-#include "dom/JSCDataView.h"
-
-#include "uscxml/Message.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
+//#include "JSCSCXMLEvent.h"
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
+#include "uscxml/messages/Event.h"
+#include "uscxml/util/DOM.h"
+#include <easylogging++.h>
-#define TO_JSC_DOMVALUE(type) \
-struct JSC##type::JSC##type##Private* privData = new JSC##type::JSC##type##Private(); \
-privData->dom = _dom; \
-privData->nativeObj = new type<std::string>(node); \
-JSObjectRef retObj = JSObjectMake(_ctx, JSC##type::getTmpl(), privData);\
-return retObj;
+#define EVENT_STRING_OR_UNDEF(field, cond) \
+JSStringRef field##Name = JSStringCreateWithUTF8CString( #field ); \
+JSStringRef field##Val = JSStringCreateWithUTF8CString(event.field.c_str()); \
+JSObjectSetProperty(_ctx, \
+ eventObj, \
+ field##Name, \
+ (cond ? JSValueMakeString(_ctx, field##Val) : JSValueMakeUndefined(_ctx)), \
+ 0, \
+ &exception); \
+JSStringRelease(field##Name); \
+JSStringRelease(field##Val); \
+if (exception) \
+ handleException(exception);
-#define JSC_ADD_GLOBAL_OBJECT(name, constructor)\
-JSStringRef name##Name = JSStringCreateWithUTF8CString(#name);\
-JSObjectRef name = JSObjectMake(dm->_ctx, constructor, NULL);\
-JSObjectSetProperty(dm->_ctx, JSContextGetGlobalObject(dm->_ctx), name##Name, name, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);\
-JSStringRelease(name##Name);
-namespace uscxml {
+using namespace xercesc;
+
+static JSValueRef XMLString2JS(const XMLCh* input, JSContextRef context) {
+ JSValueRef output;
+
+ char* res = xercesc::XMLString::transcode(input);
+
+ JSStringRef stringRef = JSStringCreateWithUTF8CString(res);
+ output = JSValueMakeString(context, stringRef);
+ JSStringRelease(stringRef);
+
+ return output;
+}
+
+static XMLCh* JS2XMLString(JSValueRef input, JSContextRef context) {
+
+ if (!JSValueIsString(context, input))
+ return NULL;
+
+ JSValueRef exception = NULL;
+ JSStringRef stringInput = JSValueToStringCopy(context, input, &exception);
+
+ // TODO: I am leaking!
+ size_t maxSize = JSStringGetMaximumUTF8CStringSize(stringInput);
+ char* output = new char[maxSize + 1];
+
+ JSStringGetUTF8CString(stringInput, output, maxSize);
+ XMLCh* ret = xercesc::XMLString::transcode(output);
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
+ return(ret);
+}
+
+#include "JSCDOM.cpp.inc"
+
+namespace uscxml {
#ifdef BUILD_AS_PLUGINS
PLUMA_CONNECTOR
@@ -77,13 +88,10 @@ bool pluginConnect(pluma::Host& host) {
#endif
JSCDataModel::JSCDataModel() {
- _dom = NULL;
_ctx = NULL;
}
JSCDataModel::~JSCDataModel() {
- if (_dom)
- delete _dom;
if (_ctx)
JSGlobalContextRelease(_ctx);
}
@@ -159,31 +167,6 @@ JSValueRef JSCDataModel::jsExtension(JSContextRef ctx, JSObjectRef function, JSO
return JSValueMakeNull(ctx);
}
-#if 0
-typedef struct {
- int version; /* current (and only) version is 0 */
- JSClassAttributes attributes;
-
- const char* className;
- JSClassRef parentClass;
-
- const JSStaticValue* staticValues;
- const JSStaticFunction* staticFunctions;
-
- JSObjectInitializeCallback initialize;
- JSObjectFinalizeCallback finalize;
- JSObjectHasPropertyCallback hasProperty;
- JSObjectGetPropertyCallback getProperty;
- JSObjectSetPropertyCallback setProperty;
- JSObjectDeletePropertyCallback deleteProperty;
- JSObjectGetPropertyNamesCallback getPropertyNames;
- JSObjectCallAsFunctionCallback callAsFunction;
- JSObjectCallAsConstructorCallback callAsConstructor;
- JSObjectHasInstanceCallback hasInstance;
- JSObjectConvertToTypeCallback convertToType;
-} JSClassDefinition;
-#endif
-
// functions need to be objects to hold private data in JSC
JSClassDefinition JSCDataModel::jsInClassDef = { 0, 0, "In", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, jsIn, 0, 0, 0 };
JSClassDefinition JSCDataModel::jsPrintClassDef = { 0, 0, "print", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, jsPrint, 0, 0, 0 };
@@ -192,17 +175,74 @@ JSClassDefinition JSCDataModel::jsExtensionClassDef = { 0, 0, "Extension", 0, 0,
JSClassDefinition JSCDataModel::jsIOProcessorsClassDef = { 0, 0, "ioProcessors", 0, 0, 0, 0, 0, jsIOProcessorHasProp, jsIOProcessorGetProp, 0, 0, jsIOProcessorListProps, 0, 0, 0, 0 };
JSClassDefinition JSCDataModel::jsInvokersClassDef = { 0, 0, "invokers", 0, 0, 0, 0, 0, jsInvokerHasProp, jsInvokerGetProp, 0, 0, jsInvokerListProps, 0, 0, 0, 0 };
-boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterInfo* interpreter) {
- boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel());
+std::mutex JSCDataModel::_initMutex;
+
+bool JSCNodeListHasPropertyCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
+ size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+ char* propBuffer = new char[propMaxSize];
+ JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
+ std::string propName(propBuffer);
+ free(propBuffer);
+
+ std::string base = "0123456789";
+ if (propName.find_first_not_of(base) != std::string::npos) {
+ return false;
+ }
+
+ int index = strTo<int>(propName);
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(object);
+ DOMNodeList* nodeList = (DOMNodeList*)t->swigCObject;
+
+ if (nodeList->getLength() < index) {
+ return false;
+ }
+
+ return true;
+}
+
+JSValueRef JSCNodeListGetPropertyCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
+ size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+ char* propBuffer = new char[propMaxSize];
+ JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
+ std::string propName(propBuffer);
+ free(propBuffer);
+
+ std::string base = "0123456789";
+ if (propName.find_first_not_of(base) != std::string::npos) {
+ return JSValueMakeUndefined(context);
+ }
+
+ int index = strTo<int>(propName);
+ SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(object);
+ DOMNodeList* nodeList = (DOMNodeList*)t->swigCObject;
+
+ if (nodeList->getLength() < index) {
+ return JSValueMakeUndefined(context);
+ }
+
+ DOMNode* node = nodeList->item(index);
+ JSValueRef jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(node),
+ SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), 0);
+ return jsresult;
+}
+
+std::shared_ptr<DataModelImpl> JSCDataModel::create(DataModelCallbacks* callbacks) {
+ std::shared_ptr<JSCDataModel> dm(new JSCDataModel());
dm->_ctx = JSGlobalContextCreate(NULL);
- dm->_interpreter = interpreter;
+ dm->_callbacks = callbacks;
+
+ JSObjectRef exports;
- dm->_dom = new JSCDOM();
- dm->_dom->xpath = new XPath<std::string>();
- dm->_dom->xpath->setNamespaceContext(*interpreter->getNameSpaceInfo().getNSContext());
- dm->_dom->storage = new Storage(URL::getResourceDir() + PATH_SEPERATOR + interpreter->getName() + ".storage");
- dm->_dom->nsInfo = new NameSpaceInfo(interpreter->getNameSpaceInfo());
+ // register subscript operator with nodelist
+ _exports_DOMNodeList_objectDefinition.hasProperty = JSCNodeListHasPropertyCallback;
+ _exports_DOMNodeList_objectDefinition.getProperty = JSCNodeListGetPropertyCallback;
+
+ // not thread safe!
+ {
+ std::lock_guard<std::mutex> lock(_initMutex);
+ JSCDOM_initialize(dm->_ctx, &exports);
+ }
// introduce global functions as objects for private data
JSClassRef jsInClassRef = JSClassCreate(&jsInClassDef);
@@ -230,76 +270,68 @@ boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterInfo* interpret
JSStringRelease(ioProcName);
JSStringRef nameName = JSStringCreateWithUTF8CString("_name");
- JSStringRef name = JSStringCreateWithUTF8CString(dm->_interpreter->getName().c_str());
+ JSStringRef name = JSStringCreateWithUTF8CString(dm->_callbacks->getName().c_str());
JSObjectSetProperty(dm->_ctx, JSContextGetGlobalObject(dm->_ctx), nameName, JSValueMakeString(dm->_ctx, name), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(nameName);
JSStringRelease(name);
JSStringRef sessionIdName = JSStringCreateWithUTF8CString("_sessionid");
- JSStringRef sessionId = JSStringCreateWithUTF8CString(dm->_interpreter->getSessionId().c_str());
+ JSStringRef sessionId = JSStringCreateWithUTF8CString(dm->_callbacks->getSessionId().c_str());
JSObjectSetProperty(dm->_ctx, JSContextGetGlobalObject(dm->_ctx), sessionIdName, JSValueMakeString(dm->_ctx, sessionId), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
JSStringRelease(sessionIdName);
JSStringRelease(sessionId);
- JSC_ADD_GLOBAL_OBJECT(ArrayBuffer, JSCArrayBuffer::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Int8Array, JSCInt8Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Uint8Array, JSCUint8Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Uint8ClampedArray, JSCUint8ClampedArray::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Int16Array, JSCInt16Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Uint16Array, JSCUint16Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Int32Array, JSCInt32Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Uint32Array, JSCUint32Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Float32Array, JSCFloat32Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(Float64Array, JSCFloat64Array::getTmpl());
- JSC_ADD_GLOBAL_OBJECT(DataView, JSCDataView::getTmpl());
-
- JSCDocument::JSCDocumentPrivate* privData = new JSCDocument::JSCDocumentPrivate();
- if (interpreter) {
- privData->nativeObj = new Document<std::string>(interpreter->getDocument());
- privData->dom = dm->_dom;
-
- JSObjectRef documentObject = JSObjectMake(dm->_ctx, JSCDocument::getTmpl(), privData);
- JSObjectRef globalObject = JSContextGetGlobalObject(dm->_ctx);
- JSStringRef documentName = JSStringCreateWithUTF8CString("document");
-
- JSObjectSetProperty(dm->_ctx, globalObject, documentName, documentObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL);
- JSStringRelease(documentName);
- }
-
- dm->eval(Element<std::string>(), "_x = {};");
+ dm->evalAsValue("_x = {};");
return dm;
}
-void JSCDataModel::pushContext() {
-}
-
-void JSCDataModel::popContext() {
-}
-
void JSCDataModel::setEvent(const Event& event) {
- JSCSCXMLEvent::JSCSCXMLEventPrivate* privData = new JSCSCXMLEvent::JSCSCXMLEventPrivate();
- privData->nativeObj = new Event(event);
- privData->dom = _dom;
+ Event* evPtr = new Event(event);
- JSObjectRef eventObj = JSObjectMake(_ctx, JSCSCXMLEvent::getTmpl(), privData);
+ JSObjectRef eventObj = SWIG_JSC_NewPointerObj(_ctx, evPtr, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
JSObjectRef globalObject = JSContextGetGlobalObject(_ctx);
JSValueRef exception = NULL;
- if (event.raw.size() == 0) {
- std::stringstream ssRaw;
- ssRaw << event;
- privData->nativeObj->raw = ssRaw.str();
+ /* Manually handle swig ignored fields */
+ EVENT_STRING_OR_UNDEF(sendid, !event.hideSendId); // test333
+ EVENT_STRING_OR_UNDEF(origin, event.origin.size() > 0); // test335
+ EVENT_STRING_OR_UNDEF(origintype, event.origintype.size() > 0); // test337
+ EVENT_STRING_OR_UNDEF(invokeid, event.invokeid.size() > 0); // test339
+
+ /* Manually handle swig ignored event type */
+ JSStringRef eventTypeName = JSStringCreateWithUTF8CString("type");
+ JSStringRef eventTypeVal;
+
+ // test 331
+ switch (event.eventType) {
+ case Event::EXTERNAL:
+ eventTypeVal = JSStringCreateWithUTF8CString("external");
+ break;
+ case Event::INTERNAL:
+ eventTypeVal = JSStringCreateWithUTF8CString("internal");
+ break;
+ case Event::PLATFORM:
+ eventTypeVal = JSStringCreateWithUTF8CString("platform");
+ break;
}
- if (event.dom) {
+ JSObjectSetProperty(_ctx, eventObj, eventTypeName, JSValueMakeString(_ctx, eventTypeVal), 0, &exception);
+ if (exception)
+ handleException(exception);
+
+ JSStringRelease(eventTypeName);
+ JSStringRelease(eventTypeVal);
+
+ /* Manually handle swig ignored event data */
+ if (event.data.node) {
JSStringRef propName = JSStringCreateWithUTF8CString("data");
- JSObjectSetProperty(_ctx, eventObj, propName, getNodeAsValue(event.dom), 0, &exception);
+ JSObjectSetProperty(_ctx, eventObj, propName, getNodeAsValue(event.data.node), 0, &exception);
JSStringRelease(propName);
if (exception)
handleException(exception);
-
+#if 0
} else if (event.content.length() > 0) {
// _event.data is a string or JSON
Data json = Data::fromJSON(event.content);
@@ -319,6 +351,7 @@ void JSCDataModel::setEvent(const Event& event) {
if (exception)
handleException(exception);
}
+#endif
} else {
// _event.data is KVP
Event eventCopy(event);
@@ -359,22 +392,21 @@ void JSCDataModel::setEvent(const Event& event) {
}
-Data JSCDataModel::getStringAsData(const std::string& content) {
+Data JSCDataModel::evalAsData(const std::string& content) {
JSValueRef result = evalAsValue(content);
- Data data = getValueAsData(result);
- return data;
+ return getValueAsData(result);
+}
+
+Data JSCDataModel::getAsData(const std::string& content) {
+ // parse as JSON test 578
+ return Data::fromJSON(content);
}
JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
JSValueRef exception = NULL;
if (data.node) {
- JSCNode::JSCNodePrivate* privData = new JSCNode::JSCNodePrivate();
- privData->nativeObj = new Node<std::string>(data.node);
- privData->dom = _dom;
-
- JSObjectRef value = JSObjectMake(_ctx, JSCNode::getTmpl(), privData);
- return value;
+ return getNodeAsValue(data.node);
}
if (data.compound.size() > 0) {
JSObjectRef value = JSObjectMake(_ctx, 0, 0);
@@ -417,16 +449,16 @@ JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
}
}
}
- if (data.binary) {
- uscxml::ArrayBuffer* localInstance = new uscxml::ArrayBuffer(data.binary);
-
- JSClassRef retClass = JSCArrayBuffer::getTmpl();
- struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(_ctx, retClass, retPrivData);
- return retObj;
- }
+// if (data.binary) {
+// uscxml::ArrayBuffer* localInstance = new uscxml::ArrayBuffer(data.binary);
+//
+// JSClassRef retClass = JSCArrayBuffer::getTmpl();
+// struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
+// retPrivData->nativeObj = localInstance;
+//
+// JSObjectRef retObj = JSObjectMake(_ctx, retClass, retPrivData);
+// return retObj;
+// }
return JSValueMakeUndefined(_ctx);
}
@@ -466,15 +498,18 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
JSObjectRef objValue = JSValueToObject(_ctx, value, &exception);
if (exception)
handleException(exception);
- if (JSValueIsObjectOfClass(_ctx, value, JSCArrayBuffer::getTmpl())) {
- // binary data
- JSCArrayBuffer::JSCArrayBufferPrivate* privObj = (JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(objValue);
- data.binary = privObj->nativeObj->_blob;
- return data;
- } else if (JSValueIsObjectOfClass(_ctx, value, JSCNode::getTmpl())) {
+// if (JSValueIsObjectOfClass(_ctx, value, JSCArrayBuffer::getTmpl())) {
+// // binary data
+// JSCArrayBuffer::JSCArrayBufferPrivate* privObj = (JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(objValue);
+// data.binary = privObj->nativeObj->_blob;
+// return data;
+// } else
+
+ if (JSValueIsObjectOfClass(_ctx, value, _exports_DOMNode_classRef)) {
// dom node
- JSCNode::JSCNodePrivate* privObj = (JSCNode::JSCNodePrivate*)JSObjectGetPrivate(objValue);
- data.node = *privObj->nativeObj;
+ void* privData = NULL;
+ SWIG_JSC_ConvertPtr(_ctx, value, &privData, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0);
+ data.node = (xercesc::DOMNode*)privData;
return data;
}
std::set<std::string> propertySet;
@@ -518,10 +553,6 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
return data;
}
-bool JSCDataModel::validate(const std::string& location, const std::string& schema) {
- return true;
-}
-
uint32_t JSCDataModel::getLength(const std::string& expr) {
JSValueRef result;
@@ -558,10 +589,12 @@ void JSCDataModel::setForeach(const std::string& item,
}
}
+#if 0
bool JSCDataModel::isLocation(const std::string& expr) {
// location needs to be LHS and ++ is only valid for LHS
return isValidSyntax(expr + "++");
}
+#endif
bool JSCDataModel::isValidSyntax(const std::string& expr) {
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
@@ -587,34 +620,11 @@ bool JSCDataModel::isDeclared(const std::string& expr) {
return true;
}
-void JSCDataModel::eval(const Element<std::string>& scriptElem,
- const std::string& expr) {
- evalAsValue(expr);
-}
-
-bool JSCDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
+bool JSCDataModel::evalAsBool(const std::string& expr) {
JSValueRef result = evalAsValue(expr);
return JSValueToBoolean(_ctx, result);
}
-std::string JSCDataModel::evalAsString(const std::string& expr) {
- JSValueRef result = evalAsValue(expr);
- JSValueRef exception = NULL;
-
- JSStringRef stringValue = JSValueToStringCopy( _ctx, result, &exception);
- if (exception)
- handleException(exception);
-
- size_t maxSize = JSStringGetMaximumUTF8CStringSize(stringValue);
- char data[maxSize];
- JSStringGetUTF8CString(stringValue, data, maxSize);
- std::string retString(data);
-
- JSStringRelease(stringValue);
-
- return retString;
-}
-
JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
@@ -627,24 +637,27 @@ JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
return result;
}
-JSValueRef JSCDataModel::getNodeAsValue(const Node<std::string>& node) {
- switch (node.getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- TO_JSC_DOMVALUE(Element);
- }
- case Node_base::TEXT_NODE: {
- TO_JSC_DOMVALUE(Text);
- }
- case Node_base::CDATA_SECTION_NODE: {
- TO_JSC_DOMVALUE(CDATASection);
- }
- case Node_base::DOCUMENT_NODE: {
- TO_JSC_DOMVALUE(Document);
- }
- default: {
- TO_JSC_DOMVALUE(Node);
- }
- }
+JSValueRef JSCDataModel::getNodeAsValue(const DOMNode* node) {
+ return SWIG_JSC_NewPointerObj(_ctx,
+ (void*)node,
+ SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,
+ SWIG_as_voidptrptr(&node)),
+ 0);
+
+// switch (node->getNodeType()) {
+// case DOMNode::ELEMENT_NODE:
+// return SWIG_JSC_NewPointerObj(_ctx, (void*)node, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0);
+// break;
+//
+// case DOMNode::COMMENT_NODE:
+// return SWIG_JSC_NewPointerObj(_ctx, (void*)node, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment, 0);
+// break;
+//
+// // TODO: We need to dispatch more types here!
+// default:
+// return SWIG_JSC_NewPointerObj(_ctx, (void*)node, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0);
+// break;
+// }
}
void JSCDataModel::assign(const std::string& location, const Data& data) {
@@ -669,7 +682,7 @@ void JSCDataModel::assign(const std::string& location, const Data& data) {
}
/**
- * test157: We need to evluate, as this will not throw for 'continue' = Var[5] in
+ * test157: We need to evaluate, as this will not throw for 'continue' = Var[5] in
*/
// JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), JSStringCreateWithUTF8CString(location.c_str()), getDataAsValue(data), 0, &exception);
@@ -677,66 +690,10 @@ void JSCDataModel::assign(const std::string& location, const Data& data) {
handleException(exception);
}
-void JSCDataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
- std::string key;
- if (HAS_ATTR(assignElem, "id")) {
- key = ATTR(assignElem, "id");
- } else if (HAS_ATTR(assignElem, "location")) {
- key = ATTR(assignElem, "location");
- }
- if (key.length() == 0) {
- ERROR_EXECUTION_THROW("Assign element has neither id nor location");
- }
-
- if (HAS_ATTR(assignElem, "expr")) {
- assign(key, Data(ATTR(assignElem, "expr"), Data::INTERPRETED));
- } else if (node) {
- Data d;
- d.node = node;
- assign(key, d);
- } else if (content.size() > 0) {
- try {
- Data d = Data::fromJSON(content);
- if (d.empty())
- throw Event();
- assign(key, Data(d, Data::INTERPRETED));
- } catch (Event e) {
- assign(key, Data("\"" + spaceNormalize(content) + "\"", Data::INTERPRETED));
- }
- } else {
- JSValueRef exception = NULL;
- JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), JSStringCreateWithUTF8CString(key.c_str()), JSValueMakeUndefined(_ctx), 0, &exception);
- if (exception)
- handleException(exception);
- }
-}
-
-void JSCDataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& node,
- const std::string& content) {
- try {
- assign(dataElem, node, content);
- } catch (Event e) {
- // test 277
- std::string key;
- if (HAS_ATTR(dataElem, "id")) {
- key = ATTR(dataElem, "id");
- } else if (HAS_ATTR(dataElem, "location")) {
- key = ATTR(dataElem, "location");
- }
- if (key.size() > 0) {
- evalAsValue(key + " = undefined", true);
- }
- throw e;
- }
-}
-
void JSCDataModel::init(const std::string& location, const Data& data) {
try {
assign(location, data);
- } catch (Event e) {
+ } catch (ErrorEvent e) {
// test 277
evalAsValue(location + " = undefined", true);
throw e;
@@ -814,7 +771,7 @@ JSValueRef JSCDataModel::jsIn(JSContextRef ctx, JSObjectRef function, JSObjectRe
std::string stateName(buffer);
free(buffer);
- if (INSTANCE->_interpreter->isInState(stateName)) {
+ if (INSTANCE->_callbacks->isInState(stateName)) {
continue;
}
}
@@ -826,7 +783,7 @@ JSValueRef JSCDataModel::jsIn(JSContextRef ctx, JSObjectRef function, JSObjectRe
bool JSCDataModel::jsIOProcessorHasProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(object);
- std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_interpreter->getIOProcessors();
+ std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_callbacks->getIOProcessors();
size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
char buffer[maxSize];
@@ -838,7 +795,7 @@ bool JSCDataModel::jsIOProcessorHasProp(JSContextRef ctx, JSObjectRef object, JS
JSValueRef JSCDataModel::jsIOProcessorGetProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(object);
- std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_interpreter->getIOProcessors();
+ std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_callbacks->getIOProcessors();
size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
char buffer[maxSize];
@@ -853,7 +810,7 @@ JSValueRef JSCDataModel::jsIOProcessorGetProp(JSContextRef ctx, JSObjectRef obje
void JSCDataModel::jsIOProcessorListProps(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) {
JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(object);
- std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_interpreter->getIOProcessors();
+ std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_callbacks->getIOProcessors();
std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcessors.begin();
while(ioProcIter != ioProcessors.end()) {
@@ -866,7 +823,7 @@ void JSCDataModel::jsIOProcessorListProps(JSContextRef ctx, JSObjectRef object,
bool JSCDataModel::jsInvokerHasProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(object);
- std::map<std::string, Invoker> invokers = INSTANCE->_interpreter->getInvokers();
+ std::map<std::string, Invoker> invokers = INSTANCE->_callbacks->getInvokers();
size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
char buffer[maxSize];
@@ -878,7 +835,7 @@ bool JSCDataModel::jsInvokerHasProp(JSContextRef ctx, JSObjectRef object, JSStri
JSValueRef JSCDataModel::jsInvokerGetProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(object);
- std::map<std::string, Invoker> invokers = INSTANCE->_interpreter->getInvokers();
+ std::map<std::string, Invoker> invokers = INSTANCE->_callbacks->getInvokers();
size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
char buffer[maxSize];
@@ -893,7 +850,7 @@ JSValueRef JSCDataModel::jsInvokerGetProp(JSContextRef ctx, JSObjectRef object,
void JSCDataModel::jsInvokerListProps(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) {
JSCDataModel* INSTANCE = (JSCDataModel*)JSObjectGetPrivate(object);
- std::map<std::string, Invoker> invokers = INSTANCE->_interpreter->getInvokers();
+ std::map<std::string, Invoker> invokers = INSTANCE->_callbacks->getInvokers();
std::map<std::string, Invoker>::const_iterator invokerIter = invokers.begin();
while(invokerIter != invokers.end()) {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
index ccadc79..55e5c1f 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
@@ -20,11 +20,10 @@
#ifndef JSCDATAMODEL_H_KN8TWG0V
#define JSCDATAMODEL_H_KN8TWG0V
-#include "uscxml/InterpreterInfo.h"
#include "uscxml/plugins/DataModel.h"
#include <list>
+#include <set>
#include <JavaScriptCore/JavaScriptCore.h>
-#include "JSCDOM.h"
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
@@ -41,7 +40,7 @@ class JSCDataModel : public DataModelImpl {
public:
JSCDataModel();
virtual ~JSCDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
+ virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* callbacks);
virtual void addExtension(DataModelExtension* ext);
@@ -51,12 +50,9 @@ public:
return names;
}
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
virtual bool isValidSyntax(const std::string& expr);
virtual void setEvent(const Event& event);
- virtual Data getStringAsData(const std::string& content);
// foreach
virtual uint32_t getLength(const std::string& expr);
@@ -64,31 +60,19 @@ public:
const std::string& array,
const std::string& index,
uint32_t iteration);
- virtual void pushContext();
- virtual void popContext();
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
- virtual std::string evalAsString(const std::string& expr);
-
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
+ virtual Data getAsData(const std::string& content);
+ virtual Data evalAsData(const std::string& expr);
+ virtual bool evalAsBool(const std::string& expr);
virtual bool isDeclared(const std::string& expr);
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
virtual void assign(const std::string& location, const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
virtual void init(const std::string& location, const Data& data);
virtual std::string andExpressions(std::list<std::string>);
protected:
- Arabica::DOM::JSCDOM* _dom;
static JSClassDefinition jsInClassDef;
static JSValueRef jsIn(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
@@ -107,7 +91,7 @@ protected:
static JSValueRef jsInvokerGetProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
static void jsInvokerListProps(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
- JSValueRef getNodeAsValue(const Arabica::DOM::Node<std::string>& node);
+ JSValueRef getNodeAsValue(const xercesc::DOMNode* node);
JSValueRef getDataAsValue(const Data& data);
Data getValueAsData(const JSValueRef value);
JSValueRef evalAsValue(const std::string& expr, bool dontThrow = false);
@@ -122,6 +106,8 @@ protected:
Event _event;
JSGlobalContextRef _ctx;
+ static std::mutex _initMutex;
+
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/bindings.i b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/bindings.i
new file mode 100644
index 0000000..bf8a0fa
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/bindings.i
@@ -0,0 +1,46 @@
+#define XERCES_HAS_CPP_NAMESPACE 1
+
+%include <std_string.i>
+
+/*
+
+swig -I/Users/sradomski/Documents/TK/Code/uscxml2/build/cli/deps/xerces-c/include/ -javascript -jsc -c++ uscxml.i
+gcc -I/Users/sradomski/Documents/TK/Code/uscxml2/build/cli/deps/xerces-c/include/ ./uscxml_wrap.cxx
+
+*/
+
+%module JSCDOM
+
+%import "uscxml/config.h"
+%import "uscxml/Common.h"
+
+%import "xercesc/util/XercesDefs.hpp"
+%import "xercesc/util/Xerces_autoconf_config.hpp"
+
+%include "../../common/bindings/dom/ignore.i"
+%include "../../common/bindings/dom/defines.i"
+%include "../../common/bindings/dom/typemaps-general.i"
+
+// in typemap
+%typemap(in) XMLCh * %{
+ $1 = JS2XMLString($input, context);
+%}
+
+%typemap(freearg) XMLCh * %{
+ delete[] $1;
+%}
+
+// out typemap
+%typemap(out) XMLCh * %{
+ $result = XMLString2JS($1, context);
+%}
+
+
+%include "../../common/bindings/dom/dom.i"
+
+// Operators we do want
+// %rename(operator_assignment) operator=;
+%rename(operator_equal_to) operator==;
+%rename(operator_not_equal_to) operator!=;
+
+%include "../../common/bindings/event.i"
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp
deleted file mode 100644
index b6a262d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCArrayBuffer::Tmpl;
-
-JSStaticValue JSCArrayBuffer::staticValues[] = {
- { "byteLength", byteLengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "mimeType", mimeTypeAttrGetter, mimeTypeAttrSetter, kJSPropertyAttributeDontDelete },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCArrayBuffer::staticFunctions[] = {
- { "md5", md5Callback, kJSPropertyAttributeDontDelete },
- { "base64", base64Callback, kJSPropertyAttributeDontDelete },
- { "slice", sliceCallback, kJSPropertyAttributeDontDelete },
- { "isView", isViewCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCArrayBuffer::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::ArrayBuffer* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::ArrayBuffer(localLength);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for ArrayBuffer");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCArrayBuffer::getTmpl();
-
- struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCArrayBuffer::byteLengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getByteLength());
-}
-
-
-JSValueRef JSCArrayBuffer::mimeTypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getMimeType().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-bool JSCArrayBuffer::mimeTypeAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj);
-
- JSStringRef stringReflocalMimeType = JSValueToStringCopy(ctx, value, exception);
- size_t localMimeTypeMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalMimeType);
- char* localMimeTypeBuffer = new char[localMimeTypeMaxSize];
- JSStringGetUTF8CString(stringReflocalMimeType, localMimeTypeBuffer, localMimeTypeMaxSize);
- std::string localMimeType(localMimeTypeBuffer);
- JSStringRelease(stringReflocalMimeType);
- free(localMimeTypeBuffer);
-
- privData->nativeObj->setMimeType(localMimeType);
- return true;
-}
-
-JSValueRef JSCArrayBuffer::md5Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- std::string retVal = privData->nativeObj->md5();
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling md5");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCArrayBuffer::base64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- std::string retVal = privData->nativeObj->base64();
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling base64");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCArrayBuffer::sliceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localBegin = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin, localEnd));
- JSClassRef retClass = JSCArrayBuffer::getTmpl();
-
- struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localBegin = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin));
- JSClassRef retClass = JSCArrayBuffer::getTmpl();
-
- struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling slice");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCArrayBuffer::isViewCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- true) {
- void* localValue = JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception));
-
- bool retVal = privData->nativeObj->isView(localValue);
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling isView");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h
deleted file mode 100644
index cd2147f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCArrayBuffer_h
-#define JSCArrayBuffer_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCArrayBuffer {
-public:
- struct JSCArrayBufferPrivate {
- JSCDOM* dom;
- uscxml::ArrayBuffer* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCArrayBufferPrivate);
-
- static JSValueRef md5Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef base64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef sliceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef isViewCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef byteLengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef mimeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool mimeTypeAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "ArrayBuffer";
- classDef.callAsConstructor = jsConstructor;
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCArrayBuffer_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp
deleted file mode 100644
index ad567e8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCArrayBufferView::Tmpl;
-
-JSStaticValue JSCArrayBufferView::staticValues[] = {
- { "buffer", bufferAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "byteOffset", byteOffsetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "byteLength", byteLengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCArrayBufferView::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCArrayBufferView::bufferAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCArrayBufferViewPrivate* privData = (struct JSCArrayBufferViewPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getBuffer()) return JSValueMakeUndefined(ctx);
- uscxml::ArrayBuffer* arabicaRet = new uscxml::ArrayBuffer(privData->nativeObj->getBuffer());
-
- JSClassRef arbaicaRetClass = JSCArrayBuffer::getTmpl();
-
- struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCArrayBufferView::byteOffsetAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCArrayBufferViewPrivate* privData = (struct JSCArrayBufferViewPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getByteOffset());
-}
-
-
-JSValueRef JSCArrayBufferView::byteLengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCArrayBufferViewPrivate* privData = (struct JSCArrayBufferViewPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getByteLength());
-}
-
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h
deleted file mode 100644
index a6910a1..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBufferView.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCArrayBufferView_h
-#define JSCArrayBufferView_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCArrayBufferView {
-public:
- struct JSCArrayBufferViewPrivate {
- JSCDOM* dom;
- uscxml::ArrayBufferView* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCArrayBufferViewPrivate);
-
-
- static JSValueRef bufferAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef byteOffsetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef byteLengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "ArrayBufferView";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCArrayBufferView_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp
deleted file mode 100644
index 31349cb..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCAttr.h"
-#include "JSCElement.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCAttr::Tmpl;
-
-JSStaticValue JSCAttr::staticValues[] = {
- { "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "specified", specifiedAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "value", valueAttrGetter, valueAttrSetter, kJSPropertyAttributeDontDelete },
- { "ownerElement", ownerElementAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCAttr::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCAttr::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getName().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCAttr::specifiedAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeBoolean(ctx, privData->nativeObj->getSpecified());
-}
-
-
-JSValueRef JSCAttr::valueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getValue().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-bool JSCAttr::valueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(thisObj);
-
- JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, value, exception);
- size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue);
- char* localValueBuffer = new char[localValueMaxSize];
- JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, localValueMaxSize);
- std::string localValue(localValueBuffer);
- JSStringRelease(stringReflocalValue);
- free(localValueBuffer);
-
- privData->nativeObj->setValue(localValue);
- return true;
-}
-
-JSValueRef JSCAttr::ownerElementAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getOwnerElement()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Element<std::string>* arabicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
-
- JSClassRef arbaicaRetClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h
deleted file mode 100644
index adcb6bc..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCAttr_h
-#define JSCAttr_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCAttr {
-public:
- struct JSCAttrPrivate {
- JSCDOM* dom;
- Arabica::DOM::Attr<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCAttrPrivate);
-
-
- static JSValueRef nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef specifiedAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef valueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool valueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
- static JSValueRef ownerElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Attr";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCAttr_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp
deleted file mode 100644
index 3969a92..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCCDATASection.h"
-#include "JSCText.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCCDATASection::Tmpl;
-
-JSStaticValue JSCCDATASection::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCCDATASection::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h
deleted file mode 100644
index 32ef4bc..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCCDATASection_h
-#define JSCCDATASection_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCText.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCCDATASection {
-public:
- struct JSCCDATASectionPrivate {
- JSCDOM* dom;
- Arabica::DOM::CDATASection<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCCDATASectionPrivate);
-
-
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "CDATASection";
- classDef.parentClass = JSCText::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCCDATASection_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp
deleted file mode 100644
index cfb1720..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCCharacterData.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCCharacterData::Tmpl;
-
-JSStaticValue JSCCharacterData::staticValues[] = {
- { "data", dataAttrGetter, dataAttrSetter, kJSPropertyAttributeDontDelete },
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCCharacterData::staticFunctions[] = {
- { "substringData", substringDataCallback, kJSPropertyAttributeDontDelete },
- { "appendData", appendDataCallback, kJSPropertyAttributeDontDelete },
- { "insertData", insertDataCallback, kJSPropertyAttributeDontDelete },
- { "deleteData", deleteDataCallback, kJSPropertyAttributeDontDelete },
- { "replaceData", replaceDataCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCCharacterData::dataAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getData().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-bool JSCCharacterData::dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);
-
- JSStringRef stringReflocalData = JSValueToStringCopy(ctx, value, exception);
- size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
- char* localDataBuffer = new char[localDataMaxSize];
- JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
- std::string localData(localDataBuffer);
- JSStringRelease(stringReflocalData);
- free(localDataBuffer);
-
- privData->nativeObj->setData(localData);
- return true;
-}
-
-JSValueRef JSCCharacterData::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-
-JSValueRef JSCCharacterData::substringDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned long localCount = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling substringData");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCCharacterData::appendDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg);
- char* localArgBuffer = new char[localArgMaxSize];
- JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, localArgMaxSize);
- std::string localArg(localArgBuffer);
- JSStringRelease(stringReflocalArg);
- free(localArgBuffer);
-
-
- privData->nativeObj->appendData(localArg);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling appendData");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCCharacterData::insertDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg);
- char* localArgBuffer = new char[localArgMaxSize];
- JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, localArgMaxSize);
- std::string localArg(localArgBuffer);
- JSStringRelease(stringReflocalArg);
- free(localArgBuffer);
-
-
- privData->nativeObj->insertData(localOffset, localArg);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling insertData");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCCharacterData::deleteDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned long localCount = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->deleteData(localOffset, localCount);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling deleteData");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCCharacterData::replaceDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsString(ctx, arguments[2])) {
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned long localCount = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[2], exception);
- size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg);
- char* localArgBuffer = new char[localArgMaxSize];
- JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, localArgMaxSize);
- std::string localArg(localArgBuffer);
- JSStringRelease(stringReflocalArg);
- free(localArgBuffer);
-
-
- privData->nativeObj->replaceData(localOffset, localCount, localArg);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling replaceData");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h
deleted file mode 100644
index b351fa2..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCCharacterData_h
-#define JSCCharacterData_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCCharacterData {
-public:
- struct JSCCharacterDataPrivate {
- JSCDOM* dom;
- Arabica::DOM::CharacterData<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCCharacterDataPrivate);
-
- static JSValueRef substringDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef appendDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef insertDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef deleteDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef replaceDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef dataAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "CharacterData";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCCharacterData_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp
deleted file mode 100644
index c8ae170..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCCharacterData.h"
-#include "JSCComment.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCComment::Tmpl;
-
-JSStaticValue JSCComment::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCComment::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h
deleted file mode 100644
index 38a7822..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCComment_h
-#define JSCComment_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCCharacterData.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCComment {
-public:
- struct JSCCommentPrivate {
- JSCDOM* dom;
- Arabica::DOM::Comment<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCCommentPrivate);
-
-
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Comment";
- classDef.parentClass = JSCCharacterData::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCComment_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp
deleted file mode 100644
index 7bdca82..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCDOMImplementation.h"
-#include "JSCDocument.h"
-#include "JSCDocumentType.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCDOMImplementation::Tmpl;
-
-JSStaticValue JSCDOMImplementation::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCDOMImplementation::staticFunctions[] = {
- { "hasFeature", hasFeatureCallback, kJSPropertyAttributeDontDelete },
- { "createDocumentType", createDocumentTypeCallback, kJSPropertyAttributeDontDelete },
- { "createDocument", createDocumentCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCDOMImplementation::hasFeatureCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDOMImplementationPrivate* privData = (struct JSCDOMImplementationPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalFeature = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localFeatureMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalFeature);
- char* localFeatureBuffer = new char[localFeatureMaxSize];
- JSStringGetUTF8CString(stringReflocalFeature, localFeatureBuffer, localFeatureMaxSize);
- std::string localFeature(localFeatureBuffer);
- JSStringRelease(stringReflocalFeature);
- free(localFeatureBuffer);
-
- JSStringRef stringReflocalVersion = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localVersionMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalVersion);
- char* localVersionBuffer = new char[localVersionMaxSize];
- JSStringGetUTF8CString(stringReflocalVersion, localVersionBuffer, localVersionMaxSize);
- std::string localVersion(localVersionBuffer);
- JSStringRelease(stringReflocalVersion);
- free(localVersionBuffer);
-
-
- bool retVal = privData->nativeObj->hasFeature(localFeature, localVersion);
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling hasFeature");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDOMImplementation::createDocumentTypeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDOMImplementationPrivate* privData = (struct JSCDOMImplementationPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1]) &&
- JSValueIsString(ctx, arguments[2])) {
- JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName);
- char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize];
- JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, localQualifiedNameMaxSize);
- std::string localQualifiedName(localQualifiedNameBuffer);
- JSStringRelease(stringReflocalQualifiedName);
- free(localQualifiedNameBuffer);
-
- JSStringRef stringReflocalPublicId = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localPublicIdMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalPublicId);
- char* localPublicIdBuffer = new char[localPublicIdMaxSize];
- JSStringGetUTF8CString(stringReflocalPublicId, localPublicIdBuffer, localPublicIdMaxSize);
- std::string localPublicId(localPublicIdBuffer);
- JSStringRelease(stringReflocalPublicId);
- free(localPublicIdBuffer);
-
- JSStringRef stringReflocalSystemId = JSValueToStringCopy(ctx, arguments[2], exception);
- size_t localSystemIdMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalSystemId);
- char* localSystemIdBuffer = new char[localSystemIdMaxSize];
- JSStringGetUTF8CString(stringReflocalSystemId, localSystemIdBuffer, localSystemIdMaxSize);
- std::string localSystemId(localSystemIdBuffer);
- JSStringRelease(stringReflocalSystemId);
- free(localSystemIdBuffer);
-
-
- Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(localQualifiedName, localPublicId, localSystemId));
- JSClassRef retClass = JSCDocumentType::getTmpl();
-
- struct JSCDocumentType::JSCDocumentTypePrivate* retPrivData = new JSCDocumentType::JSCDocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createDocumentType");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDOMImplementation::createDocumentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDOMImplementationPrivate* privData = (struct JSCDOMImplementationPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1]) &&
- JSValueIsObject(ctx, arguments[2]) && JSValueIsObjectOfClass(ctx, arguments[2], JSCDocumentType::getTmpl())) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName);
- char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize];
- JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, localQualifiedNameMaxSize);
- std::string localQualifiedName(localQualifiedNameBuffer);
- JSStringRelease(stringReflocalQualifiedName);
- free(localQualifiedNameBuffer);
-
- Arabica::DOM::DocumentType<std::string>* localDoctype = ((struct JSCDocumentType::JSCDocumentTypePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[2], exception)))->nativeObj;
-
- Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(localNamespaceURI, localQualifiedName, *localDoctype));
- JSClassRef retClass = JSCDocument::getTmpl();
-
- struct JSCDocument::JSCDocumentPrivate* retPrivData = new JSCDocument::JSCDocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createDocument");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h
deleted file mode 100644
index 4c39d93..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCDOMImplementation_h
-#define JSCDOMImplementation_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCDOMImplementation {
-public:
- struct JSCDOMImplementationPrivate {
- JSCDOM* dom;
- Arabica::DOM::DOMImplementation<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCDOMImplementationPrivate);
-
- static JSValueRef hasFeatureCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createDocumentTypeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createDocumentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "DOMImplementation";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCDOMImplementation_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp
deleted file mode 100644
index 958a2fe..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.cpp
+++ /dev/null
@@ -1,583 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCDataView.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCDataView::Tmpl;
-
-JSStaticValue JSCDataView::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCDataView::staticFunctions[] = {
- { "getInt8", getInt8Callback, kJSPropertyAttributeDontDelete },
- { "getUint8", getUint8Callback, kJSPropertyAttributeDontDelete },
- { "getInt16", getInt16Callback, kJSPropertyAttributeDontDelete },
- { "getUint16", getUint16Callback, kJSPropertyAttributeDontDelete },
- { "getInt32", getInt32Callback, kJSPropertyAttributeDontDelete },
- { "getUint32", getUint32Callback, kJSPropertyAttributeDontDelete },
- { "getFloat32", getFloat32Callback, kJSPropertyAttributeDontDelete },
- { "getFloat64", getFloat64Callback, kJSPropertyAttributeDontDelete },
- { "setInt8", setInt8Callback, kJSPropertyAttributeDontDelete },
- { "setUint8", setUint8Callback, kJSPropertyAttributeDontDelete },
- { "setInt16", setInt16Callback, kJSPropertyAttributeDontDelete },
- { "setUint16", setUint16Callback, kJSPropertyAttributeDontDelete },
- { "setInt32", setInt32Callback, kJSPropertyAttributeDontDelete },
- { "setUint32", setUint32Callback, kJSPropertyAttributeDontDelete },
- { "setFloat32", setFloat32Callback, kJSPropertyAttributeDontDelete },
- { "setFloat64", setFloat64Callback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCDataView::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::DataView* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localByteLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::DataView(localBuffer, localByteOffset, localByteLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::DataView(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::DataView(localBuffer);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for DataView");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCDataView::getTmpl();
-
- struct JSCDataView::JSCDataViewPrivate* retPrivData = new JSCDataView::JSCDataViewPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCDataView::getInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- char retVal = privData->nativeObj->getInt8(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getInt8");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned char retVal = privData->nativeObj->getUint8(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getUint8");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]);
-
- short retVal = privData->nativeObj->getInt16(localByteOffset, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- short retVal = privData->nativeObj->getInt16(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getInt16");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]);
-
- unsigned short retVal = privData->nativeObj->getUint16(localByteOffset, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned short retVal = privData->nativeObj->getUint16(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getUint16");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]);
-
- long retVal = privData->nativeObj->getInt32(localByteOffset, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- long retVal = privData->nativeObj->getInt32(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getInt32");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]);
-
- unsigned long retVal = privData->nativeObj->getUint32(localByteOffset, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned long retVal = privData->nativeObj->getUint32(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getUint32");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]);
-
- float retVal = privData->nativeObj->getFloat32(localByteOffset, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- float retVal = privData->nativeObj->getFloat32(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getFloat32");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::getFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[1]);
-
- double retVal = privData->nativeObj->getFloat64(localByteOffset, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- double retVal = privData->nativeObj->getFloat64(localByteOffset);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getFloat64");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- char localValue = (char)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setInt8(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setInt8");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned char localValue = (unsigned char)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setUint8(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setUint8");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsBoolean(ctx, arguments[2])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- short localValue = (short)JSValueToNumber(ctx, arguments[1], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]);
-
- privData->nativeObj->setInt16(localByteOffset, localValue, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- short localValue = (short)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setInt16(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setInt16");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsBoolean(ctx, arguments[2])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned short localValue = (unsigned short)JSValueToNumber(ctx, arguments[1], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]);
-
- privData->nativeObj->setUint16(localByteOffset, localValue, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned short localValue = (unsigned short)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setUint16(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setUint16");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsBoolean(ctx, arguments[2])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- long localValue = (long)JSValueToNumber(ctx, arguments[1], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]);
-
- privData->nativeObj->setInt32(localByteOffset, localValue, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- long localValue = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setInt32(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setInt32");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsBoolean(ctx, arguments[2])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned long localValue = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]);
-
- privData->nativeObj->setUint32(localByteOffset, localValue, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned long localValue = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setUint32(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setUint32");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsBoolean(ctx, arguments[2])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- float localValue = (float)JSValueToNumber(ctx, arguments[1], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]);
-
- privData->nativeObj->setFloat32(localByteOffset, localValue, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- float localValue = (float)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setFloat32(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setFloat32");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDataView::setFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDataViewPrivate* privData = (struct JSCDataViewPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsBoolean(ctx, arguments[2])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- double localValue = (double)JSValueToNumber(ctx, arguments[1], exception);
- bool localLittleEndian = JSValueToBoolean(ctx, arguments[2]);
-
- privData->nativeObj->setFloat64(localByteOffset, localValue, localLittleEndian);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- double localValue = (double)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->setFloat64(localByteOffset, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setFloat64");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h
deleted file mode 100644
index 6593068..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDataView.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCDataView_h
-#define JSCDataView_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCDataView {
-public:
- struct JSCDataViewPrivate {
- JSCDOM* dom;
- uscxml::DataView* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCDataViewPrivate);
-
- static JSValueRef getInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setInt8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setUint8Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setInt16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setUint16Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setInt32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setUint32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setFloat32Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setFloat64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "DataView";
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCDataView_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp
deleted file mode 100644
index 795ad70..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCAttr.h"
-#include "JSCCDATASection.h"
-#include "JSCComment.h"
-#include "JSCDOMImplementation.h"
-#include "JSCDocument.h"
-#include "JSCDocumentFragment.h"
-#include "JSCDocumentType.h"
-#include "JSCElement.h"
-#include "JSCEntityReference.h"
-#include "JSCNode.h"
-#include "JSCNodeList.h"
-#include "JSCProcessingInstruction.h"
-#include "JSCText.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCDocument::Tmpl;
-
-JSStaticValue JSCDocument::staticValues[] = {
- { "doctype", doctypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "implementation", implementationAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "documentElement", documentElementAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "localStorage", localStorageCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCDocument::staticFunctions[] = {
- { "createElement", createElementCallback, kJSPropertyAttributeDontDelete },
- { "createDocumentFragment", createDocumentFragmentCallback, kJSPropertyAttributeDontDelete },
- { "createTextNode", createTextNodeCallback, kJSPropertyAttributeDontDelete },
- { "createComment", createCommentCallback, kJSPropertyAttributeDontDelete },
- { "createCDATASection", createCDATASectionCallback, kJSPropertyAttributeDontDelete },
- { "createProcessingInstruction", createProcessingInstructionCallback, kJSPropertyAttributeDontDelete },
- { "createAttribute", createAttributeCallback, kJSPropertyAttributeDontDelete },
- { "createEntityReference", createEntityReferenceCallback, kJSPropertyAttributeDontDelete },
- { "getElementsByTagName", getElementsByTagNameCallback, kJSPropertyAttributeDontDelete },
- { "importNode", importNodeCallback, kJSPropertyAttributeDontDelete },
- { "createElementNS", createElementNSCustomCallback, kJSPropertyAttributeDontDelete },
- { "createAttributeNS", createAttributeNSCustomCallback, kJSPropertyAttributeDontDelete },
- { "getElementsByTagNameNS", getElementsByTagNameNSCallback, kJSPropertyAttributeDontDelete },
- { "getElementById", getElementByIdCallback, kJSPropertyAttributeDontDelete },
- { "evaluate", evaluateCustomCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCDocument::doctypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getDoctype()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::DocumentType<std::string>* arabicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
-
- JSClassRef arbaicaRetClass = JSCDocumentType::getTmpl();
-
- struct JSCDocumentType::JSCDocumentTypePrivate* retPrivData = new JSCDocumentType::JSCDocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCDocument::implementationAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getImplementation()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::DOMImplementation<std::string>* arabicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
-
- JSClassRef arbaicaRetClass = JSCDOMImplementation::getTmpl();
-
- struct JSCDOMImplementation::JSCDOMImplementationPrivate* retPrivData = new JSCDOMImplementation::JSCDOMImplementationPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCDocument::documentElementAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getDocumentElement()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Element<std::string>* arabicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
-
- JSClassRef arbaicaRetClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCDocument::createElementCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalTagName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localTagNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalTagName);
- char* localTagNameBuffer = new char[localTagNameMaxSize];
- JSStringGetUTF8CString(stringReflocalTagName, localTagNameBuffer, localTagNameMaxSize);
- std::string localTagName(localTagNameBuffer);
- JSStringRelease(stringReflocalTagName);
- free(localTagNameBuffer);
-
-
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(localTagName));
- JSClassRef retClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createElement");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createDocumentFragmentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
- JSClassRef retClass = JSCDocumentFragment::getTmpl();
-
- struct JSCDocumentFragment::JSCDocumentFragmentPrivate* retPrivData = new JSCDocumentFragment::JSCDocumentFragmentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createDocumentFragment");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createTextNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
- char* localDataBuffer = new char[localDataMaxSize];
- JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
- std::string localData(localDataBuffer);
- JSStringRelease(stringReflocalData);
- free(localDataBuffer);
-
-
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(localData));
- JSClassRef retClass = JSCText::getTmpl();
-
- struct JSCText::JSCTextPrivate* retPrivData = new JSCText::JSCTextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createTextNode");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createCommentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
- char* localDataBuffer = new char[localDataMaxSize];
- JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
- std::string localData(localDataBuffer);
- JSStringRelease(stringReflocalData);
- free(localDataBuffer);
-
-
- Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(localData));
- JSClassRef retClass = JSCComment::getTmpl();
-
- struct JSCComment::JSCCommentPrivate* retPrivData = new JSCComment::JSCCommentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createComment");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createCDATASectionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
- char* localDataBuffer = new char[localDataMaxSize];
- JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
- std::string localData(localDataBuffer);
- JSStringRelease(stringReflocalData);
- free(localDataBuffer);
-
-
- Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(localData));
- JSClassRef retClass = JSCCDATASection::getTmpl();
-
- struct JSCCDATASection::JSCCDATASectionPrivate* retPrivData = new JSCCDATASection::JSCCDATASectionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createCDATASection");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createProcessingInstructionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalTarget = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localTargetMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalTarget);
- char* localTargetBuffer = new char[localTargetMaxSize];
- JSStringGetUTF8CString(stringReflocalTarget, localTargetBuffer, localTargetMaxSize);
- std::string localTarget(localTargetBuffer);
- JSStringRelease(stringReflocalTarget);
- free(localTargetBuffer);
-
- JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
- char* localDataBuffer = new char[localDataMaxSize];
- JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
- std::string localData(localDataBuffer);
- JSStringRelease(stringReflocalData);
- free(localDataBuffer);
-
-
- Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(localTarget, localData));
- JSClassRef retClass = JSCProcessingInstruction::getTmpl();
-
- struct JSCProcessingInstruction::JSCProcessingInstructionPrivate* retPrivData = new JSCProcessingInstruction::JSCProcessingInstructionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createProcessingInstruction");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(localName));
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createAttribute");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createEntityReferenceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(localName));
- JSClassRef retClass = JSCEntityReference::getTmpl();
-
- struct JSCEntityReference::JSCEntityReferencePrivate* retPrivData = new JSCEntityReference::JSCEntityReferencePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createEntityReference");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalTagname = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localTagnameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalTagname);
- char* localTagnameBuffer = new char[localTagnameMaxSize];
- JSStringGetUTF8CString(stringReflocalTagname, localTagnameBuffer, localTagnameMaxSize);
- std::string localTagname(localTagnameBuffer);
- JSStringRelease(stringReflocalTagname);
- free(localTagnameBuffer);
-
-
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(localTagname));
- JSClassRef retClass = JSCNodeList::getTmpl();
-
- struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getElementsByTagName");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::importNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl()) &&
- JSValueIsBoolean(ctx, arguments[1])) {
- Arabica::DOM::Node<std::string>* localImportedNode = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- bool localDeep = JSValueToBoolean(ctx, arguments[1]);
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling importNode");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(localNamespaceURI, localLocalName));
- JSClassRef retClass = JSCNodeList::getTmpl();
-
- struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getElementsByTagNameNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::getElementByIdCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalElementId = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localElementIdMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalElementId);
- char* localElementIdBuffer = new char[localElementIdMaxSize];
- JSStringGetUTF8CString(stringReflocalElementId, localElementIdBuffer, localElementIdMaxSize);
- std::string localElementId(localElementIdBuffer);
- JSStringRelease(stringReflocalElementId);
- free(localElementIdBuffer);
-
-
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(localElementId));
- JSClassRef retClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getElementById");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h
deleted file mode 100644
index 1b300fb..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCDocument_h
-#define JSCDocument_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCDocument {
-public:
- struct JSCDocumentPrivate {
- JSCDOM* dom;
- Arabica::DOM::Document<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCDocumentPrivate);
-
- static JSValueRef createElementCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createDocumentFragmentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createTextNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createCommentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createCDATASectionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createProcessingInstructionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createEntityReferenceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef importNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createElementNSCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef createAttributeNSCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getElementByIdCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef evaluateCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef doctypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef implementationAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef documentElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef localStorageCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Document";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCDocument_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
deleted file mode 100644
index a6d194f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentCustom.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCDocument.h"
-#include "JSCElement.h"
-#include "JSCAttr.h"
-#include "JSCStorage.h"
-#include "JSCXPathResult.h"
-#include "JSCNode.h"
-#include <XPath/XPath.hpp>
-#include <DOM/io/Stream.hpp>
-
-namespace Arabica {
-namespace DOM {
-
-JSValueRef JSCDocument::localStorageCustomAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->dom->storage) {
- return JSValueMakeUndefined(ctx);
- }
-
- JSClassRef retClass = JSCStorage::getTmpl();
- struct JSCStorage::JSCStoragePrivate* retPrivData = new JSCStorage::JSCStoragePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retPrivData->dom->storage;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, retClass, retPrivData);
- return arbaicaRetObj;
-
-}
-
-
-JSValueRef JSCDocument::evaluateCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->dom || !privData->dom->xpath) return JSValueMakeUndefined(ctx);
- if (argumentCount < 1) {
- std::string errorMsg = "Wrong number of arguments in evaluate";
- JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str());
- JSValueRef exceptionString = JSValueMakeString(ctx, string);
- JSStringRelease(string);
- *exception = JSValueToObject(ctx, exceptionString, NULL);
- return JSValueMakeUndefined(ctx);
- }
-
- // make sure first argument is a string
- if (!JSValueIsString(ctx, arguments[0])) {
- std::string errorMsg = "Expected xpath expression as first argument";
- JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str());
- JSValueRef exceptionString = JSValueMakeString(ctx, string);
- JSStringRelease(string);
- *exception = JSValueToObject(ctx, exceptionString, NULL);
- return JSValueMakeUndefined(ctx);
- }
-
- JSStringRef stringReflocalXPath = JSValueToStringCopy(ctx, arguments[0], NULL);
- size_t localXPathMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalXPath);
- char* localXPathBuffer = new char[localXPathMaxSize];
- JSStringGetUTF8CString(stringReflocalXPath, localXPathBuffer, localXPathMaxSize);
- std::string localXPath(localXPathBuffer);
- JSStringRelease(stringReflocalXPath);
- free(localXPathBuffer);
-
- JSClassRef arbaicaRetClass = JSCXPathResult::getTmpl();
-
- XPath::XPathValue<std::string>* retVal;
-
- try {
- if (argumentCount > 1) {
- // make sure second argument is a node
- if (!JSValueIsObject(ctx, arguments[1])) {
- std::string errorMsg = "Second argument is not of type node";
- JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str());
- JSValueRef exceptionString = JSValueMakeString(ctx, string);
- JSStringRelease(string);
- *exception = JSValueToObject(ctx, exceptionString, NULL);
- return JSValueMakeUndefined(ctx);
- }
-
-// Arabica::DOM::Node<std::string>* localContextNode = (Arabica::DOM::Node<std::string>*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], NULL));
- JSCNode::JSCNodePrivate* otherNodePrivate = (JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], NULL));
- Arabica::DOM::Node<std::string>* localContextNode = otherNodePrivate->nativeObj;
-
-// std::cout << *localContextNode << std::endl;
-// std::cout << ">>" << privData->dom->xpath->evaluate("//note/@importance", *localContextNode).asString() << "<<" << std::endl;
-
- retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(localXPath, *localContextNode));
- } else {
- retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(localXPath, *privData->nativeObj));
- }
- } catch (std::runtime_error e) {
- std::cout << e.what() << std::endl;
- return JSValueMakeUndefined(ctx);
- }
-
- struct JSCXPathResult::JSCXPathResultPrivate* retPrivData = new JSCXPathResult::JSCXPathResultPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-
-#if 0
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in evaluate");
-// if (!((V8Node::hasInstance(args[1])) && (V8XPathResult::hasInstance(args[3]))))
-// throw V8Exception("Parameter mismatch while calling evaluate");
-
- v8::Local<v8::Object> self = args.Holder();
- V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-
- v8::String::AsciiValue localExpression(args[0]);
-
- XPath::XPathValue<std::string>* retVal;
- if (args.Length() > 1) {
- Arabica::DOM::Node<std::string>* localContextNode = V8DOM::toClassPtr<Arabica::DOM::Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
- retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *localContextNode));
- } else {
- retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *privData->nativeObj));
- }
-
- v8::Handle<v8::Function> retCtor = V8XPathResult::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- V8XPathResult::V8XPathResultPrivate* retPrivData = new V8XPathResult::V8XPathResultPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8XPathResult::jsDestructor);
- return retObj;
-#endif
-}
-
-JSValueRef JSCDocument::createElementNSCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName);
- char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize];
- JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, localQualifiedNameMaxSize);
- std::string localQualifiedName(localQualifiedNameBuffer);
- JSStringRelease(stringReflocalQualifiedName);
- free(localQualifiedNameBuffer);
-
-
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(localNamespaceURI, localQualifiedName));
- if (privData->dom->nsInfo->nsToPrefix.find(localNamespaceURI) != privData->dom->nsInfo->nsToPrefix.end())
- retVal->setPrefix(privData->dom->nsInfo->nsToPrefix[localNamespaceURI]);
-
- JSClassRef retClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createElementNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCDocument::createAttributeNSCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName);
- char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize];
- JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, localQualifiedNameMaxSize);
- std::string localQualifiedName(localQualifiedNameBuffer);
- JSStringRelease(stringReflocalQualifiedName);
- free(localQualifiedNameBuffer);
-
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(localNamespaceURI, localQualifiedName));
- if (privData->dom->nsInfo->nsToPrefix.find(localNamespaceURI) != privData->dom->nsInfo->nsToPrefix.end())
- retVal->setPrefix(privData->dom->nsInfo->nsToPrefix[localNamespaceURI]);
-
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling createAttributeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp
deleted file mode 100644
index d52c923..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCDocumentFragment.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCDocumentFragment::Tmpl;
-
-JSStaticValue JSCDocumentFragment::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCDocumentFragment::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h
deleted file mode 100644
index 6beed81..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCDocumentFragment_h
-#define JSCDocumentFragment_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCDocumentFragment {
-public:
- struct JSCDocumentFragmentPrivate {
- JSCDOM* dom;
- Arabica::DOM::DocumentFragment<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCDocumentFragmentPrivate);
-
-
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "DocumentFragment";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCDocumentFragment_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp
deleted file mode 100644
index 1c75dcd..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCDocumentType.h"
-#include "JSCNamedNodeMap.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCDocumentType::Tmpl;
-
-JSStaticValue JSCDocumentType::staticValues[] = {
- { "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "entities", entitiesAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "notations", notationsAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "systemId", systemIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "internalSubset", internalSubsetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCDocumentType::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCDocumentType::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getName().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCDocumentType::entitiesAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object);
-
-
- Arabica::DOM::NamedNodeMap<std::string>* arabicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
-
- JSClassRef arbaicaRetClass = JSCNamedNodeMap::getTmpl();
-
- struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCDocumentType::notationsAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object);
-
-
- Arabica::DOM::NamedNodeMap<std::string>* arabicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
-
- JSClassRef arbaicaRetClass = JSCNamedNodeMap::getTmpl();
-
- struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCDocumentType::publicIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPublicId().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCDocumentType::systemIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getSystemId().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCDocumentType::internalSubsetAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getInternalSubset().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h
deleted file mode 100644
index d2077cf..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCDocumentType_h
-#define JSCDocumentType_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCDocumentType {
-public:
- struct JSCDocumentTypePrivate {
- JSCDOM* dom;
- Arabica::DOM::DocumentType<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCDocumentTypePrivate);
-
-
- static JSValueRef nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef entitiesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef notationsAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef internalSubsetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "DocumentType";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCDocumentType_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp
deleted file mode 100644
index 33f6f70..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp
+++ /dev/null
@@ -1,589 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCAttr.h"
-#include "JSCElement.h"
-#include "JSCNode.h"
-#include "JSCNodeList.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCElement::Tmpl;
-
-JSStaticValue JSCElement::staticValues[] = {
- { "tagName", tagNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCElement::staticFunctions[] = {
- { "getAttribute", getAttributeCallback, kJSPropertyAttributeDontDelete },
- { "setAttribute", setAttributeCallback, kJSPropertyAttributeDontDelete },
- { "removeAttribute", removeAttributeCallback, kJSPropertyAttributeDontDelete },
- { "getAttributeNode", getAttributeNodeCallback, kJSPropertyAttributeDontDelete },
- { "setAttributeNode", setAttributeNodeCallback, kJSPropertyAttributeDontDelete },
- { "removeAttributeNode", removeAttributeNodeCallback, kJSPropertyAttributeDontDelete },
- { "getElementsByTagName", getElementsByTagNameCallback, kJSPropertyAttributeDontDelete },
- { "getAttributeNS", getAttributeNSCallback, kJSPropertyAttributeDontDelete },
- { "setAttributeNS", setAttributeNSCallback, kJSPropertyAttributeDontDelete },
- { "removeAttributeNS", removeAttributeNSCallback, kJSPropertyAttributeDontDelete },
- { "getAttributeNodeNS", getAttributeNodeNSCallback, kJSPropertyAttributeDontDelete },
- { "setAttributeNodeNS", setAttributeNodeNSCallback, kJSPropertyAttributeDontDelete },
- { "getElementsByTagNameNS", getElementsByTagNameNSCallback, kJSPropertyAttributeDontDelete },
- { "hasAttribute", hasAttributeCallback, kJSPropertyAttributeDontDelete },
- { "hasAttributeNS", hasAttributeNSCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCElement::tagNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getTagName().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCElement::getAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- std::string retVal = privData->nativeObj->getAttribute(localName);
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getAttribute");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::setAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
- JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue);
- char* localValueBuffer = new char[localValueMaxSize];
- JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, localValueMaxSize);
- std::string localValue(localValueBuffer);
- JSStringRelease(stringReflocalValue);
- free(localValueBuffer);
-
-
- privData->nativeObj->setAttribute(localName, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setAttribute");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::removeAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- privData->nativeObj->removeAttribute(localName);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeAttribute");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::getAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(localName));
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getAttributeNode");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::setAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCAttr::getTmpl())) {
- Arabica::DOM::Attr<std::string>* localNewAttr = ((struct JSCAttr::JSCAttrPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setAttributeNode");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::removeAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCAttr::getTmpl())) {
- Arabica::DOM::Attr<std::string>* localOldAttr = ((struct JSCAttr::JSCAttrPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeAttributeNode");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(localName));
- JSClassRef retClass = JSCNodeList::getTmpl();
-
- struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getElementsByTagName");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::getAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- std::string retVal = privData->nativeObj->getAttributeNS(localNamespaceURI, localLocalName);
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getAttributeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::setAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1]) &&
- JSValueIsString(ctx, arguments[2])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName);
- char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize];
- JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, localQualifiedNameMaxSize);
- std::string localQualifiedName(localQualifiedNameBuffer);
- JSStringRelease(stringReflocalQualifiedName);
- free(localQualifiedNameBuffer);
-
- JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, arguments[2], exception);
- size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue);
- char* localValueBuffer = new char[localValueMaxSize];
- JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, localValueMaxSize);
- std::string localValue(localValueBuffer);
- JSStringRelease(stringReflocalValue);
- free(localValueBuffer);
-
-
- privData->nativeObj->setAttributeNS(localNamespaceURI, localQualifiedName, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setAttributeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::removeAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- privData->nativeObj->removeAttributeNS(localNamespaceURI, localLocalName);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeAttributeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::getAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(localNamespaceURI, localLocalName));
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getAttributeNodeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::setAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCAttr::getTmpl())) {
- Arabica::DOM::Attr<std::string>* localNewAttr = ((struct JSCAttr::JSCAttrPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
- JSClassRef retClass = JSCAttr::getTmpl();
-
- struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setAttributeNodeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(localNamespaceURI, localLocalName));
- JSClassRef retClass = JSCNodeList::getTmpl();
-
- struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getElementsByTagNameNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::hasAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- bool retVal = privData->nativeObj->hasAttribute(localName);
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling hasAttribute");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCElement::hasAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- bool retVal = privData->nativeObj->hasAttributeNS(localNamespaceURI, localLocalName);
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling hasAttributeNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h
deleted file mode 100644
index eab3696..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCElement_h
-#define JSCElement_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCElement {
-public:
- struct JSCElementPrivate {
- JSCDOM* dom;
- Arabica::DOM::Element<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCElementPrivate);
-
- static JSValueRef getAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef hasAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef hasAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef tagNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Element";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCElement_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp
deleted file mode 100644
index 4dec699..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCEntity.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCEntity::Tmpl;
-
-JSStaticValue JSCEntity::staticValues[] = {
- { "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "systemId", systemIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "notationName", notationNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCEntity::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCEntity::publicIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCEntityPrivate* privData = (struct JSCEntityPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPublicId().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCEntity::systemIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCEntityPrivate* privData = (struct JSCEntityPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getSystemId().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCEntity::notationNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCEntityPrivate* privData = (struct JSCEntityPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNotationName().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h
deleted file mode 100644
index c61510f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCEntity_h
-#define JSCEntity_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCEntity {
-public:
- struct JSCEntityPrivate {
- JSCDOM* dom;
- Arabica::DOM::Entity<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCEntityPrivate);
-
-
- static JSValueRef publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef notationNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Entity";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCEntity_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp
deleted file mode 100644
index fe67b5d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCEntityReference.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCEntityReference::Tmpl;
-
-JSStaticValue JSCEntityReference::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCEntityReference::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h
deleted file mode 100644
index 9ed8980..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCEntityReference_h
-#define JSCEntityReference_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCEntityReference {
-public:
- struct JSCEntityReferencePrivate {
- JSCDOM* dom;
- Arabica::DOM::EntityReference<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCEntityReferencePrivate);
-
-
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "EntityReference";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCEntityReference_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp
deleted file mode 100644
index 924f40f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCFloat32Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCFloat32Array::Tmpl;
-
-JSStaticValue JSCFloat32Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCFloat32Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCFloat32Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Float32Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Float32Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Float32Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCFloat32Array::getTmpl())) {
-
- uscxml::Float32Array* localArray = ((struct JSCFloat32Array::JSCFloat32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Float32Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Float32Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Float32Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<float> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Float32Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Float32Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCFloat32Array::getTmpl();
-
- struct JSCFloat32Array::JSCFloat32ArrayPrivate* retPrivData = new JSCFloat32Array::JSCFloat32ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCFloat32Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCFloat32Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 4);
-}
-
-
-JSValueRef JSCFloat32Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- float retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCFloat32Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCFloat32Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Float32Array* localArray = ((struct JSCFloat32Array::JSCFloat32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- float localValue = (float)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<float> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCFloat32Array::getTmpl())) {
- uscxml::Float32Array* localArray = ((struct JSCFloat32Array::JSCFloat32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<float> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCFloat32Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCFloat32ArrayPrivate* privData = (struct JSCFloat32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCFloat32Array::getTmpl();
-
- struct JSCFloat32Array::JSCFloat32ArrayPrivate* retPrivData = new JSCFloat32Array::JSCFloat32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCFloat32Array::getTmpl();
-
- struct JSCFloat32Array::JSCFloat32ArrayPrivate* retPrivData = new JSCFloat32Array::JSCFloat32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h
deleted file mode 100644
index 0e7bbf9..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat32Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCFloat32Array_h
-#define JSCFloat32Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCFloat32Array {
-public:
- struct JSCFloat32ArrayPrivate {
- JSCDOM* dom;
- uscxml::Float32Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCFloat32ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Float32Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCFloat32Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp
deleted file mode 100644
index a58bce9..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCFloat64Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCFloat64Array::Tmpl;
-
-JSStaticValue JSCFloat64Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCFloat64Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCFloat64Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Float64Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Float64Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Float64Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCFloat64Array::getTmpl())) {
-
- uscxml::Float64Array* localArray = ((struct JSCFloat64Array::JSCFloat64ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Float64Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Float64Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Float64Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<double> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Float64Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Float64Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCFloat64Array::getTmpl();
-
- struct JSCFloat64Array::JSCFloat64ArrayPrivate* retPrivData = new JSCFloat64Array::JSCFloat64ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCFloat64Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCFloat64Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 8);
-}
-
-
-JSValueRef JSCFloat64Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- double retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCFloat64Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCFloat64Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Float64Array* localArray = ((struct JSCFloat64Array::JSCFloat64ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- double localValue = (double)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<double> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCFloat64Array::getTmpl())) {
- uscxml::Float64Array* localArray = ((struct JSCFloat64Array::JSCFloat64ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<double> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCFloat64Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCFloat64ArrayPrivate* privData = (struct JSCFloat64ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCFloat64Array::getTmpl();
-
- struct JSCFloat64Array::JSCFloat64ArrayPrivate* retPrivData = new JSCFloat64Array::JSCFloat64ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCFloat64Array::getTmpl();
-
- struct JSCFloat64Array::JSCFloat64ArrayPrivate* retPrivData = new JSCFloat64Array::JSCFloat64ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h
deleted file mode 100644
index 82f1f72..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCFloat64Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCFloat64Array_h
-#define JSCFloat64Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCFloat64Array {
-public:
- struct JSCFloat64ArrayPrivate {
- JSCDOM* dom;
- uscxml::Float64Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCFloat64ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Float64Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCFloat64Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp
deleted file mode 100644
index e887378..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCInt16Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCInt16Array::Tmpl;
-
-JSStaticValue JSCInt16Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCInt16Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCInt16Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Int16Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Int16Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Int16Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt16Array::getTmpl())) {
-
- uscxml::Int16Array* localArray = ((struct JSCInt16Array::JSCInt16ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Int16Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Int16Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Int16Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<short> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Int16Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Int16Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCInt16Array::getTmpl();
-
- struct JSCInt16Array::JSCInt16ArrayPrivate* retPrivData = new JSCInt16Array::JSCInt16ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCInt16Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCInt16Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 2);
-}
-
-
-JSValueRef JSCInt16Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- short retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCInt16Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt16Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Int16Array* localArray = ((struct JSCInt16Array::JSCInt16ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- short localValue = (short)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<short> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt16Array::getTmpl())) {
- uscxml::Int16Array* localArray = ((struct JSCInt16Array::JSCInt16ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<short> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCInt16Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt16ArrayPrivate* privData = (struct JSCInt16ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCInt16Array::getTmpl();
-
- struct JSCInt16Array::JSCInt16ArrayPrivate* retPrivData = new JSCInt16Array::JSCInt16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCInt16Array::getTmpl();
-
- struct JSCInt16Array::JSCInt16ArrayPrivate* retPrivData = new JSCInt16Array::JSCInt16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h
deleted file mode 100644
index f56c7b9..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt16Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCInt16Array_h
-#define JSCInt16Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCInt16Array {
-public:
- struct JSCInt16ArrayPrivate {
- JSCDOM* dom;
- uscxml::Int16Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCInt16ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Int16Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCInt16Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp
deleted file mode 100644
index b868e9b..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCInt32Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCInt32Array::Tmpl;
-
-JSStaticValue JSCInt32Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCInt32Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCInt32Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Int32Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Int32Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Int32Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt32Array::getTmpl())) {
-
- uscxml::Int32Array* localArray = ((struct JSCInt32Array::JSCInt32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Int32Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Int32Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Int32Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<long> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Int32Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Int32Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCInt32Array::getTmpl();
-
- struct JSCInt32Array::JSCInt32ArrayPrivate* retPrivData = new JSCInt32Array::JSCInt32ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCInt32Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCInt32Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 4);
-}
-
-
-JSValueRef JSCInt32Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- long retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCInt32Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt32Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Int32Array* localArray = ((struct JSCInt32Array::JSCInt32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- long localValue = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<long> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt32Array::getTmpl())) {
- uscxml::Int32Array* localArray = ((struct JSCInt32Array::JSCInt32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<long> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCInt32Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt32ArrayPrivate* privData = (struct JSCInt32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCInt32Array::getTmpl();
-
- struct JSCInt32Array::JSCInt32ArrayPrivate* retPrivData = new JSCInt32Array::JSCInt32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCInt32Array::getTmpl();
-
- struct JSCInt32Array::JSCInt32ArrayPrivate* retPrivData = new JSCInt32Array::JSCInt32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h
deleted file mode 100644
index 76bda20..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt32Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCInt32Array_h
-#define JSCInt32Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCInt32Array {
-public:
- struct JSCInt32ArrayPrivate {
- JSCDOM* dom;
- uscxml::Int32Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCInt32ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Int32Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCInt32Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp
deleted file mode 100644
index 28bb6b4..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCInt8Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCInt8Array::Tmpl;
-
-JSStaticValue JSCInt8Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCInt8Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCInt8Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Int8Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Int8Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Int8Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt8Array::getTmpl())) {
-
- uscxml::Int8Array* localArray = ((struct JSCInt8Array::JSCInt8ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Int8Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Int8Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Int8Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Int8Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Int8Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCInt8Array::getTmpl();
-
- struct JSCInt8Array::JSCInt8ArrayPrivate* retPrivData = new JSCInt8Array::JSCInt8ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCInt8Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCInt8Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 1);
-}
-
-
-JSValueRef JSCInt8Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- char retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCInt8Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt8Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Int8Array* localArray = ((struct JSCInt8Array::JSCInt8ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- char localValue = (char)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCInt8Array::getTmpl())) {
- uscxml::Int8Array* localArray = ((struct JSCInt8Array::JSCInt8ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCInt8Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCInt8ArrayPrivate* privData = (struct JSCInt8ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCInt8Array::getTmpl();
-
- struct JSCInt8Array::JSCInt8ArrayPrivate* retPrivData = new JSCInt8Array::JSCInt8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCInt8Array::getTmpl();
-
- struct JSCInt8Array::JSCInt8ArrayPrivate* retPrivData = new JSCInt8Array::JSCInt8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h
deleted file mode 100644
index b46d4cb..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCInt8Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCInt8Array_h
-#define JSCInt8Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCInt8Array {
-public:
- struct JSCInt8ArrayPrivate {
- JSCDOM* dom;
- uscxml::Int8Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCInt8ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Int8Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCInt8Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp
deleted file mode 100644
index c0e53bf..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNamedNodeMap.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCNamedNodeMap::Tmpl;
-
-JSStaticValue JSCNamedNodeMap::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCNamedNodeMap::staticFunctions[] = {
- { "getNamedItem", getNamedItemCallback, kJSPropertyAttributeDontDelete },
- { "setNamedItem", setNamedItemCallback, kJSPropertyAttributeDontDelete },
- { "removeNamedItem", removeNamedItemCallback, kJSPropertyAttributeDontDelete },
- { "item", itemCallback, kJSPropertyAttributeDontDelete },
- { "getNamedItemNS", getNamedItemNSCallback, kJSPropertyAttributeDontDelete },
- { "setNamedItemNS", setNamedItemNSCallback, kJSPropertyAttributeDontDelete },
- { "removeNamedItemNS", removeNamedItemNSCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCNamedNodeMap::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-
-JSValueRef JSCNamedNodeMap::getNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(localName));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getNamedItem");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNamedNodeMap::setNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl())) {
- Arabica::DOM::Node<std::string>* localArg = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setNamedItem");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNamedNodeMap::removeNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName);
- char* localNameBuffer = new char[localNameMaxSize];
- JSStringGetUTF8CString(stringReflocalName, localNameBuffer, localNameMaxSize);
- std::string localName(localNameBuffer);
- JSStringRelease(stringReflocalName);
- free(localNameBuffer);
-
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(localName));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeNamedItem");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNamedNodeMap::itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling item");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNamedNodeMap::getNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(localNamespaceURI, localLocalName));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getNamedItemNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNamedNodeMap::setNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl())) {
- Arabica::DOM::Node<std::string>* localArg = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setNamedItemNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNamedNodeMap::removeNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI);
- char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize];
- JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, localNamespaceURIMaxSize);
- std::string localNamespaceURI(localNamespaceURIBuffer);
- JSStringRelease(stringReflocalNamespaceURI);
- free(localNamespaceURIBuffer);
-
- JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName);
- char* localLocalNameBuffer = new char[localLocalNameMaxSize];
- JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, localLocalNameMaxSize);
- std::string localLocalName(localLocalNameBuffer);
- JSStringRelease(stringReflocalLocalName);
- free(localLocalNameBuffer);
-
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(localNamespaceURI, localLocalName));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeNamedItemNS");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h
deleted file mode 100644
index 5b2f6d9..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCNamedNodeMap_h
-#define JSCNamedNodeMap_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCNamedNodeMap {
-public:
- struct JSCNamedNodeMapPrivate {
- JSCDOM* dom;
- Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCNamedNodeMapPrivate);
-
- static JSValueRef getNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "NamedNodeMap";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCNamedNodeMap_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
deleted file mode 100644
index 7f9ddb0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
+++ /dev/null
@@ -1,565 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCDocument.h"
-#include "JSCNode.h"
-#include "JSCNodeList.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCNode::Tmpl;
-
-JSStaticValue JSCNode::staticValues[] = {
- { "nodeName", nodeNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "nodeValue", nodeValueAttrGetter, nodeValueAttrSetter, kJSPropertyAttributeDontDelete },
- { "nodeType", nodeTypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "parentNode", parentNodeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "childNodes", childNodesAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "firstChild", firstChildAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "lastChild", lastChildAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "previousSibling", previousSiblingAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "nextSibling", nextSiblingAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "attributes", attributesCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "ownerDocument", ownerDocumentAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "namespaceURI", namespaceURIAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "prefix", prefixAttrGetter, prefixAttrSetter, kJSPropertyAttributeDontDelete },
- { "localName", localNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "ELEMENT_NODE", ELEMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "ATTRIBUTE_NODE", ATTRIBUTE_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "TEXT_NODE", TEXT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "CDATA_SECTION_NODE", CDATA_SECTION_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "ENTITY_REFERENCE_NODE", ENTITY_REFERENCE_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "ENTITY_NODE", ENTITY_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "PROCESSING_INSTRUCTION_NODE", PROCESSING_INSTRUCTION_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "COMMENT_NODE", COMMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "DOCUMENT_NODE", DOCUMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "DOCUMENT_TYPE_NODE", DOCUMENT_TYPE_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "DOCUMENT_FRAGMENT_NODE", DOCUMENT_FRAGMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "NOTATION_NODE", NOTATION_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCNode::staticFunctions[] = {
- { "insertBefore", insertBeforeCallback, kJSPropertyAttributeDontDelete },
- { "replaceChild", replaceChildCallback, kJSPropertyAttributeDontDelete },
- { "removeChild", removeChildCallback, kJSPropertyAttributeDontDelete },
- { "appendChild", appendChildCallback, kJSPropertyAttributeDontDelete },
- { "hasChildNodes", hasChildNodesCallback, kJSPropertyAttributeDontDelete },
- { "cloneNode", cloneNodeCallback, kJSPropertyAttributeDontDelete },
- { "normalize", normalizeCallback, kJSPropertyAttributeDontDelete },
- { "isSupported", isSupportedCallback, kJSPropertyAttributeDontDelete },
- { "hasAttributes", hasAttributesCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCNode::nodeNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNodeName().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCNode::nodeValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNodeValue().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-bool JSCNode::nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- JSStringRef stringReflocalNodeValue = JSValueToStringCopy(ctx, value, exception);
- size_t localNodeValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNodeValue);
- char* localNodeValueBuffer = new char[localNodeValueMaxSize];
- JSStringGetUTF8CString(stringReflocalNodeValue, localNodeValueBuffer, localNodeValueMaxSize);
- std::string localNodeValue(localNodeValueBuffer);
- JSStringRelease(stringReflocalNodeValue);
- free(localNodeValueBuffer);
-
- privData->nativeObj->setNodeValue(localNodeValue);
- return true;
-}
-
-JSValueRef JSCNode::nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getNodeType());
-}
-
-
-JSValueRef JSCNode::parentNodeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getParentNode()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
-
- JSClassRef arbaicaRetClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::childNodesAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
-
- Arabica::DOM::NodeList<std::string>* arabicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
-
- JSClassRef arbaicaRetClass = JSCNodeList::getTmpl();
-
- struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::firstChildAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getFirstChild()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
-
- JSClassRef arbaicaRetClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::lastChildAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getLastChild()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
-
- JSClassRef arbaicaRetClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getPreviousSibling()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
-
- JSClassRef arbaicaRetClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getNextSibling()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
-
- JSClassRef arbaicaRetClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->getOwnerDocument()) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Document<std::string>* arabicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
-
- JSClassRef arbaicaRetClass = JSCDocument::getTmpl();
-
- struct JSCDocument::JSCDocumentPrivate* retPrivData = new JSCDocument::JSCDocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCNode::namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNamespaceURI().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCNode::prefixAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPrefix().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-bool JSCNode::prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- JSStringRef stringReflocalPrefix = JSValueToStringCopy(ctx, value, exception);
- size_t localPrefixMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalPrefix);
- char* localPrefixBuffer = new char[localPrefixMaxSize];
- JSStringGetUTF8CString(stringReflocalPrefix, localPrefixBuffer, localPrefixMaxSize);
- std::string localPrefix(localPrefixBuffer);
- JSStringRelease(stringReflocalPrefix);
- free(localPrefixBuffer);
-
- privData->nativeObj->setPrefix(localPrefix);
- return true;
-}
-
-JSValueRef JSCNode::localNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getLocalName().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-JSValueRef JSCNode::ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 1);
-}
-
-JSValueRef JSCNode::ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 2);
-}
-
-JSValueRef JSCNode::TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 3);
-}
-
-JSValueRef JSCNode::CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 4);
-}
-
-JSValueRef JSCNode::ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 5);
-}
-
-JSValueRef JSCNode::ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 6);
-}
-
-JSValueRef JSCNode::PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 7);
-}
-
-JSValueRef JSCNode::COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 8);
-}
-
-JSValueRef JSCNode::DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 9);
-}
-
-JSValueRef JSCNode::DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 10);
-}
-
-JSValueRef JSCNode::DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 11);
-}
-
-JSValueRef JSCNode::NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 12);
-}
-
-
-JSValueRef JSCNode::insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl()) &&
- JSValueIsObject(ctx, arguments[1]) && JSValueIsObjectOfClass(ctx, arguments[1], JSCNode::getTmpl())) {
- Arabica::DOM::Node<std::string>* localNewChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- Arabica::DOM::Node<std::string>* localRefChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], exception)))->nativeObj;
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling insertBefore");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl()) &&
- JSValueIsObject(ctx, arguments[1]) && JSValueIsObjectOfClass(ctx, arguments[1], JSCNode::getTmpl())) {
- Arabica::DOM::Node<std::string>* localNewChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- Arabica::DOM::Node<std::string>* localOldChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[1], exception)))->nativeObj;
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling replaceChild");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl())) {
- Arabica::DOM::Node<std::string>* localOldChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeChild");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCNode::getTmpl())) {
- Arabica::DOM::Node<std::string>* localNewChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling appendChild");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- bool retVal = privData->nativeObj->hasChildNodes();
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling hasChildNodes");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsBoolean(ctx, arguments[0])) {
- bool localDeep = JSValueToBoolean(ctx, arguments[0]);
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling cloneNode");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- privData->nativeObj->normalize();
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling normalize");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalFeature = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localFeatureMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalFeature);
- char* localFeatureBuffer = new char[localFeatureMaxSize];
- JSStringGetUTF8CString(stringReflocalFeature, localFeatureBuffer, localFeatureMaxSize);
- std::string localFeature(localFeatureBuffer);
- JSStringRelease(stringReflocalFeature);
- free(localFeatureBuffer);
-
- JSStringRef stringReflocalVersion = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localVersionMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalVersion);
- char* localVersionBuffer = new char[localVersionMaxSize];
- JSStringGetUTF8CString(stringReflocalVersion, localVersionBuffer, localVersionMaxSize);
- std::string localVersion(localVersionBuffer);
- JSStringRelease(stringReflocalVersion);
- free(localVersionBuffer);
-
-
- bool retVal = privData->nativeObj->isSupported(localFeature, localVersion);
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling isSupported");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCNode::hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- bool retVal = privData->nativeObj->hasAttributes();
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling hasAttributes");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h
deleted file mode 100644
index 91daa79..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCNode_h
-#define JSCNode_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCNode {
-public:
- struct JSCNodePrivate {
- JSCDOM* dom;
- Arabica::DOM::Node<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCNodePrivate);
-
- static JSValueRef insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef nodeNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef nodeValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
- static JSValueRef nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef parentNodeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef childNodesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef firstChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef lastChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef attributesCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef prefixAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
- static JSValueRef localNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Node";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCNode_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp
deleted file mode 100644
index b135044..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeCustom.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCNode.h"
-#include "JSCNamedNodeMap.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSValueRef JSCNode::attributesCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
-
- struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
-
- if (!privData->nativeObj->hasAttributes()) {
- return JSValueMakeUndefined(ctx);
- }
-
- Arabica::DOM::NamedNodeMap<std::string>* retVal = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
- JSClassRef retClass = JSCNamedNodeMap::getTmpl();
-
- struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-}
-
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp
deleted file mode 100644
index 6a3acfb..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNode.h"
-#include "JSCNodeList.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCNodeList::Tmpl;
-
-JSStaticValue JSCNodeList::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCNodeList::staticFunctions[] = {
- { "item", itemCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCNodeList::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-
-JSValueRef JSCNodeList::itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling item");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h
deleted file mode 100644
index 2b5b3bc..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCNodeList_h
-#define JSCNodeList_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCNodeList {
-public:
- struct JSCNodeListPrivate {
- JSCDOM* dom;
- Arabica::DOM::NodeList<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCNodeListPrivate);
-
- static JSValueRef itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "NodeList";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCNodeList_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
deleted file mode 100644
index 91c18e5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCNodeList.h"
-#include "JSCElement.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-bool JSCNodeList::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
- char* propBuffer = new char[propMaxSize];
- JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
- std::string propName(propBuffer);
- free(propBuffer);
-
- std::string base = "0123456789";
- if (propName.find_first_not_of(base) != std::string::npos) {
- return false;
- }
-
- int index = boost::lexical_cast<int>(propName);
- struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->getLength() < index) {
- return false;
- }
-
- return true;
-}
-
-JSValueRef JSCNodeList::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
- char* propBuffer = new char[propMaxSize];
- JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
- std::string propName(propBuffer);
- free(propBuffer);
-
- std::string base = "0123456789";
- if (propName.find_first_not_of(base) != std::string::npos) {
- return JSValueMakeUndefined(ctx);
- }
-
- int index = boost::lexical_cast<int>(propName);
- struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(object);
- if (privData->nativeObj->getLength() < index) {
- return JSValueMakeUndefined(ctx);
- }
-
- switch(privData->nativeObj->item(index).getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->item(index));
- JSClassRef retClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
- break;
- }
- default: {
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(index));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
- }
- }
-
- return JSValueMakeUndefined(ctx);
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp
deleted file mode 100644
index cf4a8de..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNodeSet.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCNodeSet::Tmpl;
-
-JSStaticValue JSCNodeSet::staticValues[] = {
- { "size", sizeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "empty", emptyAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCNodeSet::staticFunctions[] = {
- { "toDocumentOrder", toDocumentOrderCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCNodeSet::sizeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->size());
-}
-
-
-JSValueRef JSCNodeSet::emptyAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeBoolean(ctx, privData->nativeObj->empty());
-}
-
-
-JSValueRef JSCNodeSet::toDocumentOrderCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- privData->nativeObj->to_document_order();
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling toDocumentOrder");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h
deleted file mode 100644
index a384ade..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCNodeSet_h
-#define JSCNodeSet_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCNodeSet {
-public:
- struct JSCNodeSetPrivate {
- JSCDOM* dom;
- Arabica::XPath::NodeSet<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCNodeSetPrivate);
-
- static JSValueRef toDocumentOrderCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef sizeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef emptyAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "NodeSet";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCNodeSet_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp
deleted file mode 100644
index 6de5793..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSetCustom.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCNodeSet.h"
-#include "JSCElement.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-
-bool JSCNodeSet::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
- char* propBuffer = new char[propMaxSize];
- JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
- std::string propName(propBuffer);
- free(propBuffer);
-
- std::string base = "0123456789";
- if (propName.find_first_not_of(base) != std::string::npos) {
- return false;
- }
-
- int index = boost::lexical_cast<int>(propName);
- struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->size() < index) {
- return false;
- }
-
- return true;
-}
-
-JSValueRef JSCNodeSet::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
- char* propBuffer = new char[propMaxSize];
- JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
- std::string propName(propBuffer);
- free(propBuffer);
-
- std::string base = "0123456789";
- if (propName.find_first_not_of(base) != std::string::npos) {
- return JSValueMakeUndefined(ctx);
- }
-
- int index = boost::lexical_cast<int>(propName);
- struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object);
- if (privData->nativeObj->size() <= index) {
- return JSValueMakeUndefined(ctx);
- }
-
- switch((*privData->nativeObj)[index].getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>((*privData->nativeObj)[index]);
- JSClassRef retClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
- break;
- }
- default: {
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>((*privData->nativeObj)[index]);
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
- }
- }
-
- return JSValueMakeUndefined(ctx);
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp
deleted file mode 100644
index 6ff9079..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNode.h"
-#include "JSCNotation.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCNotation::Tmpl;
-
-JSStaticValue JSCNotation::staticValues[] = {
- { "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "systemId", systemIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCNotation::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCNotation::publicIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNotationPrivate* privData = (struct JSCNotationPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPublicId().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCNotation::systemIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCNotationPrivate* privData = (struct JSCNotationPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getSystemId().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h
deleted file mode 100644
index 5238bbc..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCNotation_h
-#define JSCNotation_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCNotation {
-public:
- struct JSCNotationPrivate {
- JSCDOM* dom;
- Arabica::DOM::Notation<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCNotationPrivate);
-
-
- static JSValueRef publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Notation";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCNotation_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp
deleted file mode 100644
index c712c60..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNode.h"
-#include "JSCProcessingInstruction.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCProcessingInstruction::Tmpl;
-
-JSStaticValue JSCProcessingInstruction::staticValues[] = {
- { "target", targetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "data", dataAttrGetter, dataAttrSetter, kJSPropertyAttributeDontDelete },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCProcessingInstruction::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCProcessingInstruction::targetAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCProcessingInstructionPrivate* privData = (struct JSCProcessingInstructionPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getTarget().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCProcessingInstruction::dataAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCProcessingInstructionPrivate* privData = (struct JSCProcessingInstructionPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getData().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-bool JSCProcessingInstruction::dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- struct JSCProcessingInstructionPrivate* privData = (struct JSCProcessingInstructionPrivate*)JSObjectGetPrivate(thisObj);
-
- JSStringRef stringReflocalData = JSValueToStringCopy(ctx, value, exception);
- size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
- char* localDataBuffer = new char[localDataMaxSize];
- JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
- std::string localData(localDataBuffer);
- JSStringRelease(stringReflocalData);
- free(localDataBuffer);
-
- privData->nativeObj->setData(localData);
- return true;
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h
deleted file mode 100644
index fbee5fd..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCProcessingInstruction_h
-#define JSCProcessingInstruction_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCNode.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCProcessingInstruction {
-public:
- struct JSCProcessingInstructionPrivate {
- JSCDOM* dom;
- Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCProcessingInstructionPrivate);
-
-
- static JSValueRef targetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef dataAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "ProcessingInstruction";
- classDef.parentClass = JSCNode::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCProcessingInstruction_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp
deleted file mode 100644
index 174b704..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNode.h"
-#include "JSCSCXMLEvent.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCSCXMLEvent::Tmpl;
-
-JSStaticValue JSCSCXMLEvent::staticValues[] = {
- { "type", typeCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "origin", originAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "origintype", origintypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "raw", rawAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "dom", domAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "sendid", sendidCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "invokeid", invokeidAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "INTERNAL", INTERNALConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "EXTERNAL", EXTERNALConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "PLATFORM", PLATFORMConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCSCXMLEvent::staticFunctions[] = {
- { 0, 0, 0 }
-};
-
-JSValueRef JSCSCXMLEvent::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->name.c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCSCXMLEvent::originAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->origin.length() == 0)
- return JSValueMakeUndefined(ctx);
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->origin.c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCSCXMLEvent::origintypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->origintype.length() == 0)
- return JSValueMakeUndefined(ctx);
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->origintype.c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCSCXMLEvent::rawAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->raw.length() == 0)
- return JSValueMakeUndefined(ctx);
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->raw.c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCSCXMLEvent::domAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object);
-
- if (!privData->nativeObj->dom) return JSValueMakeUndefined(ctx);
- Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
-
- JSClassRef arbaicaRetClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arabicaRet;
-
- JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, retPrivData);
- return arbaicaRetObj;
-}
-
-
-JSValueRef JSCSCXMLEvent::invokeidAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->invokeid.length() == 0)
- return JSValueMakeUndefined(ctx);
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->invokeid.c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-JSValueRef JSCSCXMLEvent::INTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 1);
-}
-
-JSValueRef JSCSCXMLEvent::EXTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 2);
-}
-
-JSValueRef JSCSCXMLEvent::PLATFORMConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 3);
-}
-
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h
deleted file mode 100644
index 1d8021d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCSCXMLEvent_h
-#define JSCSCXMLEvent_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCSCXMLEvent {
-public:
- struct JSCSCXMLEventPrivate {
- JSCDOM* dom;
- uscxml::Event* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCSCXMLEventPrivate);
-
-
- static JSValueRef typeCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef originAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef origintypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef rawAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef domAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef sendidCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef invokeidAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef INTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef EXTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef PLATFORMConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "SCXMLEvent";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCSCXMLEvent_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp
deleted file mode 100644
index 9d128b6..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEventCustom.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCSCXMLEvent.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSValueRef JSCSCXMLEvent::typeCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(thisObj);
- JSStringRef stringRef;
-
- switch (privData->nativeObj->eventType) {
- case uscxml::Event::INTERNAL:
- stringRef = JSStringCreateWithUTF8CString("internal");
- break;
- case uscxml::Event::EXTERNAL:
- stringRef = JSStringCreateWithUTF8CString("external");
- break;
- case uscxml::Event::PLATFORM:
- stringRef = JSStringCreateWithUTF8CString("platform");
- break;
- default:
- stringRef = JSStringCreateWithUTF8CString("undefined");
- break;
- }
-
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-JSValueRef JSCSCXMLEvent::sendidCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
- struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(thisObj);
- JSStringRef stringRef;
-
- if (privData->nativeObj->sendid.length() == 0 || privData->nativeObj->hideSendId) {
- return JSValueMakeUndefined(ctx);
- } else {
- stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->sendid.c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
- }
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.cpp
deleted file mode 100644
index 9bd3d73..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCStorage.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCStorage::Tmpl;
-
-JSStaticValue JSCStorage::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCStorage::staticFunctions[] = {
- { "key", keyCallback, kJSPropertyAttributeDontDelete },
- { "getItem", getItemCallback, kJSPropertyAttributeDontDelete },
- { "setItem", setItemCallback, kJSPropertyAttributeDontDelete },
- { "removeItem", removeItemCallback, kJSPropertyAttributeDontDelete },
- { "clear", clearCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCStorage::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCStoragePrivate* privData = (struct JSCStoragePrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-
-JSValueRef JSCStorage::keyCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCStoragePrivate* privData = (struct JSCStoragePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- std::string retVal = privData->nativeObj->key(localIndex);
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling key");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCStorage::getItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCStoragePrivate* privData = (struct JSCStoragePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalKey = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localKeyMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalKey);
- char* localKeyBuffer = new char[localKeyMaxSize];
- JSStringGetUTF8CString(stringReflocalKey, localKeyBuffer, localKeyMaxSize);
- std::string localKey(localKeyBuffer);
- JSStringRelease(stringReflocalKey);
- free(localKeyBuffer);
-
-
- std::string retVal = privData->nativeObj->getItem(localKey);
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling getItem");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCStorage::setItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCStoragePrivate* privData = (struct JSCStoragePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsString(ctx, arguments[0]) &&
- JSValueIsString(ctx, arguments[1])) {
- JSStringRef stringReflocalKey = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localKeyMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalKey);
- char* localKeyBuffer = new char[localKeyMaxSize];
- JSStringGetUTF8CString(stringReflocalKey, localKeyBuffer, localKeyMaxSize);
- std::string localKey(localKeyBuffer);
- JSStringRelease(stringReflocalKey);
- free(localKeyBuffer);
-
- JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, arguments[1], exception);
- size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue);
- char* localValueBuffer = new char[localValueMaxSize];
- JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, localValueMaxSize);
- std::string localValue(localValueBuffer);
- JSStringRelease(stringReflocalValue);
- free(localValueBuffer);
-
-
- privData->nativeObj->setItem(localKey, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling setItem");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCStorage::removeItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCStoragePrivate* privData = (struct JSCStoragePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsString(ctx, arguments[0])) {
- JSStringRef stringReflocalKey = JSValueToStringCopy(ctx, arguments[0], exception);
- size_t localKeyMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalKey);
- char* localKeyBuffer = new char[localKeyMaxSize];
- JSStringGetUTF8CString(stringReflocalKey, localKeyBuffer, localKeyMaxSize);
- std::string localKey(localKeyBuffer);
- JSStringRelease(stringReflocalKey);
- free(localKeyBuffer);
-
-
- privData->nativeObj->removeItem(localKey);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling removeItem");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCStorage::clearCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCStoragePrivate* privData = (struct JSCStoragePrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- privData->nativeObj->clear();
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling clear");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.h
deleted file mode 100644
index dfb66b8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCStorage.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCStorage_h
-#define JSCStorage_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCStorage {
-public:
- struct JSCStoragePrivate {
- JSCDOM* dom;
- uscxml::Storage* nativeObj;
- };
-
- JSC_DESTRUCTOR_KEEP_WRAPPED(JSCStoragePrivate);
-
- static JSValueRef keyCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef getItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef removeItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef clearCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Storage";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCStorage_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp
deleted file mode 100644
index be25753..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCCharacterData.h"
-#include "JSCText.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCText::Tmpl;
-
-JSStaticValue JSCText::staticValues[] = {
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCText::staticFunctions[] = {
- { "splitText", splitTextCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCText::splitTextCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCTextPrivate* privData = (struct JSCTextPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
- JSClassRef retClass = JSCText::getTmpl();
-
- struct JSCText::JSCTextPrivate* retPrivData = new JSCText::JSCTextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling splitText");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h
deleted file mode 100644
index 7ca23cb..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCText_h
-#define JSCText_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "JSCCharacterData.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCText {
-public:
- struct JSCTextPrivate {
- JSCDOM* dom;
- Arabica::DOM::Text<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCTextPrivate);
-
- static JSValueRef splitTextCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Text";
- classDef.parentClass = JSCCharacterData::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCText_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCTypedArrayCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCTypedArrayCustom.cpp
deleted file mode 100644
index b5122e8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCTypedArrayCustom.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "../../TypedArray.h"
-#include "JSCArrayBuffer.h"
-#include "JSCInt8Array.h"
-#include "JSCUint8Array.h"
-#include "JSCUint8ClampedArray.h"
-#include "JSCInt16Array.h"
-#include "JSCUint16Array.h"
-#include "JSCInt32Array.h"
-#include "JSCUint32Array.h"
-#include "JSCFloat32Array.h"
-#include "JSCFloat64Array.h"
-#include "JSCDataView.h"
-
-#define JSC_VALUE_TO_STRING(name, stringName)\
-size_t name##MaxSize = JSStringGetMaximumUTF8CStringSize(name);\
-char* name##Buffer = new char[name##MaxSize];\
-JSStringGetUTF8CString(name, name##Buffer, name##MaxSize);\
-std::string stringName(name##Buffer);\
-free(name##Buffer);\
-
-
-#define JSC_TYPED_ARRAY_GET_PROP_RETURN(type)\
-size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);\
-char* propBuffer = new char[propMaxSize];\
-JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);\
-std::string propName(propBuffer);\
-free(propBuffer);\
-if (strcmp(propName.c_str(), "prototype") == 0) {\
- JSStringRef prototypeName = JSStringCreateWithUTF8CString(#type);\
- JSValueRef prototype = JSObjectGetProperty(ctx, JSContextGetGlobalObject(ctx), prototypeName, exception);\
- assert(!JSValueIsUndefined(ctx, prototype) && !JSValueIsNull(ctx, prototype));\
- JSStringRelease(prototypeName);\
- return prototype;\
-}\
-JSStaticValue* prop = JSC##type::staticValues;\
-while(prop->name) {\
- if (strcmp(propName.c_str(), prop->name) == 0) {\
- return (prop->getProperty)(ctx, object, propertyName, exception);\
- }\
- prop++;\
-}\
-\
-JSC##type::JSC##type##Private* privObj = (JSC##type::JSC##type##Private*)JSObjectGetPrivate(object);\
-if (!privObj)\
- return JSValueMakeUndefined(ctx);\
-\
-uscxml::type* array = ((JSC##type::JSC##type##Private*)JSObjectGetPrivate(object))->nativeObj;\
-std::string base = "0123456789";\
-if (propName.find_first_not_of(base) != std::string::npos) {\
- return JSValueMakeUndefined(ctx);\
-}\
-unsigned long index = boost::lexical_cast<unsigned long>(propName);\
-return JSValueMakeNumber(ctx, array->get(index));
-
-
-
-#define JSC_TYPED_ARRAY_SET_PROP_RETURN(type)\
-if (!JSValueIsNumber(ctx, value)) {\
- return false;\
-}\
-size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);\
-char* propBuffer = new char[propMaxSize];\
-JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);\
-std::string propName(propBuffer);\
-free(propBuffer);\
-uscxml::type* array = ((JSC##type::JSC##type##Private*)JSObjectGetPrivate(object))->nativeObj;\
-std::string base = "0123456789";\
-if (propName.find_first_not_of(base) != std::string::npos) {\
- return JSValueMakeUndefined(ctx);\
-}\
-unsigned long index = boost::lexical_cast<unsigned long>(propName);\
-if (index >= array->getLength()) {\
- return false;\
-}\
-array->set(index, JSValueToNumber(ctx, value, exception));\
-return true;
-
-
-#define JSC_TYPED_ARRAY_HAS_PROP_RETURN(type)\
-size_t propertyNameMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);\
-char* propertyNameBuffer = new char[propertyNameMaxSize];\
-JSStringGetUTF8CString(propertyName, propertyNameBuffer, propertyNameMaxSize);\
-std::string propName(propertyNameBuffer);\
-free(propertyNameBuffer);\
-\
-if (strcmp(propName.c_str(), "prototype") == 0)\
- return true;\
-\
-if (strcmp(propName.c_str(), "length") == 0)\
- return true;\
-\
-JSStaticValue* prop = JSC##type::staticValues;\
-while(prop->name) {\
- if (strcmp(propName.c_str(), prop->name) == 0) {\
- return true;\
- }\
- prop++;\
-}\
-\
-JSC##type::JSC##type##Private* privObj = (JSC##type::JSC##type##Private*)JSObjectGetPrivate(object);\
-if (!privObj)\
- return false;\
-\
-uscxml::type* array = ((JSC##type::JSC##type##Private*)JSObjectGetPrivate(object))->nativeObj;\
-std::string base = "0123456789";\
-if (propName.find_first_not_of(base) != std::string::npos) {\
- return false;\
-}\
-unsigned long index = boost::lexical_cast<unsigned long>(propName);\
-if (array->getLength() > index)\
- return true;\
-return false;\
-
-namespace Arabica {
-namespace DOM {
-
-bool JSCInt8Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Int8Array);
-}
-
-bool JSCInt16Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Int16Array);
-}
-
-bool JSCInt32Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Int32Array);
-}
-
-bool JSCUint8Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Uint8Array);
-}
-
-bool JSCUint16Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Uint16Array);
-}
-
-bool JSCUint32Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Uint32Array);
-}
-
-bool JSCFloat32Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Float32Array);
-}
-
-bool JSCFloat64Array::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Float64Array);
-}
-
-bool JSCUint8ClampedArray::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- JSC_TYPED_ARRAY_HAS_PROP_RETURN(Uint8ClampedArray);
-}
-
-// -----------------
-
-JSValueRef JSCInt8Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Int8Array);
-}
-
-JSValueRef JSCInt16Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Int16Array);
-}
-
-JSValueRef JSCInt32Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Int32Array);
-}
-
-JSValueRef JSCUint8Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Uint8Array);
-}
-
-JSValueRef JSCUint16Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Uint16Array);
-}
-
-JSValueRef JSCUint32Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Uint32Array);
-}
-
-JSValueRef JSCFloat32Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Float32Array);
-}
-
-JSValueRef JSCFloat64Array::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Float64Array);
-}
-
-JSValueRef JSCUint8ClampedArray::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- JSC_TYPED_ARRAY_GET_PROP_RETURN(Uint8ClampedArray);
-}
-
-// ----------------
-
-bool JSCInt8Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Int8Array);
-}
-
-bool JSCInt16Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Int16Array);
-}
-
-bool JSCInt32Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Int32Array);
-}
-
-bool JSCUint8Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Uint8Array);
-}
-
-bool JSCUint16Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Uint16Array);
-}
-
-bool JSCUint32Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Uint32Array);
-}
-
-bool JSCFloat32Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Float32Array);
-}
-
-bool JSCFloat64Array::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Float64Array);
-}
-
-bool JSCUint8ClampedArray::setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
- JSC_TYPED_ARRAY_SET_PROP_RETURN(Uint8ClampedArray);
-}
-
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp
deleted file mode 100644
index d869d1e..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCUint16Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCUint16Array::Tmpl;
-
-JSStaticValue JSCUint16Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCUint16Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCUint16Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Uint16Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Uint16Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Uint16Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint16Array::getTmpl())) {
-
- uscxml::Uint16Array* localArray = ((struct JSCUint16Array::JSCUint16ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint16Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint16Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Uint16Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<unsigned short> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Uint16Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Uint16Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCUint16Array::getTmpl();
-
- struct JSCUint16Array::JSCUint16ArrayPrivate* retPrivData = new JSCUint16Array::JSCUint16ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCUint16Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCUint16Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 2);
-}
-
-
-JSValueRef JSCUint16Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned short retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint16Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint16Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Uint16Array* localArray = ((struct JSCUint16Array::JSCUint16ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned short localValue = (unsigned short)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<unsigned short> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint16Array::getTmpl())) {
- uscxml::Uint16Array* localArray = ((struct JSCUint16Array::JSCUint16ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<unsigned short> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint16Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint16ArrayPrivate* privData = (struct JSCUint16ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCUint16Array::getTmpl();
-
- struct JSCUint16Array::JSCUint16ArrayPrivate* retPrivData = new JSCUint16Array::JSCUint16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCUint16Array::getTmpl();
-
- struct JSCUint16Array::JSCUint16ArrayPrivate* retPrivData = new JSCUint16Array::JSCUint16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h
deleted file mode 100644
index 19ff639..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint16Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCUint16Array_h
-#define JSCUint16Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCUint16Array {
-public:
- struct JSCUint16ArrayPrivate {
- JSCDOM* dom;
- uscxml::Uint16Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCUint16ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Uint16Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCUint16Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp
deleted file mode 100644
index 8fbefb3..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCUint32Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCUint32Array::Tmpl;
-
-JSStaticValue JSCUint32Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCUint32Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCUint32Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Uint32Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Uint32Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Uint32Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint32Array::getTmpl())) {
-
- uscxml::Uint32Array* localArray = ((struct JSCUint32Array::JSCUint32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint32Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint32Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Uint32Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<unsigned long> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Uint32Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Uint32Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCUint32Array::getTmpl();
-
- struct JSCUint32Array::JSCUint32ArrayPrivate* retPrivData = new JSCUint32Array::JSCUint32ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCUint32Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCUint32Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 4);
-}
-
-
-JSValueRef JSCUint32Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned long retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint32Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint32Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Uint32Array* localArray = ((struct JSCUint32Array::JSCUint32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned long localValue = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<unsigned long> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint32Array::getTmpl())) {
- uscxml::Uint32Array* localArray = ((struct JSCUint32Array::JSCUint32ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<unsigned long> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint32Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint32ArrayPrivate* privData = (struct JSCUint32ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCUint32Array::getTmpl();
-
- struct JSCUint32Array::JSCUint32ArrayPrivate* retPrivData = new JSCUint32Array::JSCUint32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCUint32Array::getTmpl();
-
- struct JSCUint32Array::JSCUint32ArrayPrivate* retPrivData = new JSCUint32Array::JSCUint32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h
deleted file mode 100644
index 5d6e371..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint32Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCUint32Array_h
-#define JSCUint32Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCUint32Array {
-public:
- struct JSCUint32ArrayPrivate {
- JSCDOM* dom;
- uscxml::Uint32Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCUint32ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Uint32Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCUint32Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp
deleted file mode 100644
index fbdbb14..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCUint8Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCUint8Array::Tmpl;
-
-JSStaticValue JSCUint8Array::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCUint8Array::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCUint8Array::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Uint8Array* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Uint8Array(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Uint8Array(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint8Array::getTmpl())) {
-
- uscxml::Uint8Array* localArray = ((struct JSCUint8Array::JSCUint8ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint8Array(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint8Array(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Uint8Array(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<unsigned char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Uint8Array(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Uint8Array");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCUint8Array::getTmpl();
-
- struct JSCUint8Array::JSCUint8ArrayPrivate* retPrivData = new JSCUint8Array::JSCUint8ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCUint8Array::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCUint8Array::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 1);
-}
-
-
-JSValueRef JSCUint8Array::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned char retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint8Array::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint8Array::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Uint8Array* localArray = ((struct JSCUint8Array::JSCUint8ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned char localValue = (unsigned char)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<unsigned char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint8Array::getTmpl())) {
- uscxml::Uint8Array* localArray = ((struct JSCUint8Array::JSCUint8ArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<unsigned char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint8Array::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint8ArrayPrivate* privData = (struct JSCUint8ArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCUint8Array::getTmpl();
-
- struct JSCUint8Array::JSCUint8ArrayPrivate* retPrivData = new JSCUint8Array::JSCUint8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCUint8Array::getTmpl();
-
- struct JSCUint8Array::JSCUint8ArrayPrivate* retPrivData = new JSCUint8Array::JSCUint8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h
deleted file mode 100644
index af9e79f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8Array.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCUint8Array_h
-#define JSCUint8Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCUint8Array {
-public:
- struct JSCUint8ArrayPrivate {
- JSCDOM* dom;
- uscxml::Uint8Array* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCUint8ArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Uint8Array";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCUint8Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp
deleted file mode 100644
index 848a507..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCArrayBuffer.h"
-#include "JSCArrayBufferView.h"
-#include "JSCUint8ClampedArray.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCUint8ClampedArray::Tmpl;
-
-JSStaticValue JSCUint8ClampedArray::staticValues[] = {
- { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { "BYTES_PER_ELEMENT", BYTES_PER_ELEMENTConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCUint8ClampedArray::staticFunctions[] = {
- { "get", getCallback, kJSPropertyAttributeDontDelete },
- { "set", setCallback, kJSPropertyAttributeDontDelete },
- { "subarray", subarrayCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSObjectRef JSCUint8ClampedArray::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- uscxml::Uint8ClampedArray* localInstance = NULL;
-
- if (false) {
- } else if (argumentCount == 3 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1]) &&
- JSValueIsNumber(ctx, arguments[2])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[2], exception);
- localInstance = new uscxml::Uint8ClampedArray(localBuffer, localByteOffset, localLength);
-
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localByteOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
- localInstance = new uscxml::Uint8ClampedArray(localBuffer, localByteOffset);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint8ClampedArray::getTmpl())) {
-
- uscxml::Uint8ClampedArray* localArray = ((struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint8ClampedArray(localArray);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCArrayBuffer::getTmpl())) {
-
- uscxml::ArrayBuffer* localBuffer = ((struct JSCArrayBuffer::JSCArrayBufferPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- localInstance = new uscxml::Uint8ClampedArray(localBuffer);
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
-
- unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- localInstance = new uscxml::Uint8ClampedArray(localLength);
-
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
-
- std::vector<unsigned char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- localInstance = new uscxml::Uint8ClampedArray(localArray);
-
- }
- if (!localInstance) {
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for Uint8ClampedArray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return (JSObjectRef)JSValueMakeNull(ctx);
- }
-
- JSClassRef retClass = JSCUint8ClampedArray::getTmpl();
-
- struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate* retPrivData = new JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
- return retObj;
-}
-
-JSValueRef JSCUint8ClampedArray::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->getLength());
-}
-
-JSValueRef JSCUint8ClampedArray::BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {
- return JSValueMakeNumber(ctx, 1);
-}
-
-
-JSValueRef JSCUint8ClampedArray::getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
-
- unsigned char retVal = privData->nativeObj->get(localIndex);
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling get");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint8ClampedArray::setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint8ClampedArray::getTmpl()) &&
- JSValueIsNumber(ctx, arguments[1])) {
- uscxml::Uint8ClampedArray* localArray = ((struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
- unsigned char localValue = (unsigned char)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localIndex, localValue);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 2 &&
- JSValueIsObject(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
-
- std::vector<unsigned char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
- unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[1], exception);
-
- privData->nativeObj->set(localArray, localOffset);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0]) && JSValueIsObjectOfClass(ctx, arguments[0], JSCUint8ClampedArray::getTmpl())) {
- uscxml::Uint8ClampedArray* localArray = ((struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- } else if (argumentCount == 1 &&
- JSValueIsObject(ctx, arguments[0])) {
-
- std::vector<unsigned char> localArray;
-
- JSValueRef localArrayItem;
- unsigned int localArrayIndex = 0;
- while((localArrayItem = JSObjectGetPropertyAtIndex(ctx, JSValueToObject(ctx, arguments[0], exception), localArrayIndex, exception))) {
- if (JSValueIsUndefined(ctx, localArrayItem))
- break;
- if (JSValueIsNumber(ctx,localArrayItem))
- localArray.push_back(JSValueToNumber(ctx, localArrayItem, exception));
- localArrayIndex++;
- }
-
- privData->nativeObj->set(localArray);
-
- JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling set");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCUint8ClampedArray::subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCUint8ClampedArrayPrivate* privData = (struct JSCUint8ClampedArrayPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 2 &&
- JSValueIsNumber(ctx, arguments[0]) &&
- JSValueIsNumber(ctx, arguments[1])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
- long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception);
-
- uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart, localEnd));
- JSClassRef retClass = JSCUint8ClampedArray::getTmpl();
-
- struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate* retPrivData = new JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- } else if (argumentCount == 1 &&
- JSValueIsNumber(ctx, arguments[0])) {
- long localStart = (long)JSValueToNumber(ctx, arguments[0], exception);
-
- uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart));
- JSClassRef retClass = JSCUint8ClampedArray::getTmpl();
-
- struct JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate* retPrivData = new JSCUint8ClampedArray::JSCUint8ClampedArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling subarray");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h
deleted file mode 100644
index 1558e48..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCUint8ClampedArray.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCUint8ClampedArray_h
-#define JSCUint8ClampedArray_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "JSCArrayBufferView.h"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCUint8ClampedArray {
-public:
- struct JSCUint8ClampedArrayPrivate {
- JSCDOM* dom;
- uscxml::Uint8ClampedArray* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCUint8ClampedArrayPrivate);
-
- static JSValueRef getCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef setCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef subarrayCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSObjectRef jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
- static JSValueRef lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef BYTES_PER_ELEMENTConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static bool hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
- static JSValueRef getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
- static bool setPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "Uint8ClampedArray";
- classDef.hasProperty = hasPropertyCustomCallback;
- classDef.getProperty = getPropertyCustomCallback;
- classDef.setProperty = setPropertyCustomCallback;
- classDef.callAsConstructor = jsConstructor;
- classDef.parentClass = JSCArrayBufferView::getTmpl();
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCUint8ClampedArray_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp
deleted file mode 100644
index eb443f6..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-#include "JSCNodeSet.h"
-#include "JSCXPathResult.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSClassRef JSCXPathResult::Tmpl;
-
-JSStaticValue JSCXPathResult::staticValues[] = {
- { "numberValue", numberValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "stringValue", stringValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "booleanValue", booleanValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
- { "singleNodeValue", singleNodeValueCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
-
- { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSCXPathResult::staticFunctions[] = {
- { "asNodeSet", asNodeSetCallback, kJSPropertyAttributeDontDelete },
- { "asBool", asBoolCallback, kJSPropertyAttributeDontDelete },
- { "asString", asStringCallback, kJSPropertyAttributeDontDelete },
- { "asNumber", asNumberCallback, kJSPropertyAttributeDontDelete },
- { 0, 0, 0 }
-};
-
-JSValueRef JSCXPathResult::numberValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeNumber(ctx, privData->nativeObj->asNumber());
-}
-
-
-JSValueRef JSCXPathResult::stringValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object);
-
- JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->asString().c_str());
- JSValueRef retVal = JSValueMakeString(ctx, stringRef);
- JSStringRelease(stringRef);
- return retVal;
-}
-
-
-JSValueRef JSCXPathResult::booleanValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) {
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object);
-
- return JSValueMakeBoolean(ctx, privData->nativeObj->asBool());
-}
-
-
-JSValueRef JSCXPathResult::asNodeSetCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
- JSClassRef retClass = JSCNodeSet::getTmpl();
-
- struct JSCNodeSet::JSCNodeSetPrivate* retPrivData = new JSCNodeSet::JSCNodeSetPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling asNodeSet");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCXPathResult::asBoolCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- bool retVal = privData->nativeObj->asBool();
-
- JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling asBool");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCXPathResult::asStringCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- std::string retVal = privData->nativeObj->asString();
-
- JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str());
- JSValueRef jscRetVal = JSValueMakeString(ctx, jscString);
- JSStringRelease(jscString);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling asString");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-JSValueRef JSCXPathResult::asNumberCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {
-
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj);
-
- if (false) {
- } else if (argumentCount == 0) {
-
- double retVal = privData->nativeObj->asNumber();
-
- JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal);
- return jscRetVal;
- }
-
- JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling asNumber");
- *exception = JSValueMakeString(ctx, exceptionString);
- JSStringRelease(exceptionString);
- return JSValueMakeUndefined(ctx);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h
deleted file mode 100644
index e145dc1..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef JSCXPathResult_h
-#define JSCXPathResult_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include <JavaScriptCore/JavaScriptCore.h>
-#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-class JSCXPathResult {
-public:
- struct JSCXPathResultPrivate {
- JSCDOM* dom;
- Arabica::XPath::XPathValue<std::string>* nativeObj;
- };
-
- JSC_DESTRUCTOR(JSCXPathResultPrivate);
-
- static JSValueRef asNodeSetCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef asBoolCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef asStringCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
- static JSValueRef asNumberCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception);
-
- static JSValueRef numberValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef stringValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef booleanValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
- static JSValueRef singleNodeValueCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);
-
-
- static JSStaticValue staticValues[];
- static JSStaticFunction staticFunctions[];
-
- static JSClassRef Tmpl;
- static JSClassRef getTmpl() {
- if (Tmpl == NULL) {
- JSClassDefinition classDef = kJSClassDefinitionEmpty;
- classDef.staticValues = staticValues;
- classDef.staticFunctions = staticFunctions;
- classDef.finalize = jsDestructor;
- classDef.className = "XPathResult";
-
- Tmpl = JSClassCreate(&classDef);
- JSClassRetain(Tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // JSCXPathResult_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp
deleted file mode 100644
index 42b4ea1..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResultCustom.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCXPathResult.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-JSValueRef JSCXPathResult::singleNodeValueCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
- struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj);
-
- Arabica::XPath::NodeSet<std::string> nodeSet = privData->nativeObj->asNodeSet();
- if (nodeSet.size() == 0)
- return JSValueMakeUndefined(ctx);
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(nodeSet[0]);
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.cpp
deleted file mode 100644
index c16bece..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/Common.h"
-#include "uscxml/config.h"
-#include "SpiderMonkeyDataModel.h"
-
-#include "uscxml/Message.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SpiderMonkeyDataModelProvider() );
- return true;
-}
-#endif
-
-static JSClass global_class = { "global",
- JSCLASS_NEW_RESOLVE | JSCLASS_GLOBAL_FLAGS,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_EnumerateStub,
- JS_ResolveStub,
- JS_ConvertStub,
- nullptr,
- JSCLASS_NO_OPTIONAL_MEMBERS
- };
-
-
-JSRuntime* SpiderMonkeyDataModel::_jsRuntime = NULL;
-
-SpiderMonkeyDataModel::SpiderMonkeyDataModel() {
- _jsCtx = NULL;
-}
-
-SpiderMonkeyDataModel::~SpiderMonkeyDataModel() {
- if (_jsCtx)
- JS_DestroyContext(_jsCtx);
-}
-
-void SpiderMonkeyDataModel::reportError(JSContext *cx, const char *message, JSErrorReport *report) {
-#if 0
- struct JSErrorReport {
- const char *filename; /* source file name, URL, etc., or null */
- uintN lineno; /* source line number */
- const char *linebuf; /* offending source line without final \n */
- const char *tokenptr; /* pointer to error token in linebuf */
- const jschar *uclinebuf; /* unicode (original) line buffer */
- const jschar *uctokenptr; /* unicode (original) token pointer */
- uintN flags; /* error/warning, etc. */
- uintN errorNumber; /* the error number, e.g. see js.msg */
- const jschar *ucmessage; /* the (default) error message */
- const jschar **messageArgs; /* arguments for the error message */
- };
- exceptionEvent.data.compound["stacktrace"] = Data(stackTrace, Data::VERBATIM);
-#endif
-
- Event exceptionEvent;
- exceptionEvent.name = "error.execution";
- exceptionEvent.eventType = Event::PLATFORM;
-
- exceptionEvent.data.compound["cause"] = Data(message, Data::VERBATIM);;
- exceptionEvent.data.compound["filename"] = Data(report->filename, Data::VERBATIM);
- exceptionEvent.data.compound["sourceline"] = Data(report->linebuf, Data::VERBATIM);
- exceptionEvent.data.compound["linenumber"] = Data(report->lineno, Data::INTERPRETED);
-
- std::stringstream ssUnderline;
- for (int i = 0; i < (report->tokenptr - report->linebuf); i++)
- ssUnderline << " ";
- ssUnderline << "^";
-
- exceptionEvent.data.compound["sourcemark"] = Data(ssUnderline.str(), Data::VERBATIM);
- throw exceptionEvent;
-}
-
-boost::shared_ptr<DataModelImpl> SpiderMonkeyDataModel::create(InterpreterImpl* interpreter) {
- if (_jsRuntime == NULL) {
- JSRuntime *rt = JS_NewRuntime(8L * 1024L * 1024L);
- if (!rt) {
- throw std::bad_alloc();
- }
- }
-
- boost::shared_ptr<SpiderMonkeyDataModel> dm = boost::shared_ptr<SpiderMonkeyDataModel>(new SpiderMonkeyDataModel());
- dm->_interpreter = interpreter;
- dm->_jsCtx = JS_NewContext(_jsRuntime, 8192);
- if (!dm->_jsCtx) {
- throw std::bad_alloc();
- }
- JS_SetOptions(dm->_jsCtx, JSOPTION_VAROBJFIX);
- JS_SetErrorReporter(dm->_jsCtx, reportError);
-
- dm->_global = JS_NewObject(dm->_jsCtx, &global_class, nullptr, nullptr);
- if (!JS_InitStandardClasses(dm->_jsCtx, dm->_global)) {
- throw std::bad_alloc();
- }
-
- return dm;
-}
-
-void SpiderMonkeyDataModel::pushContext() {
-}
-
-void SpiderMonkeyDataModel::popContext() {
-}
-
-void SpiderMonkeyDataModel::initialize() {
-}
-
-void SpiderMonkeyDataModel::setEvent(const Event& event) {
-}
-
-Data SpiderMonkeyDataModel::getStringAsData(const std::string& content) {
- Data data;
- return data;
-}
-
-
-bool SpiderMonkeyDataModel::validate(const std::string& location, const std::string& schema) {
- return true;
-}
-
-bool SpiderMonkeyDataModel::isLocation(const std::string& expr) {
- return true;
-}
-
-uint32_t SpiderMonkeyDataModel::getLength(const std::string& expr) {
- return 0;
-}
-
-void SpiderMonkeyDataModel::setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration) {
-}
-
-void SpiderMonkeyDataModel::eval(const Element<std::string>& scriptElem,
- const std::string& expr) {
-}
-
-bool SpiderMonkeyDataModel::isDeclared(const std::string& expr) {
- return true;
-}
-
-bool SpiderMonkeyDataModel::evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
-}
-
-bool SpiderMonkeyDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
-}
-
-std::string SpiderMonkeyDataModel::evalAsString(const std::string& expr) {
- return "";
-}
-
-double SpiderMonkeyDataModel::evalAsNumber(const std::string& expr) {
- return 0;
-}
-
-void SpiderMonkeyDataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
-}
-
-void SpiderMonkeyDataModel::assign(const std::string& location,
- const Data& data) {
-}
-
-void SpiderMonkeyDataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& doc,
- const std::string& content) {
-};
-
-void SpiderMonkeyDataModel::init(const std::string& location,
- const Data& data) {
-}
-
-std::string SpiderMonkeyDataModel::andExpressions(std::list<std::string> expressions) {
- if (expressions.size() == 0)
- return "";
-
- if (expressions.size() == 1)
- return *(expressions.begin());
-
- std::ostringstream exprSS;
- exprSS << "(";
- std::string conjunction = "";
- for (std::list<std::string>::const_iterator exprIter = expressions.begin();
- exprIter != expressions.end();
- exprIter++) {
- exprSS << conjunction << "(" << *exprIter << ")";
- conjunction = " && ";
- }
- exprSS << ")";
- return exprSS.str();
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.h
deleted file mode 100644
index d9a5e5e..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/SpiderMonkey/SpiderMonkeyDataModel.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SPIDERMONKEYDATAMODEL_H_88841EE2
-#define SPIDERMONKEYDATAMODEL_H_88841EE2
-
-#include "uscxml/Interpreter.h"
-#include <list>
-#include "jsapi.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-class Event;
-class Data;
-}
-
-namespace uscxml {
-
-class SpiderMonkeyDataModel : public DataModelImpl {
-public:
- SpiderMonkeyDataModel();
- virtual ~SpiderMonkeyDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("ecmascript");
- return names;
- }
-
- virtual void initialize();
- virtual void setEvent(const Event& event);
-
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
-
- virtual uint32_t getLength(const std::string& expr);
- virtual void setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration);
- virtual void pushContext();
- virtual void popContext();
-
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void assign(const std::string& location,
- const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void init(const std::string& location,
- const Data& data);
-
- virtual std::string andExpressions(std::list<std::string>);
-
- virtual Data getStringAsData(const std::string& content);
-
- virtual bool isDeclared(const std::string& expr);
-
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
- virtual bool evalAsBool(const std::string& expr);
- virtual double evalAsNumber(const std::string& expr);
-
- static void reportError(JSContext *cx, const char *message, JSErrorReport *report);
-
-protected:
-
- JSObject* _global;
-
- JSContext* _jsCtx;
- static JSRuntime* _jsRuntime;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(SpiderMonkeyDataModel, DataModelImpl);
-#endif
-
-}
-
-#endif /* end of include guard: SPIDERMONKEYDATAMODEL_H_88841EE2 */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/Storage.cpp b/src/uscxml/plugins/datamodel/ecmascript/Storage.cpp
deleted file mode 100644
index 980fc5d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/Storage.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "Storage.h"
-#include <iostream>
-#include <fstream>
-#include <istream>
-
-namespace uscxml {
-
-Storage::Storage(const std::string& filename) {
- _filename = filename;
-// std::cout << _filename << std::endl;
- std::fstream file;
- file.open(_filename.c_str(), std::ios_base::in);
- // read content into data
- std::string key;
- std::string value;
-
- while(std::getline(file, key, '\0')) {
- if(std::getline(file, value, '\0')) {
- _data[key] = value;
- }
- }
- file.close();
-}
-
-Storage::~Storage() {
- std::fstream file;
- file.open(_filename.c_str(), std::ios_base::out);
-// file.clear();
-
- std::map<std::string, std::string>::iterator dataIter = _data.begin();
- while(dataIter != _data.end()) {
- // include trailing \0
- file.write(dataIter->first.c_str(), dataIter->first.length() + 1);
- file.write(dataIter->second.c_str(), dataIter->second.length() + 1);
- dataIter++;
- }
-// file.flush();
- file.close();
-}
-
-unsigned long Storage::getLength() {
- return _data.size();
-}
-
-std::string Storage::key(unsigned long index) {
- if (index > getLength())
- return "";
-
- std::map<std::string, std::string>::iterator dataIter = _data.begin();
- for (unsigned int i = 0; i < index; i++) {
- dataIter++;
- }
- return dataIter->first;
-}
-
-std::string Storage::getItem(const std::string& key) {
- if (_data.find(key) == _data.end())
- return "";
- return _data[key];
-}
-
-void Storage::setItem(const std::string& key, const std::string& value) {
- _data[key] = value;
-}
-
-void Storage::removeItem(const std::string& key) {
- if (_data.find(key) == _data.end())
- return;
- _data.erase(key);
-}
-
-void Storage::clear() {
- _data.clear();
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/Storage.h b/src/uscxml/plugins/datamodel/ecmascript/Storage.h
deleted file mode 100644
index 35bde86..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/Storage.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef STORAGE_H_L672TNX
-#define STORAGE_H_L672TNX
-
-#include <string>
-#include <map>
-
-namespace uscxml {
-
-class Storage {
-public:
- Storage(const std::string& filename);
- ~Storage();
-
- unsigned long getLength();
- std::string key(unsigned long index);
- std::string getItem(const std::string& key);
- void setItem(const std::string& key, const std::string& value);
- void removeItem(const std::string& key);
- void clear();
-
-protected:
- std::map<std::string, std::string> _data;
- std::string _filename;
-};
-
-}
-
-#endif /* end of include guard: STORAGE_H_L672TNX */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp
deleted file mode 100644
index c8b73cf..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "TypedArray.h"
-#include "uscxml/Convenience.h"
-#include <iostream>
-
-#define DATAVIEW_TYPED_GET(type) \
-type retVal;\
-if (index + _start + sizeof(type) > _blob._impl->size)\
- return 0;\
-memcpy(&retVal, _blob._impl->data + (_start + index), sizeof(type));
-
-#define DATAVIEW_TYPED_SET(type) \
-if (index + _start + sizeof(type) > _blob._impl->size)\
- return;\
-memcpy(_blob._impl->data + (_start + index), &value, sizeof(type));
-
-namespace uscxml {
-
-ArrayBuffer::ArrayBuffer(unsigned long length) {
- _blob = Blob(length);
-}
-
-ArrayBuffer::ArrayBuffer(const Blob& blob) : _blob(blob) {
-}
-
-ArrayBuffer::ArrayBuffer(void* data, unsigned int size) {
- _blob = Blob((const char*)data, size, "application/octet-stream");
-}
-
-unsigned long ArrayBuffer::getByteLength() {
- if (!_blob)
- return 0;
- return _blob._impl->size;
-}
-
-ArrayBuffer ArrayBuffer::slice(long begin, long end) {
- if (!_blob) {
- return ArrayBuffer(0);
- }
- unsigned int realBegin = (begin + _blob._impl->size) % _blob._impl->size;
- unsigned int realEnd = (end + _blob._impl->size) % _blob._impl->size;
- if (realEnd < realBegin) {
- return ArrayBuffer(0);
- }
-
- ArrayBuffer arrBuffer(realEnd - realBegin);
- memcpy(arrBuffer._blob._impl->data, _blob._impl->data + realBegin, realEnd - realBegin);
- return arrBuffer;
-}
-
-ArrayBuffer ArrayBuffer::slice(long begin) {
- return slice(begin, _blob._impl->size);
-}
-
-bool ArrayBuffer::isView(void*) {
- return true;
-}
-
-ArrayBuffer::operator bool() {
- return !!_blob;
-}
-
-ArrayBuffer ArrayBufferView::getBuffer() {
- return ArrayBuffer(_blob);
-}
-
-DataView::DataView(ArrayBuffer* buffer, unsigned long byteOffset, unsigned long byteLength) {
- _start = byteOffset;
- if (_start > buffer->_blob._impl->size)
- return;
- _end = _start + byteLength;
- if (_end > buffer->_blob._impl->size)
- return;
- _blob = buffer->_blob;
-}
-
-DataView::DataView(ArrayBuffer* buffer , unsigned long byteOffset) {
- _start = byteOffset;
- _end = buffer->_blob._impl->size;
- if (_start > buffer->_blob._impl->size)
- return;
- _blob = buffer->_blob;
-}
-
-DataView::DataView(ArrayBuffer* buffer) {
- _start = 0;
- _end = (buffer->_blob._impl->size);
- _blob = buffer->_blob;
-}
-
-unsigned long DataView::getByteOffset() {
- return _start;
-}
-
-unsigned long DataView::getByteLength() {
- return _end - _start;
-}
-
-unsigned long DataView::getLength() {
- return _end - _start;
-}
-
-int8_t DataView::getInt8(unsigned long index) {
- DATAVIEW_TYPED_GET(int8_t);
- return retVal;
-}
-
-uint8_t DataView::getUint8(unsigned long index) {
- DATAVIEW_TYPED_GET(uint8_t);
- return retVal;
-}
-
-int16_t DataView::getInt16(unsigned long index, bool littleEndian) {
- DATAVIEW_TYPED_GET(int16_t);
-#ifdef BOOST_LITTLE_ENDIAN
- if (littleEndian)
- return retVal;
- return byte_swap<little_endian, big_endian>(retVal);
-#else
- if (littleEndian)
- return byte_swap<big_endian, little_endian>(retVal);
- return retVal;
-#endif
-}
-
-uint16_t DataView::getUint16(unsigned long index, bool littleEndian) {
- DATAVIEW_TYPED_GET(uint16_t);
-#ifdef BOOST_LITTLE_ENDIAN
- if (littleEndian)
- return retVal;
- return byte_swap<little_endian, big_endian>(retVal);
-#else
- if (littleEndian)
- return byte_swap<big_endian, little_endian>(retVal);
- return retVal;
-#endif
-}
-
-int32_t DataView::getInt32(unsigned long index, bool littleEndian) {
- DATAVIEW_TYPED_GET(int32_t);
-#ifdef BOOST_LITTLE_ENDIAN
- if (littleEndian)
- return retVal;
- return byte_swap<little_endian, big_endian>(retVal);
-#else
- if (littleEndian)
- return byte_swap<big_endian, little_endian>(retVal);
- return retVal;
-#endif
-}
-
-uint32_t DataView::getUint32(unsigned long index, bool littleEndian) {
- DATAVIEW_TYPED_GET(uint32_t);
-#ifdef BOOST_LITTLE_ENDIAN
- if (littleEndian)
- return retVal;
- return byte_swap<little_endian, big_endian>(retVal);
-#else
- if (littleEndian)
- return byte_swap<big_endian, little_endian>(retVal);
- return retVal;
-#endif
-}
-
-float DataView::getFloat32(unsigned long index, bool littleEndian) {
- DATAVIEW_TYPED_GET(float);
-#ifdef BOOST_LITTLE_ENDIAN
- if (littleEndian)
- return retVal;
- return byte_swap<little_endian, big_endian>(retVal);
-#else
- if (littleEndian)
- return byte_swap<big_endian, little_endian>(retVal);
- return retVal;
-#endif
-}
-
-double DataView::getFloat64(unsigned long index, bool littleEndian) {
- DATAVIEW_TYPED_GET(double);
-#ifdef BOOST_LITTLE_ENDIAN
- if (littleEndian)
- return retVal;
- return byte_swap<little_endian, big_endian>(retVal);
-#else
- if (littleEndian)
- return byte_swap<big_endian, little_endian>(retVal);
- return retVal;
-#endif
-}
-
-void DataView::setInt8(long index, int8_t value) {
- DATAVIEW_TYPED_SET(int8_t);
-}
-
-void DataView::setUint8(long index, uint8_t value) {
- DATAVIEW_TYPED_SET(uint8_t);
-}
-
-void DataView::setInt16(long index, int16_t value, bool littleEndian) {
-#ifdef BOOST_LITTLE_ENDIAN
- if (!littleEndian)
- value = byte_swap<little_endian, big_endian>(value);
-#else
- if (littleEndian)
- value = byte_swap<big_endian, little_endian>(value);
-#endif
- DATAVIEW_TYPED_SET(int16_t);
-}
-
-void DataView::setUint16(long index, uint16_t value, bool littleEndian) {
-#ifdef BOOST_LITTLE_ENDIAN
- if (!littleEndian)
- value = byte_swap<little_endian, big_endian>(value);
-#else
- if (littleEndian)
- value = byte_swap<big_endian, little_endian>(value);
-#endif
- DATAVIEW_TYPED_SET(uint16_t);
-}
-
-void DataView::setInt32(long index, int32_t value, bool littleEndian) {
-#ifdef BOOST_LITTLE_ENDIAN
- if (!littleEndian)
- value = byte_swap<little_endian, big_endian>(value);
-#else
- if (littleEndian)
- value = byte_swap<big_endian, little_endian>(value);
-#endif
- DATAVIEW_TYPED_SET(int32_t);
-}
-
-void DataView::setUint32(long index, uint32_t value, bool littleEndian) {
-#ifdef BOOST_LITTLE_ENDIAN
- if (!littleEndian)
- value = byte_swap<little_endian, big_endian>(value);
-#else
- if (littleEndian)
- value = byte_swap<big_endian, little_endian>(value);
-#endif
- DATAVIEW_TYPED_SET(uint32_t);
-}
-
-void DataView::setFloat32(long index, float value, bool littleEndian) {
-#ifdef BOOST_LITTLE_ENDIAN
- if (!littleEndian)
- value = byte_swap<little_endian, big_endian>(value);
-#else
- if (littleEndian)
- value = byte_swap<big_endian, little_endian>(value);
-#endif
- DATAVIEW_TYPED_SET(float);
-}
-
-void DataView::setFloat64(long index, double value, bool littleEndian) {
-#ifdef BOOST_LITTLE_ENDIAN
- if (!littleEndian)
- value = byte_swap<little_endian, big_endian>(value);
-#else
- if (littleEndian)
- value = byte_swap<big_endian, little_endian>(value);
-#endif
- DATAVIEW_TYPED_SET(double);
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h
deleted file mode 100644
index a49410c..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef TYPEDARRAY_H_99815BLY
-#define TYPEDARRAY_H_99815BLY
-
-#include "uscxml/Common.h"
-#include "uscxml/messages/Blob.h"
-
-#include <string>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <string.h>
-#include <inttypes.h>
-
-#include <boost/type_traits.hpp>
-#include <boost/static_assert.hpp>
-#include <stdexcept>
-
-
-namespace uscxml {
-
-/**
- * https://www.khronos.org/registry/typedarray/specs/latest/
- */
-
-class ArrayBuffer {
-public:
-
- ArrayBuffer(void* data, unsigned int size);
-
- /**
- * Creates a new ArrayBuffer of the given length in bytes. The contents of the
- * ArrayBuffer are initialized to 0. If the requested number of bytes could not
- * be allocated an exception is raised.
- */
- ArrayBuffer(unsigned long length);
- ArrayBuffer(const Blob&);
-
- /**
- * The length of the ArrayBuffer in bytes, as fixed at construction time.
- * Reading this property returns 0 if this ArrayBuffer has been neutered.
- */
- unsigned long getByteLength();
-
- /**
- * Returns a new ArrayBuffer whose contents are a copy of this ArrayBuffer's
- * bytes from begin, inclusive, up to end, exclusive. If either begin or end
- * is negative, it refers to an index from the end of the array, as opposed
- * to from the beginning.
- * If end is unspecified, the new ArrayBuffer contains all bytes from begin
- * to the end of this ArrayBuffer.
- * The range specified by the begin and end values is clamped to the valid
- * index range for the current array. If the computed length of the new
- * ArrayBuffer would be negative, it is clamped to zero.
- */
- ArrayBuffer slice(long begin, long end);
- ArrayBuffer slice(long begin);
- static bool isView(void*);
- unsigned long getLength() {
- return getByteLength();
- }
- operator bool();
- bool operator== (const ArrayBuffer& other) {
- return other._blob == _blob;
- }
-// unsigned char get(unsigned long index) {
-// if (index >= getLength())
-// return 0;
-// unsigned char retVal;
-// memcpy(&retVal, _blob->_data + index * sizeof(unsigned char), sizeof(unsigned char));
-// return retVal;
-// }
-//
-// void set(unsigned long index, unsigned char value) {
-// memcpy(_blob->_data + index * sizeof(unsigned char), &value, sizeof(unsigned char));
-// }
-
- // non-standard extension
- std::string md5() const {
- return _blob.md5();
- }
-
- // non-standard extension
- std::string base64() const {
- return _blob.base64();
- }
-
- std::string getMimeType() const {
- if (_blob)
- return _blob.getMimeType();
- return "";
- }
-
- void setMimeType(const std::string& mimeType) {
- if (_blob)
- _blob.setMimeType(mimeType);
- }
-
- Blob _blob;
-};
-
-class ArrayBufferView {
-public:
- virtual ~ArrayBufferView() {}
- /**
- * The ArrayBuffer that this ArrayBufferView references.
- */
- ArrayBuffer getBuffer();
-
- /**
- * The offset of this ArrayBufferView from the start of its ArrayBuffer, in
- * bytes, as fixed at construction time. Reading this property returns 0 if
- * the referenced ArrayBuffer has been neutered.
- */
- virtual unsigned long getByteOffset() = 0;
-
- /**
- * The length of the ArrayBufferView in bytes, as fixed at construction time.
- * Reading this property returns 0 if the referenced ArrayBuffer has been
- * neutered.
- */
- virtual unsigned long getByteLength() = 0;
- virtual unsigned long getLength() = 0;
-protected:
- Blob _blob;
- unsigned long _start;
- unsigned long _end;
-};
-
-
-class DataView : ArrayBufferView {
-public:
- /**
- * Create a new DataView object using the passed ArrayBuffer for its storage.
- * Optional byteOffset and byteLength can be used to limit the section of the
- * buffer referenced. The byteOffset indicates the offset in bytes from the
- * start of the ArrayBuffer, and the byteLength is the number of bytes from the
- * offset that this DataView will reference. If both byteOffset and byteLength
- * are omitted, the DataView spans the entire ArrayBuffer range. If the
- * byteLength is omitted, the DataView extends from the given byteOffset until
- * the end of the ArrayBuffer.
- * If the given byteOffset and byteLength references an area beyond the end of
- * the ArrayBuffer an exception is raised.
- */
-
- DataView(ArrayBuffer*, unsigned long, unsigned long);
- DataView(ArrayBuffer*, unsigned long);
- DataView(ArrayBuffer*);
-
- unsigned long getByteOffset();
- unsigned long getByteLength();
- unsigned long getLength();
-
- /**
- * Gets the value of the given type at the specified byte offset
- * from the start of the view. There is no alignment constraint;
- * multi-byte values may be fetched from any offset.
- * For multi-byte values, the optional littleEndian argument
- * indicates whether a big-endian or little-endian value should be
- * read. If false or undefined, a big-endian value is read.
- * These methods raise an exception if they would read
- * beyond the end of the view.
- */
-
- int8_t getInt8(unsigned long);
- uint8_t getUint8(unsigned long);
- int16_t getInt16(unsigned long, bool = false);
- uint16_t getUint16(unsigned long, bool = false);
- int32_t getInt32(unsigned long, bool = false);
- uint32_t getUint32(unsigned long, bool = false);
- float getFloat32(unsigned long, bool = false);
- double getFloat64(unsigned long, bool = false);
-
- /**
- * Stores a value of the given type at the specified byte offset
- * from the start of the view. There is no alignment constraint;
- * multi-byte values may be stored at any offset.
- * For multi-byte values, the optional littleEndian argument
- * indicates whether the value should be stored in big-endian or
- * little-endian byte order. If false or undefined, the value is
- * stored in big-endian byte order.
- * These methods raise an exception if they would write
- * beyond the end of the view.
- */
-
- void setInt8(long, int8_t);
- void setUint8(long, uint8_t);
- void setInt16(long, int16_t, bool = false);
- void setUint16(long, uint16_t, bool = false);
- void setInt32(long, int32_t, bool = false);
- void setUint32(long, uint32_t, bool = false);
- void setFloat32(long, float, bool = false);
- void setFloat64(long, double, bool = false);
-
-};
-
-template<class T, class S> class TypedArray : public ArrayBufferView {
-public:
- virtual ~TypedArray() {}
-
- /**
- * Create a new TypedArray object using the passed ArrayBuffer for its storage.
- * Optional byteOffset and length can be used to limit the section of the buffer
- * referenced. The byteOffset indicates the offset in bytes from the start of
- * the ArrayBuffer, and the length is the count of elements from the offset
- * that this TypedArray will reference. If both byteOffset and length are
- * omitted, the TypedArray spans the entire ArrayBuffer range. If the length
- * is omitted, the TypedArray extends from the given byteOffset until the end
- * of the ArrayBuffer.
- * The given byteOffset must be a multiple of the element size of the specific
- * type, otherwise an exception is raised.
- * If a given byteOffset and length references an area beyond the end of the
- * ArrayBuffer an exception is raised.
- * If length is not explicitly specified, the length of the ArrayBuffer minus
- * the byteOffset must be a multiple of the element size of the specific type,
- * or an exception is raised.
- */
- TypedArray(uscxml::ArrayBuffer* buffer, unsigned long byteOffset, unsigned long length) {
- if (byteOffset % sizeof(S))
- return;
-
- _start = byteOffset / sizeof(S);
- _end = _start + length;
-
- if (_end > buffer->_blob._impl->size / sizeof(S))
- return;
-
- _blob = buffer->_blob;
- }
- TypedArray(uscxml::ArrayBuffer* buffer, unsigned long byteOffset) {
- if (byteOffset % sizeof(S))
- return;
-
- _start = byteOffset / sizeof(S);
- _end = buffer->_blob._impl->size / sizeof(S);
- _blob = buffer->_blob;
- }
- TypedArray(uscxml::ArrayBuffer* buffer) {
- _start = 0;
- _end = (buffer->_blob._impl->size) / sizeof(S);
- _blob = buffer->_blob;
- }
-
- TypedArray(Blob blob, unsigned long byteOffset, unsigned long length) {
- if (byteOffset % sizeof(S))
- return;
-
- _start = byteOffset / sizeof(S);
- _end = _start + length;
-
- if (_end > blob._impl->size / sizeof(S))
- return;
-
- _blob = blob;
- }
-
- /**
- * Create a new ArrayBuffer with enough bytes to hold length elements of this
- * typed array, then creates a typed array view referring to the full buffer.
- * As with a directly constructed ArrayBuffer, the contents are initialized
- * to 0. If the requested number of bytes could not be allocated an exception
- * is raised.
- */
- TypedArray(unsigned long length) {
- _start = 0;
- _end = length;
- _blob = Blob(length * sizeof(S));
- }
-
- /**
- * Create a new ArrayBuffer with enough bytes to hold array.length elements of
- * this typed array, then creates a typed array view referring to the full
- * buffer. The contents of the new view are initialized to the contents of the
- * given array or typed array, with each element converted to the appropriate
- * typed array type.
- */
- TypedArray(std::vector<T> data) {
- _start = 0;
- _end = data.size();
- _blob = Blob(data.size() * sizeof(S));
- set(data, 0);
- }
- TypedArray(TypedArray* other) {
- _start = other->_start;
- _end = other->_end;
- _blob = other->_blob;
- }
-
- /**
- * This is an index getter.
- * Returns the element at the given numeric index.
- */
- T get(unsigned long index) {
- if (index >= getLength())
- return static_cast<T>(0);
- S retVal;
- memcpy(&retVal, _blob._impl->data + (_start + index) * sizeof(S), sizeof(S));
- return retVal;
- }
-
- /**
- * This is an index setter.
- * Sets the element at the given numeric index to the given value.
- */
- void set(unsigned long index, T value) {
- memcpy(_blob._impl->data + (_start + index) * sizeof(S), &value, sizeof(S));
- }
-
- /**
- * Set multiple values, reading input values from the array.
- * The optional offset value indicates the index in the current array where
- * values are written. If omitted, it is assumed to be 0.
- * If the input array is a TypedArray, the two arrays may use the same
- * underlying ArrayBuffer. In this situation, setting the values takes place
- * as if all the data is first copied into a temporary buffer that does not
- * overlap either of the arrays, and then the data from the temporary buffer
- * is copied into the current array.
- * If the offset plus the length of the given array is out of range for the
- * current TypedArray, an exception is raised.
- */
- void set(TypedArray<T, S>* value, unsigned long offset) {
- if (!_blob)
- return;
- if (offset * sizeof(S) + value->getByteLength() > _blob._impl->size)
- return;
-
- unsigned long otherOffset = value->_start * sizeof(S);
-
- // will this work if we use the same buffer?
- memcpy(_blob._impl->data + (_start + offset) * sizeof(S), value->_blob._impl->data + otherOffset, value->getByteLength());
- }
-
- void set(TypedArray<T, S>* value) {
- set(value, 0);
- }
-
- /**
- * Set multiple values, reading input values from the array.
- * The optional offset value indicates the index in the current array where
- * values are written. If omitted, it is assumed to be 0.
- * If the input array is a TypedArray, the two arrays may use the same
- * underlying ArrayBuffer. In this situation, setting the values takes place
- * as if all the data is first copied into a temporary buffer that does not
- * overlap either of the arrays, and then the data from the temporary buffer
- * is copied into the current array.
- * If the offset plus the length of the given array is out of range for the
- * current TypedArray, an exception is raised.
- */
- void set(std::vector<T> data, unsigned long offset) {
- if (!_blob)
- return;
- if (data.size() + offset > _end)
- return;
-
- if (sizeof(T) == sizeof(S)) {
- memcpy(_blob._impl->data + offset, (void*)&data[0], data.size() * sizeof(S));
- } else {
- S* buffer = (S*)malloc(data.size() * sizeof(S));
- typename std::vector<T>::const_iterator dataIter = data.begin();
- unsigned long i = 0;
- while(dataIter != data.end()) {
- buffer[i] = *dataIter;
- dataIter++;
- i++;
- }
- memcpy(_blob._impl->data + offset, buffer, data.size() * sizeof(S));
- free (buffer);
- }
- }
-
- void set(std::vector<T> data) {
- set(data, 0);
- }
-
- /**
- * Returns a new TypedArray view of the ArrayBuffer store for this TypedArray,
- * referencing the elements at begin, inclusive, up to end, exclusive. If
- * either begin or end is negative, it refers to an index from the end of the
- * array, as opposed to from the beginning.
- * If end is unspecified, the subarray contains all elements from begin to the
- * end of the TypedArray.
- * The range specified by the begin and end values is clamped to the valid
- * index range for the current array. If the computed length of the new
- * TypedArray would be negative, it is clamped to zero.
- * The returned TypedArray will be of the same type as the array on which this
- * method is invoked.
- */
- TypedArray* subarray(long begin, long end) {
- if (!_blob)
- return NULL;
- unsigned int length = getLength();
- unsigned int realBegin = (begin + length) % length;
- unsigned int realEnd = (end + length) % length;
- if (realEnd == 0)
- realEnd = length;
-
- if (realEnd < realBegin)
- return NULL;
-
- return new TypedArray<T, S>(_blob, realBegin * sizeof(S), realEnd - realBegin);
- }
-
- TypedArray* subarray(long begin) {
- if (!_blob)
- return NULL;
- return subarray(begin, getLength());
- }
-
- unsigned long getLength() {
- if (!_blob)
- return 0;
- return _end - _start;
- }
-
- unsigned long getByteLength() {
- if (!_blob)
- return 0;
- return (_end - _start) * sizeof(S);
- }
-
- unsigned long getByteOffset() {
- if (!_blob)
- return 0;
- return _start * sizeof(S);
- }
-
-};
-
-/**
- * Define actual types as template instances.
- * First argument is representation from JavaScript, second type maybe smaller to
- * exactly specify the byte width ot the TypedArray.
- */
-typedef TypedArray<unsigned char, uint8_t> Uint8Array;
-typedef TypedArray<unsigned char, uint8_t> Uint8ClampedArray;
-typedef TypedArray<char, int8_t> Int8Array;
-typedef TypedArray<short, int16_t> Int16Array;
-typedef TypedArray<unsigned short, uint16_t> Uint16Array;
-typedef TypedArray<long, int32_t> Int32Array;
-typedef TypedArray<unsigned long, uint32_t> Uint32Array;
-typedef TypedArray<float, float> Float32Array;
-typedef TypedArray<double, double> Float64Array;
-
-}
-
-#endif /* end of include guard: TYPEDARRAY_H_99815BLY */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp
deleted file mode 100644
index 87e7966..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8DOM.h"
-
-namespace Arabica {
-namespace DOM {
-
-V8DOM::V8DOM() {
- nsInfo = NULL;
- xpath = NULL;
- storage = NULL;
-}
-
-V8DOM::~V8DOM() {
- if (nsInfo)
- delete(nsInfo);
- if (xpath)
- delete(xpath);
- if (storage)
- delete(storage);
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp.inc b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp.inc
new file mode 100644
index 0000000..a0d8ae6
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.cpp.inc
@@ -0,0 +1,9365 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.8
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+ struct SwigMovePointer {
+ T *ptr;
+ SwigMovePointer(T *p) : ptr(p) { }
+ ~SwigMovePointer() { delete ptr; }
+ SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+ } pointer;
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+ SwigValueWrapper() : pointer(0) { }
+ SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+ operator T&() const { return *pointer.ptr; }
+ T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+ return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * This section contains generic SWIG labels for method/variable
+ * declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+# define SWIGINLINE inline
+# else
+# define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+# elif defined(__ICC)
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+# pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+# define SWIGUNUSEDPARM(p)
+# else
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# ifndef GCC_HASCLASSVISIBILITY
+# define GCC_HASCLASSVISIBILITY
+# endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT
+# else
+# define SWIGEXPORT __declspec(dllexport)
+# endif
+# else
+# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+# define SWIGEXPORT __attribute__ ((visibility("default")))
+# else
+# define SWIGEXPORT
+# endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# define SWIGSTDCALL __stdcall
+# else
+# define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
+#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
+# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
+#endif
+
+/* Intel's compiler complains if a variable which was never initialised is
+ * cast to void, which is a common idiom which we use to indicate that we
+ * are aware a variable isn't used. So we just silence that warning.
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
+ */
+#ifdef __INTEL_COMPILER
+# pragma warning disable 592
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+
+
+
+#ifndef SWIG_V8_VERSION
+#define SWIG_V8_VERSION 0x031110
+#endif
+
+
+#include <v8.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+ or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+ creating a static or dynamic library from the SWIG runtime code.
+ In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+ But only do this if strictly necessary, ie, if you have problems
+ with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/* Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN 0x1
+
+
+/*
+ Flags/methods for returning states.
+
+ The SWIG conversion methods, as ConvertPtr, return an integer
+ that tells if the conversion was successful or not. And if not,
+ an error code can be returned (see swigerrors.swg for the codes).
+
+ Use the following macros/flags to set or process the returning
+ states.
+
+ In old versions of SWIG, code such as the following was usually written:
+
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+ // success code
+ } else {
+ //fail code
+ }
+
+ Now you can be more explicit:
+
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ } else {
+ // fail code
+ }
+
+ which is the same really, but now you can also do
+
+ Type *ptr;
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ if (SWIG_IsNewObj(res) {
+ ...
+ delete *ptr;
+ } else {
+ ...
+ }
+ } else {
+ // fail code
+ }
+
+ I.e., now SWIG_ConvertPtr can return new objects and you can
+ identify the case and take care of the deallocation. Of course that
+ also requires SWIG_ConvertPtr to return new result values, such as
+
+ int SWIG_ConvertPtr(obj, ptr,...) {
+ if (<obj is ok>) {
+ if (<need new object>) {
+ *ptr = <ptr to new allocated object>;
+ return SWIG_NEWOBJ;
+ } else {
+ *ptr = <ptr to old object>;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ return SWIG_BADOBJ;
+ }
+ }
+
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+ SWIG errors code.
+
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+ allows to return the 'cast rank', for example, if you have this
+
+ int food(double)
+ int fooi(int);
+
+ and you call
+
+ food(1) // cast rank '1' (1 -> 1.0)
+ fooi(1) // cast rank '0'
+
+ just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK (0)
+#define SWIG_ERROR (-1)
+#define SWIG_IsOK(r) (r >= 0)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ (SWIG_ERROR)
+#define SWIG_OLDOBJ (SWIG_OK)
+#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+# ifndef SWIG_TypeRank
+# define SWIG_TypeRank unsigned long
+# endif
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# define SWIG_MAXCASTRANK (2)
+# endif
+# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
+# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+# define SWIG_AddCast(r) (r)
+# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+} swig_module_info;
+
+/*
+ Compare two type names skipping the space characters, therefore
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+ Return 0 when the two name types are equivalent, as in
+ strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+ const char *f2, const char *l2) {
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+ }
+ return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+ int equiv = 1;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (equiv != 0 && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
+ }
+ equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+ if (*ne) ++ne;
+ }
+ return equiv;
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+ return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+ Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+ if (ty) {
+ swig_cast_info *iter = ty->cast;
+ while (iter) {
+ if (strcmp(iter->type->name, c) == 0) {
+ if (iter == ty->cast)
+ return iter;
+ /* Move iter to the top of the linked list */
+ iter->prev->next = iter->next;
+ if (iter->next)
+ iter->next->prev = iter->prev;
+ iter->next = ty->cast;
+ iter->prev = 0;
+ if (ty->cast) ty->cast->prev = iter;
+ ty->cast = iter;
+ return iter;
+ }
+ iter = iter->next;
+ }
+ }
+ return 0;
+}
+
+/*
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+ if (ty) {
+ swig_cast_info *iter = ty->cast;
+ while (iter) {
+ if (iter->type == from) {
+ if (iter == ty->cast)
+ return iter;
+ /* Move iter to the top of the linked list */
+ iter->prev->next = iter->next;
+ if (iter->next)
+ iter->next->prev = iter->prev;
+ iter->next = ty->cast;
+ iter->prev = 0;
+ if (ty->cast) ty->cast->prev = iter;
+ ty->cast = iter;
+ return iter;
+ }
+ iter = iter->next;
+ }
+ }
+ return 0;
+}
+
+/*
+ Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+ Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast) return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast)(ptr);
+ if (ty) lastty = ty;
+ }
+ return lastty;
+}
+
+/*
+ Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
+
+/*
+ Return the pretty name associated with this type,
+ that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type) return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|') last_name = s+1;
+ return last_name;
+ }
+ else
+ return type->name;
+}
+
+/*
+ Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+}
+
+/*
+ Search for a swig_type_info structure only by mangled name
+ Search is a O(log #types)
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ size_t l = 0;
+ size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
+}
+
+/*
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
+ It first searches the mangled names of the types, which is a O(log #types)
+ If a type is not found it then searches the human readable names, which is O(#types).
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+}
+
+/*
+ Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
+
+/*
+ Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ char d = *(c++);
+ unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+}
+
+/*
+ Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+ strcpy(r,name);
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2*sz + 2 + lname) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ if (lname) {
+ strncpy(r,name,lname+1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ memset(ptr,0,sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Errors in SWIG */
+#define SWIG_UnknownError -1
+#define SWIG_IOError -2
+#define SWIG_RuntimeError -3
+#define SWIG_IndexError -4
+#define SWIG_TypeError -5
+#define SWIG_DivisionByZero -6
+#define SWIG_OverflowError -7
+#define SWIG_SyntaxError -8
+#define SWIG_ValueError -9
+#define SWIG_SystemError -10
+#define SWIG_AttributeError -11
+#define SWIG_MemoryError -12
+#define SWIG_NullReferenceError -13
+
+
+
+/* ---------------------------------------------------------------------------
+ * These typedefs and defines are used to deal with v8 API changes
+ *
+ * ---------------------------------------------------------------------------*/
+
+// First v8 version that uses "SetWeak" and not "MakeWeak"
+
+#define SWIGV8_SETWEAK_VERSION 0x032224
+
+#if (SWIG_V8_VERSION < 0x031803)
+#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
+#else
+#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
+#endif
+
+#if (SWIG_V8_VERSION < 0x031903)
+typedef v8::Handle<v8::Value> SwigV8ReturnValue;
+typedef v8::Arguments SwigV8Arguments;
+typedef v8::AccessorInfo SwigV8PropertyCallbackInfo;
+#define SWIGV8_RETURN(val) return scope.Close(val)
+#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val)
+#else
+typedef void SwigV8ReturnValue;
+typedef v8::FunctionCallbackInfo<v8::Value> SwigV8Arguments;
+typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
+#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return
+#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return
+#endif
+
+#if (SWIG_V8_VERSION < 0x032117)
+#define SWIGV8_HANDLESCOPE() v8::HandleScope scope
+#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope
+#define SWIGV8_ESCAPE(val) return scope.Close(val)
+#elif (SWIG_V8_VERSION < 0x032224)
+#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
+#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent());
+#define SWIGV8_ESCAPE(val) return scope.Close(val)
+#else
+#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
+#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent());
+#define SWIGV8_ESCAPE(val) return scope.Escape(val)
+#endif
+
+#if (SWIG_V8_VERSION < 0x032224)
+#define SWIGV8_ADJUST_MEMORY(size) v8::V8::AdjustAmountOfExternalAllocatedMemory(size)
+#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent()
+#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
+#define SWIGV8_STRING_NEW(str) v8::String::New(str)
+#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
+#else
+#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
+#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
+#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
+#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
+#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
+#endif
+
+#if (SWIG_V8_VERSION < 0x032318)
+#define SWIGV8_ARRAY_NEW() v8::Array::New()
+#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool)
+#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val)
+#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
+#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New()
+#define SWIGV8_INT32_NEW(num) v8::Int32::New(num)
+#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(num)
+#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(num)
+#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num)
+#define SWIGV8_OBJECT_NEW() v8::Object::New()
+#define SWIGV8_UNDEFINED() v8::Undefined()
+#define SWIGV8_NULL() v8::Null()
+#else
+#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent())
+#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool)
+#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val)
+#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func)
+#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New(v8::Isolate::GetCurrent())
+#define SWIGV8_INT32_NEW(num) v8::Int32::New(v8::Isolate::GetCurrent(), num)
+#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(v8::Isolate::GetCurrent(), num)
+#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), num)
+#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num)
+#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent())
+#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent())
+#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent())
+#endif
+
+#if (SWIG_V8_VERSION < 0x031710)
+#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(class);
+#elif (SWIG_V8_VERSION < 0x031900)
+#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), class);
+#else
+#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
+#endif
+
+/* ---------------------------------------------------------------------------
+ * Error handling
+ *
+ * ---------------------------------------------------------------------------*/
+
+#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg)
+#define SWIG_exception(code, msg) SWIGV8_ErrorHandler.error(code, msg)
+#define SWIG_fail goto fail
+#define SWIGV8_OVERLOAD false
+
+SWIGINTERN void SWIG_V8_Raise(const char *msg) {
+ SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg)));
+}
+
+/*
+ Note: There are two contexts for handling errors.
+ A static V8ErrorHandler is used in not overloaded methods.
+ For overloaded methods the throwing type checking mechanism is used
+ during dispatching. As V8 exceptions can not be resetted properly
+ the trick is to use a dynamic ErrorHandler with same local name as the global
+ one.
+
+ - See defintion of SWIG_Error above.
+ - See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload',
+ and 'JS_function_dispatch_case' in javascriptcode.swg
+
+*/
+class V8ErrorHandler {
+public:
+ virtual ~V8ErrorHandler() {}
+ virtual void error(int code, const char *msg) {
+ SWIG_V8_Raise(msg);
+ }
+};
+// this is used in usually
+SWIGRUNTIME V8ErrorHandler SWIGV8_ErrorHandler;
+
+// instances of this are used in overloaded functions
+class OverloadErrorHandler: public V8ErrorHandler {
+public:
+ virtual void error(int code, const char *msg) {
+ err = v8::Exception::Error(SWIGV8_STRING_NEW(msg));
+ if(code != SWIG_TypeError) {
+ SWIGV8_THROW_EXCEPTION(err);
+ }
+ }
+ v8::Handle<v8::Value> err;
+};
+
+/* ---------------------------------------------------------------------------
+ * Basic Proxy object
+ *
+ * ---------------------------------------------------------------------------*/
+
+// Note: to trigger the v8 gc more often one can tell v8 about the memory consumption
+// TODO: we could add a v8 specific parameter to control this value
+#define SWIGV8_AVG_OBJ_SIZE 1000
+
+class SWIGV8_Proxy {
+public:
+ SWIGV8_Proxy(): swigCMemOwn(false), swigCObject(0), info(0) {
+ SWIGV8_ADJUST_MEMORY(SWIGV8_AVG_OBJ_SIZE);
+ };
+
+ ~SWIGV8_Proxy() {
+#if (SWIG_V8_VERSION < 0x031710)
+ handle.ClearWeak();
+ handle.Dispose();
+#elif (SWIG_V8_VERSION < 0x032100)
+ handle.ClearWeak(v8::Isolate::GetCurrent());
+ handle.Dispose(v8::Isolate::GetCurrent());
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ handle.ClearWeak();
+ handle.Dispose();
+#else
+ handle.ClearWeak();
+ handle.Reset();
+#endif
+
+#if (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ handle.Clear();
+#endif
+
+ SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE);
+ }
+
+ bool swigCMemOwn;
+ void *swigCObject;
+ swig_type_info *info;
+ v8::Persistent<v8::Object> handle;
+};
+
+class SWIGV8_ClientData {
+public:
+ v8::Persistent<v8::FunctionTemplate> class_templ;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ void (*dtor) (v8::Persistent< v8::Value> object, void *parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
+#else
+ void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
+#endif
+};
+
+SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
+
+SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
+ SWIGV8_HANDLESCOPE();
+
+ if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
+
+#if (SWIG_V8_VERSION < 0x031511)
+ v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
+ SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
+#else
+ SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
+#endif
+
+ if(cdata == NULL) {
+ return SWIG_ERROR;
+ }
+ if(cdata->info != info) {
+ swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info);
+ if (!tc && cdata->info->name) {
+ tc = SWIG_TypeCheck(cdata->info->name, info);
+ }
+ bool type_valid = tc != 0;
+ if(!type_valid) {
+ return SWIG_TypeError;
+ }
+ }
+ *ptr = cdata->swigCObject;
+ if(flags & SWIG_POINTER_DISOWN) {
+ cdata->swigCMemOwn = false;
+ }
+ return SWIG_OK;
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Value > object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
+#else
+SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ delete proxy;
+}
+
+SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
+ if(!valRef->IsObject()) {
+ return SWIG_TypeError;
+ }
+ v8::Handle<v8::Object> objRef = valRef->ToObject();
+
+ if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
+
+#if (SWIG_V8_VERSION < 0x031511)
+ v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
+ SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
+#else
+ SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
+#endif
+
+ if(cdata == NULL) {
+ return SWIG_ERROR;
+ }
+
+ *ptr = cdata->swigCObject;
+
+ return SWIG_OK;
+}
+
+SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
+ SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
+ cdata->swigCObject = ptr;
+ cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
+ cdata->info = info;
+
+#if (SWIG_V8_VERSION < 0x031511)
+ obj->SetPointerInInternalField(0, cdata);
+#else
+ obj->SetAlignedPointerInInternalField(0, cdata);
+#endif
+
+#if (SWIG_V8_VERSION < 0x031710)
+ cdata->handle = v8::Persistent<v8::Object>::New(obj);
+#elif (SWIG_V8_VERSION < 0x031900)
+ cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
+#else
+ cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
+#endif
+
+#if (SWIG_V8_VERSION < 0x031710)
+ // clientdata must be set for owned data as we need to register the dtor
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
+ } else {
+ cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
+ }
+#elif (SWIG_V8_VERSION < 0x031918)
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
+ } else {
+ cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Proxy_DefaultDtor);
+ }
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
+ } else {
+ cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
+ }
+#else
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
+ } else {
+ cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
+ }
+#endif
+
+#if (SWIG_V8_VERSION < 0x031710)
+ cdata->handle.MarkIndependent();
+#elif (SWIG_V8_VERSION < 0x032100)
+ cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
+#else
+ cdata->handle.MarkIndependent();
+#endif
+
+}
+
+SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
+ SWIGV8_HANDLESCOPE();
+
+ /* special case: JavaScript null => C NULL pointer */
+ if(valRef->IsNull()) {
+ *ptr=0;
+ return SWIG_OK;
+ }
+ if(!valRef->IsObject()) {
+ return SWIG_TypeError;
+ }
+ v8::Handle<v8::Object> objRef = valRef->ToObject();
+ return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
+}
+
+SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
+ SWIGV8_HANDLESCOPE_ESC();
+
+ v8::Handle<v8::FunctionTemplate> class_templ;
+
+ if (ptr == NULL) {
+#if (SWIG_V8_VERSION < 0x031903)
+ SWIGV8_ESCAPE(SWIGV8_NULL());
+#else
+ v8::Local<v8::Primitive> result = SWIGV8_NULL();
+ SWIGV8_ESCAPE(result);
+#endif
+ }
+
+#if (SWIG_V8_VERSION < 0x031903)
+ if(info->clientdata != 0) {
+ class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;
+ } else {
+ class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ;
+ }
+#else
+ v8::Isolate *isolate = v8::Isolate::GetCurrent();
+
+ if(info->clientdata != 0) {
+ class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, ((SWIGV8_ClientData*) info->clientdata)->class_templ);
+ } else {
+ class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ);
+ }
+#endif
+
+// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+ v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+ SWIGV8_SetPrivateData(result, ptr, info, flags);
+
+ SWIGV8_ESCAPE(result);
+}
+
+#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_V8_ConvertPtr(obj, ptr, info, flags)
+#define SWIG_NewPointerObj(ptr, info, flags) SWIG_V8_NewPointerObj(ptr, info, flags)
+
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_V8_ConvertInstancePtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_V8_NewPointerObj(thisvalue, type, flags)
+
+#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_V8_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_V8_NewPointerObj(ptr, type, 0)
+
+#define SWIG_GetInstancePtr(obj, ptr) SWIG_V8_GetInstancePtr(obj, ptr)
+
+SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ void *arg1 = (void *) 0 ;
+ void *arg2 = (void *) 0 ;
+ bool result;
+ int res1;
+ int res2;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for equals.");
+
+ res1 = SWIG_GetInstancePtr(args.Holder(), &arg1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ERROR, "Could not get pointer from 'this' object for equals.");
+ }
+ res2 = SWIG_GetInstancePtr(args[0], &arg2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "1"" of type '" "void *""'");
+ }
+
+ result = (bool)(arg1 == arg2);
+ jsresult = SWIGV8_BOOLEAN_NEW(result);
+
+ SWIGV8_RETURN(jsresult);
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ void *arg1 = (void *) 0 ;
+ long result;
+ int res1;
+
+ res1 = SWIG_GetInstancePtr(args.Holder(), &arg1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCPtr" "', argument " "1"" of type '" "void *""'");
+ }
+
+ result = (long)arg1;
+ jsresult = SWIGV8_NUMBER_NEW(result);
+
+ SWIGV8_RETURN(jsresult);
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+/* ---------------------------------------------------------------------------
+ * PackedData object
+ *
+ * ---------------------------------------------------------------------------*/
+
+class SwigV8PackedData {
+public:
+ SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(data), size(size), type(type) {};
+
+ ~SwigV8PackedData() {
+ };
+
+ void *data;
+ size_t size;
+ swig_type_info *type;
+
+ v8::Persistent<v8::Object> handle;
+};
+
+SWIGRUNTIMEINLINE
+int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> objRef = valRef->ToObject();
+ if(objRef->InternalFieldCount() < 1) return false;
+ v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
+ return (flag->IsBoolean() && flag->BooleanValue());
+}
+
+SWIGRUNTIME
+swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
+ if (SwigV8Packed_Check(valRef)) {
+ SWIGV8_HANDLESCOPE();
+
+ SwigV8PackedData *sobj;
+
+ v8::Handle<v8::Object> objRef = valRef->ToObject();
+
+#if (SWIG_V8_VERSION < 0x031511)
+ v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
+ sobj = static_cast<SwigV8PackedData*>(v8::External::Unwrap(cdataRef));
+#else
+ sobj = static_cast<SwigV8PackedData*>(objRef->GetAlignedPointerFromInternalField(0));
+#endif
+ if (sobj == NULL || sobj->size != size) return 0;
+ memcpy(ptr, sobj->data, size);
+ return sobj->type;
+ } else {
+ return 0;
+ }
+}
+
+SWIGRUNTIME
+int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
+ swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
+ if (!to) return SWIG_ERROR;
+ if (ty) {
+ if (to != ty) {
+ /* check type cast? */
+ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+ if (!tc) return SWIG_ERROR;
+ }
+ }
+ return SWIG_OK;
+}
+
+#if (SWIG_V8_VERSION < 0x031710)
+SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Persistent< v8::Value > object, void *parameter) {
+ SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
+#else
+SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SwigV8PackedData *cdata = data.GetParameter();
+#endif
+
+ delete cdata;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Clear();
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Clear();
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+}
+
+SWIGRUNTIME
+v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
+ SWIGV8_HANDLESCOPE_ESC();
+
+ SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
+// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
+ v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
+
+ obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
+
+#if (SWIG_V8_VERSION < 0x031511)
+ obj->SetPointerInInternalField(0, cdata);
+#else
+ obj->SetAlignedPointerInInternalField(0, cdata);
+#endif
+
+#if (SWIG_V8_VERSION < 0x031710)
+ cdata->handle = v8::Persistent<v8::Object>::New(obj);
+#elif (SWIG_V8_VERSION < 0x031900)
+ cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
+#else
+ cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
+#endif
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+ cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
+#elif (SWIG_V8_VERSION < 0x031918)
+ cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
+#else
+ cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
+// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
+#endif
+
+#if (SWIG_V8_VERSION < 0x031710)
+ cdata->handle.MarkIndependent();
+#elif (SWIG_V8_VERSION < 0x032100)
+ cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
+#else
+ cdata->handle.MarkIndependent();
+#endif
+
+ SWIGV8_ESCAPE(obj);
+}
+
+#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type) SWIGV8_NewPackedObj(ptr, sz, type)
+
+
+/* ---------------------------------------------------------------------------
+ * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg)
+ *
+ * ---------------------------------------------------------------------------*/
+
+SWIGRUNTIME
+
+#if (SWIG_V8_VERSION < 0x031903)
+v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
+#else
+v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
+#endif
+ SWIGV8_HANDLESCOPE_ESC();
+
+ if (result->IsUndefined()) {
+ result = SWIGV8_ARRAY_NEW();
+ }
+#if (SWIG_V8_VERSION < 0x031903)
+ v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result);
+#else
+ v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
+#endif
+ arr->Set(arr->Length(), obj);
+
+ SWIGV8_ESCAPE(arr);
+}
+
+
+
+// Note: since 3.19 there are new CallBack types, since 03.21.9 the old ones have been removed
+#if (SWIG_V8_VERSION < 0x031903)
+typedef v8::InvocationCallback SwigV8FunctionCallback;
+typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
+typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
+typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
+#else
+typedef v8::FunctionCallback SwigV8FunctionCallback;
+typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
+typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
+typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
+#endif
+
+/**
+ * Creates a class template for a class with specified initialization function.
+ */
+SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
+ SWIGV8_HANDLESCOPE_ESC();
+
+ v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
+ class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
+
+ v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
+ inst_templ->SetInternalFieldCount(1);
+
+ v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
+ equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
+
+ v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
+ cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
+
+ SWIGV8_ESCAPE(class_templ);
+}
+
+/**
+ * Registers a class method with given name for a given class template.
+ */
+SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+ SwigV8FunctionCallback _func) {
+ v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
+ proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
+}
+
+/**
+ * Registers a class property with given name for a given class template.
+ */
+SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+ SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
+ v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
+ proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+}
+
+/**
+ * Registers a class method with given name for a given object.
+ */
+SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
+ const SwigV8FunctionCallback& _func) {
+ obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+}
+
+/**
+ * Registers a class method with given name for a given object.
+ */
+SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
+ SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
+ obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+}
+
+SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid& info)
+{
+ char buffer[256];
+ char msg[512];
+ int res;
+
+ property->WriteUtf8(buffer, 256);
+ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
+
+ if(res<0) {
+ SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
+ } else {
+ SWIG_exception(SWIG_ERROR, msg);
+ }
+}
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_Data swig_types[0]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr swig_types[1]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection swig_types[2]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData swig_types[3]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment swig_types[4]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument swig_types[5]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment swig_types[6]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType swig_types[7]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement swig_types[8]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity swig_types[9]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference swig_types[10]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException swig_types[11]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap swig_types[12]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode swig_types[13]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList swig_types[14]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation swig_types[15]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction swig_types[16]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText swig_types[17]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo swig_types[18]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler swig_types[19]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager swig_types[20]
+#define SWIGTYPE_p_bool swig_types[21]
+#define SWIGTYPE_p_char swig_types[22]
+#define SWIGTYPE_p_int16_t swig_types[23]
+#define SWIGTYPE_p_int32_t swig_types[24]
+#define SWIGTYPE_p_int64_t swig_types[25]
+#define SWIGTYPE_p_namelist_t swig_types[26]
+#define SWIGTYPE_p_params_t swig_types[27]
+#define SWIGTYPE_p_size_t swig_types[28]
+#define SWIGTYPE_p_ssize_t swig_types[29]
+#define SWIGTYPE_p_std__listT_Data_t swig_types[30]
+#define SWIGTYPE_p_std__multimapT_std__string_Data_t swig_types[31]
+#define SWIGTYPE_p_uint16_t swig_types[32]
+#define SWIGTYPE_p_uint32_t swig_types[33]
+#define SWIGTYPE_p_uint64_t swig_types[34]
+#define SWIGTYPE_p_unsigned_char swig_types[35]
+#define SWIGTYPE_p_uscxml__ErrorEvent swig_types[36]
+#define SWIGTYPE_p_uscxml__Event swig_types[37]
+#define SWIGTYPE_p_void swig_types[38]
+static swig_type_info *swig_types[40];
+static swig_module_info swig_module = {swig_types, 39, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+
+
+#define SWIGVERSION 0x030008
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
+
+
+#include <stdexcept>
+
+
+SWIGINTERNINLINE
+v8::Handle<v8::Value> SWIG_From_int (int value)
+{
+ return SWIGV8_INT32_NEW(value);
+}
+
+
+#include <string>
+
+
+#include "xercesc/sax/InputSource.hpp"
+#include "xercesc/sax/SAXException.hpp"
+#include "xercesc/sax/SAXParseException.hpp"
+#include "xercesc/sax/Locator.hpp"
+#include "xercesc/sax/HandlerBase.hpp"
+#include "xercesc/sax2/Attributes.hpp"
+#include "xercesc/sax2/ContentHandler.hpp"
+#include "xercesc/sax2/LexicalHandler.hpp"
+#include "xercesc/sax2/DefaultHandler.hpp"
+#include "xercesc/sax2/SAX2XMLReader.hpp"
+#include "xercesc/sax2/XMLReaderFactory.hpp"
+#include "xercesc/util/PlatformUtils.hpp"
+#include "xercesc/util/TransService.hpp"
+#include "xercesc/util/XMLString.hpp"
+#include "xercesc/util/XMLUri.hpp"
+#include "xercesc/util/QName.hpp"
+#include "xercesc/util/HexBin.hpp"
+#include "xercesc/util/Base64.hpp"
+#include "xercesc/parsers/AbstractDOMParser.hpp"
+#include "xercesc/parsers/XercesDOMParser.hpp"
+#include "xercesc/parsers/SAXParser.hpp"
+#include "xercesc/dom/DOM.hpp"
+#include "xercesc/framework/LocalFileInputSource.hpp"
+#include "xercesc/framework/MemBufInputSource.hpp"
+#include "xercesc/framework/StdInInputSource.hpp"
+#include "xercesc/framework/URLInputSource.hpp"
+#include "xercesc/framework/XMLGrammarDescription.hpp"
+#include "xercesc/framework/XMLDTDDescription.hpp"
+#include "xercesc/framework/XMLSchemaDescription.hpp"
+#include "xercesc/util/NameIdPool.hpp"
+#include "xercesc/util/XMLEnumerator.hpp"
+#include "xercesc/framework/XMLValidator.hpp"
+#include "xercesc/validators/common/Grammar.hpp"
+#include "xercesc/validators/DTD/DTDAttDef.hpp"
+#include "xercesc/validators/DTD/DTDAttDefList.hpp"
+#include "xercesc/validators/DTD/DTDGrammar.hpp"
+#include "xercesc/validators/DTD/DTDValidator.hpp"
+#include "xercesc/validators/schema/SchemaGrammar.hpp"
+#include "xercesc/validators/schema/SchemaValidator.hpp"
+#include "xercesc/validators/schema/SchemaAttDefList.hpp"
+#include "xercesc/validators/schema/SchemaAttDef.hpp"
+#include "xercesc/framework/XMLFormatter.hpp"
+#include "xercesc/framework/MemBufFormatTarget.hpp"
+#include "xercesc/framework/LocalFileFormatTarget.hpp"
+#include "xercesc/framework/StdOutFormatTarget.hpp"
+#include "xercesc/framework/Wrapper4InputSource.hpp"
+#include "xercesc/framework/psvi/PSVIHandler.hpp"
+
+// for resolving XMLExceptions
+#include "xercesc/util/ArrayIndexOutOfBoundsException.hpp"
+#include "xercesc/util/EmptyStackException.hpp"
+#include "xercesc/util/IllegalArgumentException.hpp"
+#include "xercesc/util/InvalidCastException.hpp"
+#include "xercesc/util/IOException.hpp"
+#include "xercesc/util/NoSuchElementException.hpp"
+#include "xercesc/util/NullPointerException.hpp"
+#include "xercesc/util/NumberFormatException.hpp"
+#include "xercesc/util/ParseException.hpp"
+#include "xercesc/util/RuntimeException.hpp"
+#include "xercesc/util/SchemaDateTimeException.hpp"
+#include "xercesc/util/TranscodingException.hpp"
+#include "xercesc/util/UnexpectedEOFException.hpp"
+#include "xercesc/util/UnsupportedEncodingException.hpp"
+#include "xercesc/util/UTFDataFormatException.hpp"
+#include "xercesc/util/XMLNetAccessor.hpp"
+#include "xercesc/internal/XSerializationException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeFacetException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeValueException.hpp"
+#include "xercesc/validators/schema/identity/XPathException.hpp"
+
+XERCES_CPP_NAMESPACE_USE
+
+// we initialize the static UTF-8 transcoding info
+// these are used by the typemaps to convert between
+// Xerces internal UTF-16 and Perl's internal UTF-8
+static XMLCh* UTF8_ENCODING = NULL;
+static XMLTranscoder* UTF8_TRANSCODER = NULL;
+
+static bool DEBUG_UTF8_OUT = 0;
+static bool DEBUG_UTF8_IN = 0;
+
+
+
+SWIGINTERN
+int SWIG_AsVal_double (v8::Handle<v8::Value> obj, double *val)
+{
+ if(!obj->IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = obj->NumberValue();
+
+ return SWIG_OK;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+ double x = *d;
+ if ((min <= x && x <= max)) {
+ double fx = floor(x);
+ double cx = ceil(x);
+ double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+ if ((errno == EDOM) || (errno == ERANGE)) {
+ errno = 0;
+ } else {
+ double summ, reps, diff;
+ if (rd < x) {
+ diff = x - rd;
+ } else if (rd > x) {
+ diff = rd - x;
+ } else {
+ return 1;
+ }
+ summ = rd + x;
+ reps = diff/summ;
+ if (reps < 8*DBL_EPSILON) {
+ *d = rd;
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+
+SWIGINTERN
+int SWIG_AsVal_long (v8::Handle<v8::Value> obj, long* val)
+{
+ if (!obj->IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = (long) obj->IntegerValue();
+
+ return SWIG_OK;
+}
+
+
+SWIGINTERN
+int SWIG_AsVal_bool (v8::Handle<v8::Value> obj, bool *val)
+{
+ if(!obj->IsBoolean()) {
+ return SWIG_ERROR;
+ }
+
+ if (val) *val = obj->BooleanValue();
+ return SWIG_OK;
+}
+
+
+SWIGINTERNINLINE
+v8::Handle<v8::Value>
+SWIG_From_bool (bool value)
+{
+ return SWIGV8_BOOLEAN_NEW(value);
+}
+
+
+static swig_type_info *
+DOMNode_dynamic_cast(void **ptr) {
+ DOMNode **nptr = (DOMNode **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getNodeType();
+ if (type == DOMNode::TEXT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText;
+ }
+ if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction;
+ }
+ if (type == DOMNode::DOCUMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument;
+ }
+ if (type == DOMNode::ELEMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement;
+ }
+ if (type == DOMNode::ENTITY_REFERENCE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::COMMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment;
+ }
+ if (type == DOMNode::DOCUMENT_TYPE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType;
+ }
+ if (type == DOMNode::ENTITY_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity;
+ }
+ if (type == DOMNode::ATTRIBUTE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr;
+ }
+ if (type == DOMNode::NOTATION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation;
+ }
+ return NULL;
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_short (v8::Handle<v8::Value> obj, short *val)
+{
+ long v;
+ int res = SWIG_AsVal_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v < SHRT_MIN || v > SHRT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = (short)(v);
+ }
+ }
+ return res;
+}
+
+
+SWIGINTERNINLINE
+v8::Handle<v8::Value> SWIG_From_long (long value)
+{
+ return SWIGV8_NUMBER_NEW(value);
+}
+
+
+SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIG_From_short (short value)
+{
+ return SWIG_From_long (value);
+}
+
+
+SWIGINTERNINLINE
+v8::Handle<v8::Value> SWIG_From_unsigned_SS_long (unsigned long value)
+{
+ return (value > LONG_MAX) ?
+ SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW((long)(value));
+}
+
+
+SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIG_From_size_t (size_t value)
+{
+ return SWIG_From_unsigned_SS_long ((unsigned long)(value));
+}
+
+
+SWIGINTERN
+int SWIG_AsVal_unsigned_SS_long (v8::Handle<v8::Value> obj, unsigned long *val)
+{
+ if(!obj->IsNumber()) {
+ return SWIG_TypeError;
+ }
+
+ long longVal = (long) obj->NumberValue();
+
+ if(longVal < 0) {
+ return SWIG_OverflowError;
+ }
+
+ if(val) *val = longVal;
+
+ return SWIG_OK;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_size_t (v8::Handle<v8::Value> obj, size_t *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
+ if (SWIG_IsOK(res) && val) *val = (size_t)(v);
+ return res;
+}
+
+
+using uscxml::Data;
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+ static int init = 0;
+ static swig_type_info* info = 0;
+ if (!init) {
+ info = SWIG_TypeQuery("_p_char");
+ init = 1;
+ }
+ return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
+{
+ if(valRef->IsString()) {
+ v8::Handle<v8::String> js_str = valRef->ToString();
+
+ size_t len = js_str->Utf8Length() + 1;
+ char* cstr = new char[len];
+ js_str->WriteUtf8(cstr, len);
+
+ if(alloc) *alloc = SWIG_NEWOBJ;
+ if(psize) *psize = len;
+ if(cptr) *cptr = cstr;
+
+ return SWIG_OK;
+ } else {
+ if(valRef->IsObject()) {
+ v8::Handle<v8::Object> obj = valRef->ToObject();
+ // try if the object is a wrapped char[]
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ if (pchar_descriptor) {
+ void* vptr = 0;
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+ if (cptr) *cptr = (char *) vptr;
+ if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
+ if (alloc) *alloc = SWIG_OLDOBJ;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+ } else {
+ return SWIG_TypeError;
+ }
+ }
+}
+
+
+SWIGINTERN int
+SWIG_AsPtr_std_string (v8::Handle<v8::Value> obj, std::string **val)
+{
+ char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
+ if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
+ if (buf) {
+ if (val) *val = new std::string(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) delete[] buf;
+ return SWIG_NEWOBJ;
+ } else {
+ if (val) *val = 0;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ static int init = 0;
+ static swig_type_info* descriptor = 0;
+ if (!init) {
+ descriptor = SWIG_TypeQuery("std::string" " *");
+ init = 1;
+ }
+ if (descriptor) {
+ std::string *vptr;
+ int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
+ if (SWIG_IsOK(res) && val) *val = vptr;
+ return res;
+ }
+ }
+ return SWIG_ERROR;
+}
+
+
+SWIGINTERN
+int SWIG_AsVal_int (v8::Handle<v8::Value> valRef, int* val)
+{
+ if (!valRef->IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = valRef->IntegerValue();
+
+ return SWIG_OK;
+}
+
+
+SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+ if (carray) {
+ if (size > INT_MAX) {
+ // TODO: handle extra long strings
+ return SWIGV8_UNDEFINED();
+ } else {
+ v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
+ return js_str;
+ }
+ } else {
+ return SWIGV8_UNDEFINED();
+ }
+}
+
+
+SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIG_From_std_string (const std::string& s)
+{
+ return SWIG_FromCharPtrAndSize(s.data(), s.size());
+}
+
+
+#define SWIGV8_INIT V8DOM_initialize
+
+
+SWIGV8_ClientData _exports_DOMException_clientData;
+SWIGV8_ClientData _exports_DOMNode_clientData;
+SWIGV8_ClientData _exports_DOMAttr_clientData;
+SWIGV8_ClientData _exports_DOMElement_clientData;
+SWIGV8_ClientData _exports_DOMEntity_clientData;
+SWIGV8_ClientData _exports_DOMDocumentType_clientData;
+SWIGV8_ClientData _exports_DOMCharacterData_clientData;
+SWIGV8_ClientData _exports_DOMComment_clientData;
+SWIGV8_ClientData _exports_DOMText_clientData;
+SWIGV8_ClientData _exports_DOMCDATASection_clientData;
+SWIGV8_ClientData _exports_DOMNodeList_clientData;
+SWIGV8_ClientData _exports_DOMNamedNodeMap_clientData;
+SWIGV8_ClientData _exports_DOMDocumentFragment_clientData;
+SWIGV8_ClientData _exports_DOMEntityReference_clientData;
+SWIGV8_ClientData _exports_DOMNotation_clientData;
+SWIGV8_ClientData _exports_DOMProcessingInstruction_clientData;
+SWIGV8_ClientData _exports_Event_clientData;
+SWIGV8_ClientData _exports_ErrorEvent_clientData;
+
+
+static SwigV8ReturnValue _wrap_XERCES_HAS_CPP_NAMESPACE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(1));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static void _wrap_DEBUG_UTF8_OUT_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ bool arg1 ;
+ bool val1 ;
+ int ecode1 = 0 ;
+
+ ecode1 = SWIG_AsVal_bool(value, &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DEBUG_UTF8_OUT_set" "', argument " "1"" of type '" "bool""'");
+ }
+ arg1 = (bool)(val1);
+ DEBUG_UTF8_OUT = arg1;
+
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_DEBUG_UTF8_OUT_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ bool result;
+
+ result = (bool)DEBUG_UTF8_OUT;
+ jsresult = SWIG_From_bool((bool)(result));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static void _wrap_DEBUG_UTF8_IN_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ bool arg1 ;
+ bool val1 ;
+ int ecode1 = 0 ;
+
+ ecode1 = SWIG_AsVal_bool(value, &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DEBUG_UTF8_IN_set" "', argument " "1"" of type '" "bool""'");
+ }
+ arg1 = (bool)(val1);
+ DEBUG_UTF8_IN = arg1;
+
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_DEBUG_UTF8_IN_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ bool result;
+
+ result = (bool)DEBUG_UTF8_IN;
+ jsresult = SWIG_From_bool((bool)(result));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_INDEX_SIZE_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::INDEX_SIZE_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_DOMSTRING_SIZE_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::DOMSTRING_SIZE_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_HIERARCHY_REQUEST_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::HIERARCHY_REQUEST_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_WRONG_DOCUMENT_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::WRONG_DOCUMENT_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_CHARACTER_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_CHARACTER_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_DATA_ALLOWED_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::NO_DATA_ALLOWED_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_MODIFICATION_ALLOWED_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::NO_MODIFICATION_ALLOWED_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_FOUND_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::NOT_FOUND_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_SUPPORTED_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::NOT_SUPPORTED_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_INUSE_ATTRIBUTE_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::INUSE_ATTRIBUTE_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_STATE_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_STATE_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_SYNTAX_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::SYNTAX_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_MODIFICATION_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_MODIFICATION_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_NAMESPACE_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::NAMESPACE_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_ACCESS_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::INVALID_ACCESS_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_VALIDATION_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::VALIDATION_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMException_TYPE_MISMATCH_ERR(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMException::TYPE_MISMATCH_ERR));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_new_DOMException__SWIG_0(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ short arg1 ;
+ short arg2 ;
+ XERCES_CPP_NAMESPACE::MemoryManager *arg3 = (XERCES_CPP_NAMESPACE::MemoryManager *) (XERCES_CPP_NAMESPACE::MemoryManager *)0 ;
+ short val1 ;
+ int ecode1 = 0 ;
+ short val2 ;
+ int ecode2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result;
+ if(args.Length() != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_DOMException__SWIG_0.");
+ ecode1 = SWIG_AsVal_short(args[0], &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DOMException" "', argument " "1"" of type '" "short""'");
+ }
+ arg1 = (short)(val1);
+ ecode2 = SWIG_AsVal_short(args[1], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DOMException" "', argument " "2"" of type '" "short""'");
+ }
+ arg2 = (short)(val2);
+ res3 = SWIG_ConvertPtr(args[2], &argp3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager, 0 | 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_DOMException" "', argument " "3"" of type '" "XERCES_CPP_NAMESPACE::MemoryManager *const""'");
+ }
+ arg3 = (XERCES_CPP_NAMESPACE::MemoryManager *)(argp3);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1,arg2,arg3);
+
+
+
+
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_DOMException__SWIG_1(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ short arg1 ;
+ short arg2 ;
+ short val1 ;
+ int ecode1 = 0 ;
+ short val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result;
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_DOMException__SWIG_1.");
+ ecode1 = SWIG_AsVal_short(args[0], &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DOMException" "', argument " "1"" of type '" "short""'");
+ }
+ arg1 = (short)(val1);
+ ecode2 = SWIG_AsVal_short(args[1], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DOMException" "', argument " "2"" of type '" "short""'");
+ }
+ arg2 = (short)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1,arg2);
+
+
+
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_DOMException__SWIG_2(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ short arg1 ;
+ short val1 ;
+ int ecode1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result;
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_DOMException__SWIG_2.");
+ ecode1 = SWIG_AsVal_short(args[0], &val1);
+ if (!SWIG_IsOK(ecode1)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DOMException" "', argument " "1"" of type '" "short""'");
+ }
+ arg1 = (short)(val1);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1);
+
+
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_DOMException(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ OverloadErrorHandler errorHandler;
+ v8::Handle<v8::Value> self;
+
+ // switch all cases by means of series of if-returns.
+
+ if(args.Length() == 3) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_DOMException__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_DOMException__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+ if(args.Length() == 2) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_DOMException__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_DOMException__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+ if(args.Length() == 1) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_DOMException__SWIG_2(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_DOMException__SWIG_2(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+
+ // default:
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of _exports_DOMException");
+
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMException(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMException(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMException(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMException(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMException * arg1 = (XERCES_CPP_NAMESPACE::DOMException *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMException_getMessage(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMException_getMessage.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_getMessage" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMException const *)arg1)->getMessage();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static void _wrap_DOMException_code_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ short arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ short val2 ;
+ int ecode2 = 0 ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_code_set" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ ecode2 = SWIG_AsVal_short(value, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMException_code_set" "', argument " "2"" of type '" "short""'");
+ }
+ arg2 = (short)(val2);
+ if (arg1) (arg1)->code = arg2;
+
+
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_DOMException_code_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ short result;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_code_get" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ result = (short) ((arg1)->code);
+ jsresult = SWIG_From_short((short)(result));
+
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static void _wrap_DOMException_msg_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_msg_set" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+
+ arg2 = JS2XMLString(value);
+
+ if (arg1) (arg1)->msg = (XMLCh const *)arg2;
+
+
+ delete[] arg2;
+
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_DOMException_msg_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMException_msg_get" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMException *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMException *)(argp1);
+ result = (XMLCh *) ((arg1)->msg);
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMNode(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMNode(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMNode(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMNode(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMNode * arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_ELEMENT_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::ELEMENT_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_ATTRIBUTE_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::ATTRIBUTE_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_TEXT_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::TEXT_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_CDATA_SECTION_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::CDATA_SECTION_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_REFERENCE_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::ENTITY_REFERENCE_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::ENTITY_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_PROCESSING_INSTRUCTION_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::PROCESSING_INSTRUCTION_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_COMMENT_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::COMMENT_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_TYPE_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_TYPE_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_FRAGMENT_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_FRAGMENT_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_NOTATION_NODE(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::NOTATION_NODE));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_DISCONNECTED(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_DISCONNECTED));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_PRECEDING(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_PRECEDING));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_FOLLOWING(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_FOLLOWING));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINS(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINS));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINED_BY(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINED_BY));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getNodeName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNodeName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNodeName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeName();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getNodeValue(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNodeValue.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNodeValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeValue();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getNodeType(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode::NodeType result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNodeType.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNodeType" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode::NodeType)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeType();
+ jsresult = SWIG_From_int((int)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getParentNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getParentNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getParentNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getParentNode();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getChildNodes(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getChildNodes.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getChildNodes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getChildNodes();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getFirstChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getFirstChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getFirstChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getFirstChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getLastChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getLastChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getLastChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getLastChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getPreviousSibling(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getPreviousSibling.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getPreviousSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getPreviousSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getNextSibling(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNextSibling.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNextSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNextSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getAttributes(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getAttributes.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getAttributes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getAttributes();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getOwnerDocument(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMDocument *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getOwnerDocument.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getOwnerDocument" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMDocument *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getOwnerDocument();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_cloneNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_cloneNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_cloneNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ ecode2 = SWIG_AsVal_bool(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMNode_cloneNode" "', argument " "2"" of type '" "bool""'");
+ }
+ arg2 = (bool)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->cloneNode(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_insertBefore(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg3 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_insertBefore.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_insertBefore" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_insertBefore" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ res3 = SWIG_ConvertPtr(args[1], &argp3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DOMNode_insertBefore" "', argument " "3"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg3 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp3);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->insertBefore(arg2,arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_replaceChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg3 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_replaceChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_replaceChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_replaceChild" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ res3 = SWIG_ConvertPtr(args[1], &argp3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DOMNode_replaceChild" "', argument " "3"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg3 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp3);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->replaceChild(arg2,arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_removeChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_removeChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_removeChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_removeChild" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeChild(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_appendChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_appendChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_appendChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_appendChild" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->appendChild(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_hasChildNodes(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_hasChildNodes.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_hasChildNodes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->hasChildNodes();
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_setNodeValue(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setNodeValue.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setNodeValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->setNodeValue((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_normalize(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_normalize.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_normalize" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ (arg1)->normalize();
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_isSupported(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isSupported.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isSupported" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isSupported((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getNamespaceURI(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getNamespaceURI.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getNamespaceURI" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNamespaceURI();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getLocalName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getLocalName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getLocalName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getLocalName();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_setPrefix(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setPrefix.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setPrefix" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->setPrefix((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_hasAttributes(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_hasAttributes.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_hasAttributes" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->hasAttributes();
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_isSameNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ bool result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isSameNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isSameNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_isSameNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isSameNode((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_isEqualNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ bool result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isEqualNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isEqualNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_isEqualNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isEqualNode((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_setUserData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *arg3 = (void *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMUserDataHandler *arg4 = (XERCES_CPP_NAMESPACE::DOMUserDataHandler *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res3 ;
+ void *argp4 = 0 ;
+ int res4 = 0 ;
+ void *result = 0 ;
+
+ if(args.Length() != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setUserData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setUserData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ res3 = SWIG_ConvertPtr(args[1],SWIG_as_voidptrptr(&arg3), 0, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DOMNode_setUserData" "', argument " "3"" of type '" "void *""'");
+ }
+ res4 = SWIG_ConvertPtr(args[2], &argp4,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler, 0 | 0 );
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DOMNode_setUserData" "', argument " "4"" of type '" "XERCES_CPP_NAMESPACE::DOMUserDataHandler *""'");
+ }
+ arg4 = (XERCES_CPP_NAMESPACE::DOMUserDataHandler *)(argp4);
+ result = (void *)(arg1)->setUserData((XMLCh const *)arg2,arg3,arg4);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getUserData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getUserData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getUserData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (void *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getUserData((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getBaseURI(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getBaseURI.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getBaseURI" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getBaseURI();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_compareDocumentPosition(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ short result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_compareDocumentPosition.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_compareDocumentPosition" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNode_compareDocumentPosition" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (short)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->compareDocumentPosition((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ jsresult = SWIG_From_short((short)(result));
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getTextContent(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getTextContent.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getTextContent" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getTextContent();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_setTextContent(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_setTextContent.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_setTextContent" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->setTextContent((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_lookupPrefix(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_lookupPrefix.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_lookupPrefix" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->lookupPrefix((XMLCh const *)arg2);
+
+ jsresult = XMLString2JS(result);
+
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_isDefaultNamespace(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_isDefaultNamespace.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_isDefaultNamespace" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isDefaultNamespace((XMLCh const *)arg2);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_lookupNamespaceURI(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_lookupNamespaceURI.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_lookupNamespaceURI" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->lookupNamespaceURI((XMLCh const *)arg2);
+
+ jsresult = XMLString2JS(result);
+
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_getFeature(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_getFeature.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_getFeature" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (void *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getFeature((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNode_release(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNode_release.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNode_release" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp1);
+ (arg1)->release();
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMNode can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMAttr(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMAttr(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMAttr(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMAttr(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMAttr * arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_getName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getName();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_getSpecified(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getSpecified.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getSpecified" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getSpecified();
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_getValue(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getValue.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getValue();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_setValue(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_setValue.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_setValue" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->setValue((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_getOwnerElement(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getOwnerElement.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getOwnerElement" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getOwnerElement();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_isId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_isId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_isId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->isId();
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMAttr_getSchemaTypeInfo(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMTypeInfo *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMAttr_getSchemaTypeInfo.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMAttr_getSchemaTypeInfo" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMTypeInfo *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getSchemaTypeInfo();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMAttr(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMAttr can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMElement(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMElement(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMElement(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMElement(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMElement * arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getTagName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getTagName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getTagName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getTagName();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getAttribute(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttribute.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttribute((XMLCh const *)arg2);
+
+ jsresult = XMLString2JS(result);
+
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getAttributeNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNode((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getElementsByTagName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getElementsByTagName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getElementsByTagName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getElementsByTagName((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setAttribute(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttribute.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ (arg1)->setAttribute((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setAttributeNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_setAttributeNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->setAttributeNode(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_removeAttributeNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_removeAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_removeAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_removeAttributeNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->removeAttributeNode(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_removeAttribute(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_removeAttribute.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_removeAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->removeAttribute((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getAttributeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+
+ jsresult = XMLString2JS(result);
+
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setAttributeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XMLCh *arg4 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+
+ arg4 = JS2XMLString(args[2]);
+
+ (arg1)->setAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3,(XMLCh const *)arg4);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ delete[] arg4;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_removeAttributeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_removeAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_removeAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ (arg1)->removeAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getAttributeNodeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getAttributeNodeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getAttributeNodeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNodeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setAttributeNodeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setAttributeNodeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setAttributeNodeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_setAttributeNodeNS" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->setAttributeNodeNS(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getElementsByTagNameNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getElementsByTagNameNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getElementsByTagNameNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getElementsByTagNameNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_hasAttribute(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_hasAttribute.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_hasAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->hasAttribute((XMLCh const *)arg2);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_hasAttributeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_hasAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_hasAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->hasAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setIdAttribute(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ bool arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool val3 ;
+ int ecode3 = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setIdAttribute.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setIdAttribute" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ ecode3 = SWIG_AsVal_bool(args[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMElement_setIdAttribute" "', argument " "3"" of type '" "bool""'");
+ }
+ arg3 = (bool)(val3);
+ (arg1)->setIdAttribute((XMLCh const *)arg2,arg3);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setIdAttributeNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ bool arg4 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool val4 ;
+ int ecode4 = 0 ;
+
+ if(args.Length() != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setIdAttributeNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setIdAttributeNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ ecode4 = SWIG_AsVal_bool(args[2], &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DOMElement_setIdAttributeNS" "', argument " "4"" of type '" "bool""'");
+ }
+ arg4 = (bool)(val4);
+ (arg1)->setIdAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3,arg4);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_setIdAttributeNode(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ bool arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ bool val3 ;
+ int ecode3 = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_setIdAttributeNode.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_setIdAttributeNode" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMElement_setIdAttributeNode" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMAttr const *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *)(argp2);
+ ecode3 = SWIG_AsVal_bool(args[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMElement_setIdAttributeNode" "', argument " "3"" of type '" "bool""'");
+ }
+ arg3 = (bool)(val3);
+ (arg1)->setIdAttributeNode((XERCES_CPP_NAMESPACE::DOMAttr const *)arg2,arg3);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getSchemaTypeInfo(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMTypeInfo *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getSchemaTypeInfo.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getSchemaTypeInfo" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMTypeInfo *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getSchemaTypeInfo();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getFirstElementChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getFirstElementChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getFirstElementChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getFirstElementChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getLastElementChild(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getLastElementChild.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getLastElementChild" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getLastElementChild();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getPreviousElementSibling(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getPreviousElementSibling.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getPreviousElementSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getPreviousElementSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getNextElementSibling(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getNextElementSibling.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getNextElementSibling" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getNextElementSibling();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMElement_getChildElementCount(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMElement_getChildElementCount.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMElement_getChildElementCount" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMElement const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMElement *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getChildElementCount();
+ jsresult = SWIG_From_size_t((size_t)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMElement(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMElement can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMEntity(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMEntity(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMEntity(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMEntity(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMEntity * arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMEntity_getPublicId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getPublicId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getPublicId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getPublicId();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMEntity_getSystemId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getSystemId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getSystemId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getSystemId();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMEntity_getNotationName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getNotationName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getNotationName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getNotationName();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMEntity_getInputEncoding(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getInputEncoding.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getInputEncoding" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getInputEncoding();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMEntity_getXmlEncoding(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getXmlEncoding.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getXmlEncoding" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getXmlEncoding();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMEntity_getXmlVersion(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMEntity_getXmlVersion.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMEntity_getXmlVersion" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMEntity const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getXmlVersion();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMEntity(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMEntity can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMDocumentType(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMDocumentType(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMDocumentType(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMDocumentType(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMDocumentType * arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMDocumentType_getName(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getName.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getName" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getName();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMDocumentType_getEntities(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getEntities.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getEntities" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getEntities();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMDocumentType_getNotations(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getNotations.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getNotations" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getNotations();
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMDocumentType_getPublicId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getPublicId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getPublicId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getPublicId();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMDocumentType_getSystemId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getSystemId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getSystemId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getSystemId();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMDocumentType_getInternalSubset(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMDocumentType_getInternalSubset.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMDocumentType_getInternalSubset" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMDocumentType const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getInternalSubset();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMDocumentType(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMDocumentType can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMCharacterData(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMCharacterData(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMCharacterData(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMCharacterData(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMCharacterData * arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_getData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_getData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_getData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->getData();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_getLength(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_getLength.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_getLength" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->getLength();
+ jsresult = SWIG_From_size_t((size_t)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_substringData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ size_t val3 ;
+ int ecode3 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_substringData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_substringData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_substringData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ ecode3 = SWIG_AsVal_size_t(args[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMCharacterData_substringData" "', argument " "3"" of type '" "XMLSize_t""'");
+ }
+ arg3 = (XMLSize_t)(val3);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->substringData(arg2,arg3);
+
+ jsresult = XMLString2JS(result);
+
+
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_appendData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_appendData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_appendData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->appendData((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_insertData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_insertData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_insertData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_insertData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+
+ arg3 = JS2XMLString(args[1]);
+
+ (arg1)->insertData(arg2,(XMLCh const *)arg3);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_deleteData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ size_t val3 ;
+ int ecode3 = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_deleteData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_deleteData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_deleteData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ ecode3 = SWIG_AsVal_size_t(args[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMCharacterData_deleteData" "', argument " "3"" of type '" "XMLSize_t""'");
+ }
+ arg3 = (XMLSize_t)(val3);
+ (arg1)->deleteData(arg2,arg3);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_replaceData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ XMLCh *arg4 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ size_t val3 ;
+ int ecode3 = 0 ;
+
+ if(args.Length() != 3) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_replaceData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_replaceData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMCharacterData_replaceData" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ ecode3 = SWIG_AsVal_size_t(args[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DOMCharacterData_replaceData" "', argument " "3"" of type '" "XMLSize_t""'");
+ }
+ arg3 = (XMLSize_t)(val3);
+
+ arg4 = JS2XMLString(args[2]);
+
+ (arg1)->replaceData(arg2,arg3,(XMLCh const *)arg4);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+
+
+ delete[] arg4;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMCharacterData_setData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMCharacterData_setData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMCharacterData_setData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMCharacterData *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->setData((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMCharacterData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMCharacterData can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMComment(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMComment(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMComment(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMComment(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMComment * arg1 = (XERCES_CPP_NAMESPACE::DOMComment *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMComment(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMComment can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMText(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMText(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMText(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMText(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMText * arg1 = (XERCES_CPP_NAMESPACE::DOMText *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMText_splitText(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLSize_t arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMText *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_splitText.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_splitText" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMText_splitText" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMText *)(arg1)->splitText(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMText_getIsElementContentWhitespace(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_getIsElementContentWhitespace.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_getIsElementContentWhitespace" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->getIsElementContentWhitespace();
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMText_getWholeText(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_getWholeText.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_getWholeText" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->getWholeText();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMText_replaceWholeText(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMText *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_replaceWholeText.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_replaceWholeText" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMText *)(arg1)->replaceWholeText((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMText_isIgnorableWhitespace(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ bool result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMText_isIgnorableWhitespace.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMText_isIgnorableWhitespace" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMText const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMText *)(argp1);
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->isIgnorableWhitespace();
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMText(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMText can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMCDATASection(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMCDATASection(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMCDATASection(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMCDATASection(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMCDATASection * arg1 = (XERCES_CPP_NAMESPACE::DOMCDATASection *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMCDATASection(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMCDATASection can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMNodeList(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMNodeList(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMNodeList(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMNodeList(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMNodeList * arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMNodeList_item(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) 0 ;
+ XMLSize_t arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNodeList_item.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNodeList_item" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNodeList const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMNodeList_item" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNodeList const *)arg1)->item(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNodeList_getLength(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNodeList_getLength.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNodeList_getLength" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNodeList const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMNodeList const *)arg1)->getLength();
+ jsresult = SWIG_From_size_t((size_t)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMNodeList(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMNodeList can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMNamedNodeMap(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMNamedNodeMap(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMNamedNodeMap(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMNamedNodeMap(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap * arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_setNamedItem(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_setNamedItem.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_setNamedItem" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNamedNodeMap_setNamedItem" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->setNamedItem(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_item(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLSize_t arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ size_t val2 ;
+ int ecode2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_item.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_item" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ ecode2 = SWIG_AsVal_size_t(args[0], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DOMNamedNodeMap_item" "', argument " "2"" of type '" "XMLSize_t""'");
+ }
+ arg2 = (XMLSize_t)(val2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->item(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_getNamedItem(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_getNamedItem.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_getNamedItem" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getNamedItem((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_getLength(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLSize_t result;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_getLength.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_getLength" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ result = ((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getLength();
+ jsresult = SWIG_From_size_t((size_t)(result));
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_removeNamedItem(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_removeNamedItem.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_removeNamedItem" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeNamedItem((XMLCh const *)arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_getNamedItemNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_getNamedItemNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_getNamedItemNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getNamedItemNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_setNamedItemNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_setNamedItemNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_setNamedItemNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DOMNamedNodeMap_setNamedItemNS" "', argument " "2"" of type '" "XERCES_CPP_NAMESPACE::DOMNode *""'");
+ }
+ arg2 = (XERCES_CPP_NAMESPACE::DOMNode *)(argp2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->setNamedItemNS(arg2);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNamedNodeMap_removeNamedItemNS(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNamedNodeMap_removeNamedItemNS.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNamedNodeMap_removeNamedItemNS" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+
+ arg3 = JS2XMLString(args[1]);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeNamedItemNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ jsresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&result)), 0 | 0 );
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMNamedNodeMap(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMNamedNodeMap can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMDocumentFragment(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMDocumentFragment(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMDocumentFragment(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMDocumentFragment(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMDocumentFragment * arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentFragment *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMDocumentFragment(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMDocumentFragment can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMEntityReference(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMEntityReference(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMEntityReference(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMEntityReference(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMEntityReference * arg1 = (XERCES_CPP_NAMESPACE::DOMEntityReference *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMEntityReference(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMEntityReference can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMNotation(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMNotation(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMNotation(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMNotation(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMNotation * arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMNotation_getPublicId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNotation_getPublicId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNotation_getPublicId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNotation const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNotation const *)arg1)->getPublicId();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMNotation_getSystemId(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMNotation_getSystemId.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMNotation_getSystemId" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMNotation const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNotation const *)arg1)->getSystemId();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMNotation(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMNotation can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_DOMProcessingInstruction(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_DOMProcessingInstruction(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_DOMProcessingInstruction(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_DOMProcessingInstruction(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction * arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_DOMProcessingInstruction_getTarget(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMProcessingInstruction_getTarget.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMProcessingInstruction_getTarget" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *)arg1)->getTarget();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMProcessingInstruction_getData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ XMLCh *result = 0 ;
+
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMProcessingInstruction_getData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMProcessingInstruction_getData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)(argp1);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *)arg1)->getData();
+
+ jsresult = XMLString2JS(result);
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_DOMProcessingInstruction_setData(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_DOMProcessingInstruction_setData.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DOMProcessingInstruction_setData" "', argument " "1"" of type '" "XERCES_CPP_NAMESPACE::DOMProcessingInstruction *""'");
+ }
+ arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *)(argp1);
+
+ arg2 = JS2XMLString(args[0]);
+
+ (arg1)->setData((XMLCh const *)arg2);
+ jsresult = SWIGV8_UNDEFINED();
+
+
+ delete[] arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_veto_DOMProcessingInstruction(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ SWIG_exception(SWIG_ERROR, "Class DOMProcessingInstruction can not be instantiated");
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_uscxml_Event_INTERNAL(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(uscxml::Event::INTERNAL));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_uscxml_Event_EXTERNAL(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(uscxml::Event::EXTERNAL));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_uscxml_Event_PLATFORM(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+
+ jsresult = SWIG_From_int((int)(uscxml::Event::PLATFORM));
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static SwigV8ReturnValue _wrap_new_Event__SWIG_0(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ uscxml::Event *result;
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_Event__SWIG_0.");
+ result = (uscxml::Event *)new uscxml::Event();
+
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_Event__SWIG_1(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ std::string *arg1 = 0 ;
+ uscxml::Event::Type arg2 ;
+ int res1 = SWIG_OLDOBJ ;
+ int val2 ;
+ int ecode2 = 0 ;
+ uscxml::Event *result;
+ if(args.Length() != 2) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_Event__SWIG_1.");
+ {
+ std::string *ptr = (std::string *)0;
+ res1 = SWIG_AsPtr_std_string(args[0], &ptr);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ arg1 = ptr;
+ }
+ ecode2 = SWIG_AsVal_int(args[1], &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "uscxml::Event::Type""'");
+ }
+ arg2 = (uscxml::Event::Type)(val2);
+ result = (uscxml::Event *)new uscxml::Event((std::string const &)*arg1,arg2);
+
+ if (SWIG_IsNewObj(res1)) delete arg1;
+
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_Event__SWIG_2(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ std::string *arg1 = 0 ;
+ int res1 = SWIG_OLDOBJ ;
+ uscxml::Event *result;
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_Event__SWIG_2.");
+ {
+ std::string *ptr = (std::string *)0;
+ res1 = SWIG_AsPtr_std_string(args[0], &ptr);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Event" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ arg1 = ptr;
+ }
+ result = (uscxml::Event *)new uscxml::Event((std::string const &)*arg1);
+
+ if (SWIG_IsNewObj(res1)) delete arg1;
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_Event(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ OverloadErrorHandler errorHandler;
+ v8::Handle<v8::Value> self;
+
+ // switch all cases by means of series of if-returns.
+
+ if(args.Length() == 0) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_Event__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_Event__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+ if(args.Length() == 2) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_Event__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_Event__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+ if(args.Length() == 1) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_Event__SWIG_2(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_Event__SWIG_2(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+
+ // default:
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of _exports_Event");
+
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_Event_operator_equal_to(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 ;
+ int res2 = 0 ;
+ bool result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_operator_equal_to.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_operator_equal_to" "', argument " "1"" of type '" "uscxml::Event const *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2, SWIGTYPE_p_uscxml__Event, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_operator_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_operator_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ arg2 = (uscxml::Event *)(argp2);
+ result = (bool)((uscxml::Event const *)arg1)->operator ==((uscxml::Event const &)*arg2);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_Event_operator_not_equal_to(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 ;
+ int res2 = 0 ;
+ bool result;
+
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Event_operator_not_equal_to.");
+
+ res1 = SWIG_ConvertPtr(args.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_operator_not_equal_to" "', argument " "1"" of type '" "uscxml::Event const *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ res2 = SWIG_ConvertPtr(args[0], &argp2, SWIGTYPE_p_uscxml__Event, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_operator_not_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_operator_not_equal_to" "', argument " "2"" of type '" "uscxml::Event const &""'");
+ }
+ arg2 = (uscxml::Event *)(argp2);
+ result = (bool)((uscxml::Event const *)arg1)->operator !=((uscxml::Event const &)*arg2);
+ jsresult = SWIG_From_bool((bool)(result));
+
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_Event_getParam__SWIG_0(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler)
+{
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ Data *arg3 = 0 ;
+ void *argp1 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ bool result;
+
+ res1 = SWIG_ConvertPtr(args[0], &argp1, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ arg1 = (uscxml::Event::params_t *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string(args[1], &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ res3 = SWIG_ConvertPtr(args[2], &argp3, SWIGTYPE_p_Data, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_getParam" "', argument " "3"" of type '" "Data &""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "3"" of type '" "Data &""'");
+ }
+ arg3 = (Data *)(argp3);
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ jsresult = SWIG_From_bool((bool)(result));
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_Event_getParam__SWIG_1(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler)
+{
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ std::list< Data > *arg3 = 0 ;
+ void *argp1 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ bool result;
+
+ res1 = SWIG_ConvertPtr(args[0], &argp1, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ arg1 = (uscxml::Event::params_t *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string(args[1], &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ res3 = SWIG_ConvertPtr(args[2], &argp3, SWIGTYPE_p_std__listT_Data_t, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_getParam" "', argument " "3"" of type '" "std::list< Data > &""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "3"" of type '" "std::list< Data > &""'");
+ }
+ arg3 = (std::list< Data > *)(argp3);
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ jsresult = SWIG_From_bool((bool)(result));
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_Event_getParam__SWIG_3(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler)
+{
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ bool *arg3 = 0 ;
+ void *argp1 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ bool result;
+
+ res1 = SWIG_ConvertPtr(args[0], &argp1, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "1"" of type '" "uscxml::Event::params_t const &""'");
+ }
+ arg1 = (uscxml::Event::params_t *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string(args[1], &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ res3 = SWIG_ConvertPtr(args[2], &argp3, SWIGTYPE_p_bool, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_getParam" "', argument " "3"" of type '" "bool &""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_getParam" "', argument " "3"" of type '" "bool &""'");
+ }
+ arg3 = (bool *)(argp3);
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ jsresult = SWIG_From_bool((bool)(result));
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+
+ SWIGV8_RETURN(jsresult);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_Event__wrap_Event_getParam(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ OverloadErrorHandler errorHandler;
+
+
+ if(args.Length() == 3) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ jsresult = _wrap_Event_getParam__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(jsresult);
+ }
+#else
+ _wrap_Event_getParam__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+
+ if(args.Length() == 3) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ jsresult = _wrap_Event_getParam__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(jsresult);
+ }
+#else
+ _wrap_Event_getParam__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+
+ if(args.Length() == 3) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ jsresult = _wrap_Event_getParam__SWIG_3(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(jsresult);
+ }
+#else
+ _wrap_Event_getParam__SWIG_3(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for function getParam.");
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static void _wrap_Event_raw_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_raw_set" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string(value, &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_raw_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_raw_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ if (arg1) (arg1)->raw = *arg2;
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_Event_raw_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ std::string *result = 0 ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_raw_get" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ result = (std::string *) & ((arg1)->raw);
+ jsresult = SWIG_From_std_string((std::string)(*result));
+
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static void _wrap_Event_name_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *arg2 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 = SWIG_OLDOBJ ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_name_set" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ {
+ std::string *ptr = (std::string *)0;
+ res2 = SWIG_AsPtr_std_string(value, &ptr);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_name_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_name_set" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ arg2 = ptr;
+ }
+ if (arg1) (arg1)->name = *arg2;
+
+ if (SWIG_IsNewObj(res2)) delete arg2;
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_Event_name_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ std::string *result = 0 ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_name_get" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ result = (std::string *) & ((arg1)->name);
+ jsresult = SWIG_From_std_string((std::string)(*result));
+
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+static void _wrap_Event_eventType_set(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+ const SwigV8PropertyCallbackInfoVoid &info) {
+ SWIGV8_HANDLESCOPE();
+
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event::Type arg2 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_eventType_set" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ ecode2 = SWIG_AsVal_int(value, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_eventType_set" "', argument " "2"" of type '" "uscxml::Event::Type""'");
+ }
+ arg2 = (uscxml::Event::Type)(val2);
+ if (arg1) (arg1)->eventType = arg2;
+
+
+
+ goto fail;
+fail:
+ return;
+}
+
+
+static SwigV8ReturnValue _wrap_Event_eventType_get(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ uscxml::Event::Type result;
+
+ res1 = SWIG_ConvertPtr(info.Holder(), &argp1,SWIGTYPE_p_uscxml__Event, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_eventType_get" "', argument " "1"" of type '" "uscxml::Event *""'");
+ }
+ arg1 = (uscxml::Event *)(argp1);
+ result = (uscxml::Event::Type) ((arg1)->eventType);
+ jsresult = SWIG_From_int((int)(result));
+
+
+ SWIGV8_RETURN_INFO(jsresult, info);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info);
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_Event(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_Event(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_Event(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_Event(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ uscxml::Event * arg1 = (uscxml::Event *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+static SwigV8ReturnValue _wrap_new_ErrorEvent__SWIG_0(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ uscxml::ErrorEvent *result;
+ if(args.Length() != 0) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_ErrorEvent__SWIG_0.");
+ result = (uscxml::ErrorEvent *)new uscxml::ErrorEvent();
+
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_uscxml__ErrorEvent, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_ErrorEvent__SWIG_1(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> self = args.Holder();
+ std::string *arg1 = 0 ;
+ int res1 = SWIG_OLDOBJ ;
+ uscxml::ErrorEvent *result;
+ if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_new_ErrorEvent__SWIG_1.");
+ {
+ std::string *ptr = (std::string *)0;
+ res1 = SWIG_AsPtr_std_string(args[0], &ptr);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ErrorEvent" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ if (!ptr) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ErrorEvent" "', argument " "1"" of type '" "std::string const &""'");
+ }
+ arg1 = ptr;
+ }
+ result = (uscxml::ErrorEvent *)new uscxml::ErrorEvent((std::string const &)*arg1);
+
+ if (SWIG_IsNewObj(res1)) delete arg1;
+
+
+ SWIGV8_SetPrivateData(self, result, SWIGTYPE_p_uscxml__ErrorEvent, SWIG_POINTER_OWN);
+ SWIGV8_RETURN(self);
+
+ goto fail;
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+static SwigV8ReturnValue _wrap_new_ErrorEvent(const SwigV8Arguments &args) {
+ SWIGV8_HANDLESCOPE();
+
+ OverloadErrorHandler errorHandler;
+ v8::Handle<v8::Value> self;
+
+ // switch all cases by means of series of if-returns.
+
+ if(args.Length() == 0) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_ErrorEvent__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_ErrorEvent__SWIG_0(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+ if(args.Length() == 1) {
+ errorHandler.err.Clear();
+#if (SWIG_V8_VERSION < 0x031903)
+ self = _wrap_new_ErrorEvent__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ SWIGV8_ESCAPE(self);
+ }
+#else
+ _wrap_new_ErrorEvent__SWIG_1(args, errorHandler);
+ if(errorHandler.err.IsEmpty()) {
+ return;
+ }
+#endif
+ }
+
+
+ // default:
+ SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of _exports_ErrorEvent");
+
+fail:
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
+}
+
+
+#if (SWIG_V8_VERSION < 0x031710)
+static void _wrap_delete_ErrorEvent(v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < 0x031900)
+ static void _wrap_delete_ErrorEvent(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void _wrap_delete_ErrorEvent(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+#else
+ static void _wrap_delete_ErrorEvent(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
+#endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+ uscxml::ErrorEvent * arg1 = (uscxml::ErrorEvent *)proxy->swigCObject;
+ delete arg1;
+ }
+ delete proxy;
+
+#if (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+#elif (SWIG_V8_VERSION < 0x031900)
+ object.Dispose(isolate);
+#elif (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+#elif (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+#else
+ object.Clear();
+#endif
+ }
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMText(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMText *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMComment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) (XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMElementTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMElement *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMDocumentFragmentTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMDocumentFragment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMAttrTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMAttr *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMDocumentTypeTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMDocumentType *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCharacterDataTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMCharacterData *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMText *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMComment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMProcessingInstructionTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMEntityTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMEntity *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMEntityReferenceTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMEntityReference *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *)(XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMNotationTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMNotation *) x));
+}
+static void *_p_uscxml__ErrorEventTo_p_uscxml__Event(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((uscxml::Event *) ((uscxml::ErrorEvent *) x));
+}
+static swig_type_info _swigt__p_Data = {"_p_Data", "Data *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMAttr = {"_p_XERCES_CPP_NAMESPACE__DOMAttr", "XERCES_CPP_NAMESPACE::DOMAttr *|p_XERCES_CPP_NAMESPACE__DOMAttr", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection = {"_p_XERCES_CPP_NAMESPACE__DOMCDATASection", "p_XERCES_CPP_NAMESPACE__DOMCDATASection", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData = {"_p_XERCES_CPP_NAMESPACE__DOMCharacterData", "XERCES_CPP_NAMESPACE::DOMCharacterData *|p_XERCES_CPP_NAMESPACE__DOMCharacterData", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMComment = {"_p_XERCES_CPP_NAMESPACE__DOMComment", "p_XERCES_CPP_NAMESPACE__DOMComment", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocument = {"_p_XERCES_CPP_NAMESPACE__DOMDocument", "XERCES_CPP_NAMESPACE::DOMDocument *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment = {"_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment", "p_XERCES_CPP_NAMESPACE__DOMDocumentFragment", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType = {"_p_XERCES_CPP_NAMESPACE__DOMDocumentType", "XERCES_CPP_NAMESPACE::DOMDocumentType *|p_XERCES_CPP_NAMESPACE__DOMDocumentType", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMElement = {"_p_XERCES_CPP_NAMESPACE__DOMElement", "p_XERCES_CPP_NAMESPACE__DOMElement|XERCES_CPP_NAMESPACE::DOMElement *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMEntity = {"_p_XERCES_CPP_NAMESPACE__DOMEntity", "XERCES_CPP_NAMESPACE::DOMEntity *|p_XERCES_CPP_NAMESPACE__DOMEntity", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference = {"_p_XERCES_CPP_NAMESPACE__DOMEntityReference", "p_XERCES_CPP_NAMESPACE__DOMEntityReference", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMException = {"_p_XERCES_CPP_NAMESPACE__DOMException", "p_XERCES_CPP_NAMESPACE__DOMException|XERCES_CPP_NAMESPACE::DOMException *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap = {"_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap", "p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap|XERCES_CPP_NAMESPACE::DOMNamedNodeMap *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNode = {"_p_XERCES_CPP_NAMESPACE__DOMNode", "XERCES_CPP_NAMESPACE::DOMNode *|p_XERCES_CPP_NAMESPACE__DOMNode", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList = {"_p_XERCES_CPP_NAMESPACE__DOMNodeList", "p_XERCES_CPP_NAMESPACE__DOMNodeList|XERCES_CPP_NAMESPACE::DOMNodeList *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNotation = {"_p_XERCES_CPP_NAMESPACE__DOMNotation", "XERCES_CPP_NAMESPACE::DOMNotation *|p_XERCES_CPP_NAMESPACE__DOMNotation", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction = {"_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction", "XERCES_CPP_NAMESPACE::DOMProcessingInstruction *|p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMText = {"_p_XERCES_CPP_NAMESPACE__DOMText", "XERCES_CPP_NAMESPACE::DOMText *|p_XERCES_CPP_NAMESPACE__DOMText", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo = {"_p_XERCES_CPP_NAMESPACE__DOMTypeInfo", "XERCES_CPP_NAMESPACE::DOMTypeInfo *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler = {"_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler", "XERCES_CPP_NAMESPACE::DOMUserDataHandler *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__MemoryManager = {"_p_XERCES_CPP_NAMESPACE__MemoryManager", "XERCES_CPP_NAMESPACE::MemoryManager *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_bool = {"_p_bool", "bool *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int16_t = {"_p_int16_t", "XMLInt16 *|int16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int32_t = {"_p_int32_t", "int32_t *|XMLInt32 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int64_t = {"_p_int64_t", "int64_t *|XMLInt64 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_namelist_t = {"_p_namelist_t", "namelist_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_params_t = {"_p_params_t", "params_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *|XMLSize_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ssize_t = {"_p_ssize_t", "ssize_t *|XMLSSize_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__listT_Data_t = {"_p_std__listT_Data_t", "std::list< Data > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__multimapT_std__string_Data_t = {"_p_std__multimapT_std__string_Data_t", "uscxml::Event::params_t *|std::multimap< std::string,Data > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint16_t = {"_p_uint16_t", "XMLUInt16 *|UTF16Ch *|XMLCh *|uint16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *|XMLUInt32 *|UCS4Ch *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint64_t = {"_p_uint64_t", "uint64_t *|XMLUInt64 *|XMLFilePos *|XMLFileLoc *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|XMLByte *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uscxml__ErrorEvent = {"_p_uscxml__ErrorEvent", "p_uscxml__ErrorEvent", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uscxml__Event = {"_p_uscxml__Event", "uscxml::Event *|p_uscxml__Event", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_Data,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMComment,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocument,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMElement,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMException,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNode,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMText,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,
+ &_swigt__p_XERCES_CPP_NAMESPACE__MemoryManager,
+ &_swigt__p_bool,
+ &_swigt__p_char,
+ &_swigt__p_int16_t,
+ &_swigt__p_int32_t,
+ &_swigt__p_int64_t,
+ &_swigt__p_namelist_t,
+ &_swigt__p_params_t,
+ &_swigt__p_size_t,
+ &_swigt__p_ssize_t,
+ &_swigt__p_std__listT_Data_t,
+ &_swigt__p_std__multimapT_std__string_Data_t,
+ &_swigt__p_uint16_t,
+ &_swigt__p_uint32_t,
+ &_swigt__p_uint64_t,
+ &_swigt__p_unsigned_char,
+ &_swigt__p_uscxml__ErrorEvent,
+ &_swigt__p_uscxml__Event,
+ &_swigt__p_void,
+};
+
+static swig_cast_info _swigc__p_Data[] = { {&_swigt__p_Data, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMAttr[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMCDATASection[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMCharacterData[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, _p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, _p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMComment[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocument[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocument, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentType[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMElement[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMElement, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMEntity[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMEntityReference[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMException[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMException, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNode[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMElement, _p_XERCES_CPP_NAMESPACE__DOMElementTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, _p_XERCES_CPP_NAMESPACE__DOMDocumentFragmentTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr, _p_XERCES_CPP_NAMESPACE__DOMAttrTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType, _p_XERCES_CPP_NAMESPACE__DOMDocumentTypeTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData, _p_XERCES_CPP_NAMESPACE__DOMCharacterDataTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, _p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, _p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, _p_XERCES_CPP_NAMESPACE__DOMProcessingInstructionTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity, _p_XERCES_CPP_NAMESPACE__DOMEntityTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference, _p_XERCES_CPP_NAMESPACE__DOMEntityReferenceTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation, _p_XERCES_CPP_NAMESPACE__DOMNotationTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNodeList[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNotation[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMText[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMText, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMTypeInfo[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__MemoryManager[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__MemoryManager, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_bool[] = { {&_swigt__p_bool, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int16_t[] = { {&_swigt__p_int16_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int32_t[] = { {&_swigt__p_int32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int64_t[] = { {&_swigt__p_int64_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_namelist_t[] = { {&_swigt__p_namelist_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_params_t[] = { {&_swigt__p_params_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_size_t[] = { {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ssize_t[] = { {&_swigt__p_ssize_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__listT_Data_t[] = { {&_swigt__p_std__listT_Data_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__multimapT_std__string_Data_t[] = { {&_swigt__p_std__multimapT_std__string_Data_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint16_t[] = { {&_swigt__p_uint16_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint64_t[] = { {&_swigt__p_uint64_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uscxml__ErrorEvent[] = { {&_swigt__p_uscxml__ErrorEvent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uscxml__Event[] = { {&_swigt__p_uscxml__Event, 0, 0, 0}, {&_swigt__p_uscxml__ErrorEvent, _p_uscxml__ErrorEventTo_p_uscxml__Event, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_Data,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMAttr,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMCDATASection,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMCharacterData,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMComment,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocument,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentType,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMElement,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMEntity,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMEntityReference,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMException,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNode,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNodeList,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNotation,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMText,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMTypeInfo,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,
+ _swigc__p_XERCES_CPP_NAMESPACE__MemoryManager,
+ _swigc__p_bool,
+ _swigc__p_char,
+ _swigc__p_int16_t,
+ _swigc__p_int32_t,
+ _swigc__p_int64_t,
+ _swigc__p_namelist_t,
+ _swigc__p_params_t,
+ _swigc__p_size_t,
+ _swigc__p_ssize_t,
+ _swigc__p_std__listT_Data_t,
+ _swigc__p_std__multimapT_std__string_Data_t,
+ _swigc__p_uint16_t,
+ _swigc__p_uint32_t,
+ _swigc__p_uint64_t,
+ _swigc__p_unsigned_char,
+ _swigc__p_uscxml__ErrorEvent,
+ _swigc__p_uscxml__Event,
+ _swigc__p_void,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+
+
+
+#include <assert.h>
+
+SWIGRUNTIME void
+SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
+ v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
+ v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module);
+ assert(!mod.IsEmpty());
+ global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod);
+}
+
+SWIGRUNTIME swig_module_info *
+SWIG_V8_GetModule(void *) {
+ v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
+ v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"));
+
+ if (moduleinfo.IsEmpty())
+ {
+ // It's not yet loaded
+ return 0;
+ }
+
+ v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo);
+
+ if (moduleinfo_extern.IsEmpty())
+ {
+ // Something's not right
+ return 0;
+ }
+
+ void *ptr = moduleinfo_extern->Value();
+ assert(ptr);
+ swig_module_info *retptr = static_cast<swig_module_info *>(ptr);
+ assert(retptr);
+ return retptr;
+}
+
+#define SWIG_GetModule(clientdata) SWIG_V8_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer) SWIG_V8_SetModule(clientdata, pointer)
+
+
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned statically to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ * 1) If the cast->type has already been loaded AND the type we are adding
+ * casting info to has not been loaded (it is in this module), THEN we
+ * replace the cast->type pointer with the type pointer that has already
+ * been loaded.
+ * 2) If BOTH types (the one we are adding casting info to, and the
+ * cast->type) are loaded, THEN the cast info has already been loaded by
+ * the previous module so we just ignore it.
+ * 3) Finally, if cast->type has not already been loaded, then we add that
+ * swig_cast_info to the linked list (because the cast->type) pointer will
+ * be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int init;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
+
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ /* Our module is already in the list, so there's nothing more to do. */
+ return;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* otherwise we must add our module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
+
+ /* When multiple interpreters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
+ /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+
+ /* Don't need to add information already in the list */
+ ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+ if (!ocast) ret = 0;
+ }
+ }
+
+ if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n",j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types. It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run) return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+
+// Note: 'extern "C"'' disables name mangling which makes it easier to load the symbol manually
+// TODO: is it ok to do that?
+extern "C"
+#if (NODE_MODULE_VERSION < 0x000C)
+void SWIGV8_INIT (v8::Handle<v8::Object> exports)
+#else
+void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/)
+#endif
+{
+ SWIG_InitializeModule(static_cast<void *>(&exports));
+
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Object> exports_obj = exports;
+
+
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->dcast = (swig_dycast_func) DOMNode_dynamic_cast;
+
+
+ // a class template for creating proxies of undefined types
+ SWIGV8_SET_CLASS_TEMPL(SWIGV8_SWIGTYPE_Proxy_class_templ, SWIGV8_CreateClassTemplate("SwigProxy"));
+
+ /* create objects for namespaces */
+
+
+ /* create class templates */
+ /* Name: _exports_DOMException, Type: p_XERCES_CPP_NAMESPACE__DOMException, Dtor: _wrap_delete_DOMException */
+v8::Handle<v8::FunctionTemplate> _exports_DOMException_class = SWIGV8_CreateClassTemplate("_exports_DOMException");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMException_clientData.class_templ, _exports_DOMException_class);
+_exports_DOMException_clientData.dtor = _wrap_delete_DOMException;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException->clientdata = &_exports_DOMException_clientData;
+}
+/* Name: _exports_DOMNode, Type: p_XERCES_CPP_NAMESPACE__DOMNode, Dtor: _wrap_delete_DOMNode */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNode_class = SWIGV8_CreateClassTemplate("_exports_DOMNode");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMNode_clientData.class_templ, _exports_DOMNode_class);
+_exports_DOMNode_clientData.dtor = _wrap_delete_DOMNode;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata = &_exports_DOMNode_clientData;
+}
+/* Name: _exports_DOMAttr, Type: p_XERCES_CPP_NAMESPACE__DOMAttr, Dtor: _wrap_delete_DOMAttr */
+v8::Handle<v8::FunctionTemplate> _exports_DOMAttr_class = SWIGV8_CreateClassTemplate("_exports_DOMAttr");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMAttr_clientData.class_templ, _exports_DOMAttr_class);
+_exports_DOMAttr_clientData.dtor = _wrap_delete_DOMAttr;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr->clientdata = &_exports_DOMAttr_clientData;
+}
+/* Name: _exports_DOMElement, Type: p_XERCES_CPP_NAMESPACE__DOMElement, Dtor: _wrap_delete_DOMElement */
+v8::Handle<v8::FunctionTemplate> _exports_DOMElement_class = SWIGV8_CreateClassTemplate("_exports_DOMElement");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMElement_clientData.class_templ, _exports_DOMElement_class);
+_exports_DOMElement_clientData.dtor = _wrap_delete_DOMElement;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement->clientdata = &_exports_DOMElement_clientData;
+}
+/* Name: _exports_DOMEntity, Type: p_XERCES_CPP_NAMESPACE__DOMEntity, Dtor: _wrap_delete_DOMEntity */
+v8::Handle<v8::FunctionTemplate> _exports_DOMEntity_class = SWIGV8_CreateClassTemplate("_exports_DOMEntity");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMEntity_clientData.class_templ, _exports_DOMEntity_class);
+_exports_DOMEntity_clientData.dtor = _wrap_delete_DOMEntity;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity->clientdata = &_exports_DOMEntity_clientData;
+}
+/* Name: _exports_DOMDocumentType, Type: p_XERCES_CPP_NAMESPACE__DOMDocumentType, Dtor: _wrap_delete_DOMDocumentType */
+v8::Handle<v8::FunctionTemplate> _exports_DOMDocumentType_class = SWIGV8_CreateClassTemplate("_exports_DOMDocumentType");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMDocumentType_clientData.class_templ, _exports_DOMDocumentType_class);
+_exports_DOMDocumentType_clientData.dtor = _wrap_delete_DOMDocumentType;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType->clientdata = &_exports_DOMDocumentType_clientData;
+}
+/* Name: _exports_DOMCharacterData, Type: p_XERCES_CPP_NAMESPACE__DOMCharacterData, Dtor: _wrap_delete_DOMCharacterData */
+v8::Handle<v8::FunctionTemplate> _exports_DOMCharacterData_class = SWIGV8_CreateClassTemplate("_exports_DOMCharacterData");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMCharacterData_clientData.class_templ, _exports_DOMCharacterData_class);
+_exports_DOMCharacterData_clientData.dtor = _wrap_delete_DOMCharacterData;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata = &_exports_DOMCharacterData_clientData;
+}
+/* Name: _exports_DOMComment, Type: p_XERCES_CPP_NAMESPACE__DOMComment, Dtor: _wrap_delete_DOMComment */
+v8::Handle<v8::FunctionTemplate> _exports_DOMComment_class = SWIGV8_CreateClassTemplate("_exports_DOMComment");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMComment_clientData.class_templ, _exports_DOMComment_class);
+_exports_DOMComment_clientData.dtor = _wrap_delete_DOMComment;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment->clientdata = &_exports_DOMComment_clientData;
+}
+/* Name: _exports_DOMText, Type: p_XERCES_CPP_NAMESPACE__DOMText, Dtor: _wrap_delete_DOMText */
+v8::Handle<v8::FunctionTemplate> _exports_DOMText_class = SWIGV8_CreateClassTemplate("_exports_DOMText");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMText_clientData.class_templ, _exports_DOMText_class);
+_exports_DOMText_clientData.dtor = _wrap_delete_DOMText;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata = &_exports_DOMText_clientData;
+}
+/* Name: _exports_DOMCDATASection, Type: p_XERCES_CPP_NAMESPACE__DOMCDATASection, Dtor: _wrap_delete_DOMCDATASection */
+v8::Handle<v8::FunctionTemplate> _exports_DOMCDATASection_class = SWIGV8_CreateClassTemplate("_exports_DOMCDATASection");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMCDATASection_clientData.class_templ, _exports_DOMCDATASection_class);
+_exports_DOMCDATASection_clientData.dtor = _wrap_delete_DOMCDATASection;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection->clientdata = &_exports_DOMCDATASection_clientData;
+}
+/* Name: _exports_DOMNodeList, Type: p_XERCES_CPP_NAMESPACE__DOMNodeList, Dtor: _wrap_delete_DOMNodeList */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNodeList_class = SWIGV8_CreateClassTemplate("_exports_DOMNodeList");
+//_exports_DOMNodeList_class->InstanceTemplate()->SetIndexedPropertyHandler(V8NodeListIndexedPropertyHandler2);
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMNodeList_clientData.class_templ, _exports_DOMNodeList_class);
+_exports_DOMNodeList_clientData.dtor = _wrap_delete_DOMNodeList;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList->clientdata = &_exports_DOMNodeList_clientData;
+}
+/* Name: _exports_DOMNamedNodeMap, Type: p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, Dtor: _wrap_delete_DOMNamedNodeMap */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNamedNodeMap_class = SWIGV8_CreateClassTemplate("_exports_DOMNamedNodeMap");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMNamedNodeMap_clientData.class_templ, _exports_DOMNamedNodeMap_class);
+_exports_DOMNamedNodeMap_clientData.dtor = _wrap_delete_DOMNamedNodeMap;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap->clientdata = &_exports_DOMNamedNodeMap_clientData;
+}
+/* Name: _exports_DOMDocumentFragment, Type: p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, Dtor: _wrap_delete_DOMDocumentFragment */
+v8::Handle<v8::FunctionTemplate> _exports_DOMDocumentFragment_class = SWIGV8_CreateClassTemplate("_exports_DOMDocumentFragment");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMDocumentFragment_clientData.class_templ, _exports_DOMDocumentFragment_class);
+_exports_DOMDocumentFragment_clientData.dtor = _wrap_delete_DOMDocumentFragment;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment->clientdata = &_exports_DOMDocumentFragment_clientData;
+}
+/* Name: _exports_DOMEntityReference, Type: p_XERCES_CPP_NAMESPACE__DOMEntityReference, Dtor: _wrap_delete_DOMEntityReference */
+v8::Handle<v8::FunctionTemplate> _exports_DOMEntityReference_class = SWIGV8_CreateClassTemplate("_exports_DOMEntityReference");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMEntityReference_clientData.class_templ, _exports_DOMEntityReference_class);
+_exports_DOMEntityReference_clientData.dtor = _wrap_delete_DOMEntityReference;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference->clientdata = &_exports_DOMEntityReference_clientData;
+}
+/* Name: _exports_DOMNotation, Type: p_XERCES_CPP_NAMESPACE__DOMNotation, Dtor: _wrap_delete_DOMNotation */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNotation_class = SWIGV8_CreateClassTemplate("_exports_DOMNotation");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMNotation_clientData.class_templ, _exports_DOMNotation_class);
+_exports_DOMNotation_clientData.dtor = _wrap_delete_DOMNotation;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation->clientdata = &_exports_DOMNotation_clientData;
+}
+/* Name: _exports_DOMProcessingInstruction, Type: p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, Dtor: _wrap_delete_DOMProcessingInstruction */
+v8::Handle<v8::FunctionTemplate> _exports_DOMProcessingInstruction_class = SWIGV8_CreateClassTemplate("_exports_DOMProcessingInstruction");
+SWIGV8_SET_CLASS_TEMPL(_exports_DOMProcessingInstruction_clientData.class_templ, _exports_DOMProcessingInstruction_class);
+_exports_DOMProcessingInstruction_clientData.dtor = _wrap_delete_DOMProcessingInstruction;
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction->clientdata == 0) {
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction->clientdata = &_exports_DOMProcessingInstruction_clientData;
+}
+/* Name: _exports_Event, Type: p_uscxml__Event, Dtor: _wrap_delete_Event */
+v8::Handle<v8::FunctionTemplate> _exports_Event_class = SWIGV8_CreateClassTemplate("_exports_Event");
+SWIGV8_SET_CLASS_TEMPL(_exports_Event_clientData.class_templ, _exports_Event_class);
+_exports_Event_clientData.dtor = _wrap_delete_Event;
+if (SWIGTYPE_p_uscxml__Event->clientdata == 0) {
+ SWIGTYPE_p_uscxml__Event->clientdata = &_exports_Event_clientData;
+}
+/* Name: _exports_ErrorEvent, Type: p_uscxml__ErrorEvent, Dtor: _wrap_delete_ErrorEvent */
+v8::Handle<v8::FunctionTemplate> _exports_ErrorEvent_class = SWIGV8_CreateClassTemplate("_exports_ErrorEvent");
+SWIGV8_SET_CLASS_TEMPL(_exports_ErrorEvent_clientData.class_templ, _exports_ErrorEvent_class);
+_exports_ErrorEvent_clientData.dtor = _wrap_delete_ErrorEvent;
+if (SWIGTYPE_p_uscxml__ErrorEvent->clientdata == 0) {
+ SWIGTYPE_p_uscxml__ErrorEvent->clientdata = &_exports_ErrorEvent_clientData;
+}
+
+
+ /* register wrapper functions */
+ SWIGV8_AddStaticVariable(exports_obj, "XERCES_HAS_CPP_NAMESPACE", _wrap_XERCES_HAS_CPP_NAMESPACE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(exports_obj, "DEBUG_UTF8_OUT", _wrap_DEBUG_UTF8_OUT_get, _wrap_DEBUG_UTF8_OUT_set);
+SWIGV8_AddStaticVariable(exports_obj, "DEBUG_UTF8_IN", _wrap_DEBUG_UTF8_IN_get, _wrap_DEBUG_UTF8_IN_set);
+SWIGV8_AddMemberFunction(_exports_DOMException_class, "getMessage", _wrap_DOMException_getMessage);
+SWIGV8_AddMemberVariable(_exports_DOMException_class, "code", _wrap_DOMException_code_get, _wrap_DOMException_code_set);
+SWIGV8_AddMemberVariable(_exports_DOMException_class, "msg", _wrap_DOMException_msg_get, _wrap_DOMException_msg_set);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getNodeName", _wrap_DOMNode_getNodeName);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getNodeValue", _wrap_DOMNode_getNodeValue);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getNodeType", _wrap_DOMNode_getNodeType);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getParentNode", _wrap_DOMNode_getParentNode);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getChildNodes", _wrap_DOMNode_getChildNodes);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getFirstChild", _wrap_DOMNode_getFirstChild);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getLastChild", _wrap_DOMNode_getLastChild);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getPreviousSibling", _wrap_DOMNode_getPreviousSibling);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getNextSibling", _wrap_DOMNode_getNextSibling);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getAttributes", _wrap_DOMNode_getAttributes);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getOwnerDocument", _wrap_DOMNode_getOwnerDocument);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "cloneNode", _wrap_DOMNode_cloneNode);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "insertBefore", _wrap_DOMNode_insertBefore);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "replaceChild", _wrap_DOMNode_replaceChild);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "removeChild", _wrap_DOMNode_removeChild);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "appendChild", _wrap_DOMNode_appendChild);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "hasChildNodes", _wrap_DOMNode_hasChildNodes);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "setNodeValue", _wrap_DOMNode_setNodeValue);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "normalize", _wrap_DOMNode_normalize);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "isSupported", _wrap_DOMNode_isSupported);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getNamespaceURI", _wrap_DOMNode_getNamespaceURI);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getLocalName", _wrap_DOMNode_getLocalName);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "setPrefix", _wrap_DOMNode_setPrefix);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "hasAttributes", _wrap_DOMNode_hasAttributes);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "isSameNode", _wrap_DOMNode_isSameNode);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "isEqualNode", _wrap_DOMNode_isEqualNode);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "setUserData", _wrap_DOMNode_setUserData);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getUserData", _wrap_DOMNode_getUserData);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getBaseURI", _wrap_DOMNode_getBaseURI);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "compareDocumentPosition", _wrap_DOMNode_compareDocumentPosition);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getTextContent", _wrap_DOMNode_getTextContent);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "setTextContent", _wrap_DOMNode_setTextContent);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "lookupPrefix", _wrap_DOMNode_lookupPrefix);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "isDefaultNamespace", _wrap_DOMNode_isDefaultNamespace);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "lookupNamespaceURI", _wrap_DOMNode_lookupNamespaceURI);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "getFeature", _wrap_DOMNode_getFeature);
+SWIGV8_AddMemberFunction(_exports_DOMNode_class, "release", _wrap_DOMNode_release);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "getName", _wrap_DOMAttr_getName);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "getSpecified", _wrap_DOMAttr_getSpecified);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "getValue", _wrap_DOMAttr_getValue);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "setValue", _wrap_DOMAttr_setValue);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "getOwnerElement", _wrap_DOMAttr_getOwnerElement);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "isId", _wrap_DOMAttr_isId);
+SWIGV8_AddMemberFunction(_exports_DOMAttr_class, "getSchemaTypeInfo", _wrap_DOMAttr_getSchemaTypeInfo);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getTagName", _wrap_DOMElement_getTagName);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getAttribute", _wrap_DOMElement_getAttribute);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getAttributeNode", _wrap_DOMElement_getAttributeNode);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getElementsByTagName", _wrap_DOMElement_getElementsByTagName);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setAttribute", _wrap_DOMElement_setAttribute);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setAttributeNode", _wrap_DOMElement_setAttributeNode);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "removeAttributeNode", _wrap_DOMElement_removeAttributeNode);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "removeAttribute", _wrap_DOMElement_removeAttribute);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getAttributeNS", _wrap_DOMElement_getAttributeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setAttributeNS", _wrap_DOMElement_setAttributeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "removeAttributeNS", _wrap_DOMElement_removeAttributeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getAttributeNodeNS", _wrap_DOMElement_getAttributeNodeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setAttributeNodeNS", _wrap_DOMElement_setAttributeNodeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getElementsByTagNameNS", _wrap_DOMElement_getElementsByTagNameNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "hasAttribute", _wrap_DOMElement_hasAttribute);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "hasAttributeNS", _wrap_DOMElement_hasAttributeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setIdAttribute", _wrap_DOMElement_setIdAttribute);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setIdAttributeNS", _wrap_DOMElement_setIdAttributeNS);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "setIdAttributeNode", _wrap_DOMElement_setIdAttributeNode);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getSchemaTypeInfo", _wrap_DOMElement_getSchemaTypeInfo);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getFirstElementChild", _wrap_DOMElement_getFirstElementChild);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getLastElementChild", _wrap_DOMElement_getLastElementChild);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getPreviousElementSibling", _wrap_DOMElement_getPreviousElementSibling);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getNextElementSibling", _wrap_DOMElement_getNextElementSibling);
+SWIGV8_AddMemberFunction(_exports_DOMElement_class, "getChildElementCount", _wrap_DOMElement_getChildElementCount);
+SWIGV8_AddMemberFunction(_exports_DOMEntity_class, "getPublicId", _wrap_DOMEntity_getPublicId);
+SWIGV8_AddMemberFunction(_exports_DOMEntity_class, "getSystemId", _wrap_DOMEntity_getSystemId);
+SWIGV8_AddMemberFunction(_exports_DOMEntity_class, "getNotationName", _wrap_DOMEntity_getNotationName);
+SWIGV8_AddMemberFunction(_exports_DOMEntity_class, "getInputEncoding", _wrap_DOMEntity_getInputEncoding);
+SWIGV8_AddMemberFunction(_exports_DOMEntity_class, "getXmlEncoding", _wrap_DOMEntity_getXmlEncoding);
+SWIGV8_AddMemberFunction(_exports_DOMEntity_class, "getXmlVersion", _wrap_DOMEntity_getXmlVersion);
+SWIGV8_AddMemberFunction(_exports_DOMDocumentType_class, "getName", _wrap_DOMDocumentType_getName);
+SWIGV8_AddMemberFunction(_exports_DOMDocumentType_class, "getEntities", _wrap_DOMDocumentType_getEntities);
+SWIGV8_AddMemberFunction(_exports_DOMDocumentType_class, "getNotations", _wrap_DOMDocumentType_getNotations);
+SWIGV8_AddMemberFunction(_exports_DOMDocumentType_class, "getPublicId", _wrap_DOMDocumentType_getPublicId);
+SWIGV8_AddMemberFunction(_exports_DOMDocumentType_class, "getSystemId", _wrap_DOMDocumentType_getSystemId);
+SWIGV8_AddMemberFunction(_exports_DOMDocumentType_class, "getInternalSubset", _wrap_DOMDocumentType_getInternalSubset);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "getData", _wrap_DOMCharacterData_getData);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "getLength", _wrap_DOMCharacterData_getLength);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "substringData", _wrap_DOMCharacterData_substringData);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "appendData", _wrap_DOMCharacterData_appendData);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "insertData", _wrap_DOMCharacterData_insertData);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "deleteData", _wrap_DOMCharacterData_deleteData);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "replaceData", _wrap_DOMCharacterData_replaceData);
+SWIGV8_AddMemberFunction(_exports_DOMCharacterData_class, "setData", _wrap_DOMCharacterData_setData);
+SWIGV8_AddMemberFunction(_exports_DOMText_class, "splitText", _wrap_DOMText_splitText);
+SWIGV8_AddMemberFunction(_exports_DOMText_class, "getIsElementContentWhitespace", _wrap_DOMText_getIsElementContentWhitespace);
+SWIGV8_AddMemberFunction(_exports_DOMText_class, "getWholeText", _wrap_DOMText_getWholeText);
+SWIGV8_AddMemberFunction(_exports_DOMText_class, "replaceWholeText", _wrap_DOMText_replaceWholeText);
+SWIGV8_AddMemberFunction(_exports_DOMText_class, "isIgnorableWhitespace", _wrap_DOMText_isIgnorableWhitespace);
+SWIGV8_AddMemberFunction(_exports_DOMNodeList_class, "item", _wrap_DOMNodeList_item);
+SWIGV8_AddMemberFunction(_exports_DOMNodeList_class, "getLength", _wrap_DOMNodeList_getLength);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "setNamedItem", _wrap_DOMNamedNodeMap_setNamedItem);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "item", _wrap_DOMNamedNodeMap_item);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "getNamedItem", _wrap_DOMNamedNodeMap_getNamedItem);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "getLength", _wrap_DOMNamedNodeMap_getLength);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "removeNamedItem", _wrap_DOMNamedNodeMap_removeNamedItem);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "getNamedItemNS", _wrap_DOMNamedNodeMap_getNamedItemNS);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "setNamedItemNS", _wrap_DOMNamedNodeMap_setNamedItemNS);
+SWIGV8_AddMemberFunction(_exports_DOMNamedNodeMap_class, "removeNamedItemNS", _wrap_DOMNamedNodeMap_removeNamedItemNS);
+SWIGV8_AddMemberFunction(_exports_DOMNotation_class, "getPublicId", _wrap_DOMNotation_getPublicId);
+SWIGV8_AddMemberFunction(_exports_DOMNotation_class, "getSystemId", _wrap_DOMNotation_getSystemId);
+SWIGV8_AddMemberFunction(_exports_DOMProcessingInstruction_class, "getTarget", _wrap_DOMProcessingInstruction_getTarget);
+SWIGV8_AddMemberFunction(_exports_DOMProcessingInstruction_class, "getData", _wrap_DOMProcessingInstruction_getData);
+SWIGV8_AddMemberFunction(_exports_DOMProcessingInstruction_class, "setData", _wrap_DOMProcessingInstruction_setData);
+SWIGV8_AddMemberFunction(_exports_Event_class, "operator_equal_to", _wrap_Event_operator_equal_to);
+SWIGV8_AddMemberFunction(_exports_Event_class, "operator_not_equal_to", _wrap_Event_operator_not_equal_to);
+SWIGV8_AddMemberVariable(_exports_Event_class, "raw", _wrap_Event_raw_get, _wrap_Event_raw_set);
+SWIGV8_AddMemberVariable(_exports_Event_class, "name", _wrap_Event_name_get, _wrap_Event_name_set);
+SWIGV8_AddMemberVariable(_exports_Event_class, "eventType", _wrap_Event_eventType_get, _wrap_Event_eventType_set);
+
+
+ /* setup inheritances */
+ if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMAttr_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMAttr_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMAttr _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMAttr _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMElement_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMElement_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMElement _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMElement _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMEntity_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMEntity_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMEntity _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMEntity _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMDocumentType_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMDocumentType_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMDocumentType _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMDocumentType _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMCharacterData_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMCharacterData_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMCharacterData _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMCharacterData _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMComment_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata)->class_templ);
+#else
+ _exports_DOMComment_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMComment _XERCES_CPP_NAMESPACE__DOMCharacterData\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMComment _XERCES_CPP_NAMESPACE__DOMCharacterData\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMText_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata)->class_templ);
+#else
+ _exports_DOMText_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMText _XERCES_CPP_NAMESPACE__DOMCharacterData\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMText _XERCES_CPP_NAMESPACE__DOMCharacterData\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMCDATASection_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata)->class_templ);
+#else
+ _exports_DOMCDATASection_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMCDATASection _XERCES_CPP_NAMESPACE__DOMText\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMCDATASection _XERCES_CPP_NAMESPACE__DOMText\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMDocumentFragment_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMDocumentFragment_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMDocumentFragment _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMDocumentFragment _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMEntityReference_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMEntityReference_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMEntityReference _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMEntityReference _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMNotation_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMNotation_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMNotation _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMNotation _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_DOMProcessingInstruction_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ);
+#else
+ _exports_DOMProcessingInstruction_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_DOMProcessingInstruction _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_DOMProcessingInstruction _XERCES_CPP_NAMESPACE__DOMNode\n");
+#endif
+}
+if (SWIGTYPE_p_uscxml__Event->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_uscxml__Event->clientdata)->class_templ.IsEmpty()))
+{
+#if (SWIG_V8_VERSION < 0x031903)
+ _exports_ErrorEvent_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_uscxml__Event->clientdata)->class_templ);
+#else
+ _exports_ErrorEvent_class->Inherit(
+ v8::Local<v8::FunctionTemplate>::New(
+ v8::Isolate::GetCurrent(),
+ static_cast<SWIGV8_ClientData *>(SWIGTYPE_p_uscxml__Event->clientdata)->class_templ)
+ );
+#endif
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Inheritance successful _exports_ErrorEvent _uscxml__Event\n");
+#endif
+} else {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("Unable to inherit baseclass, it didn't exist _exports_ErrorEvent _uscxml__Event\n");
+#endif
+}
+
+
+ /* class instances */
+ /* Class: DOMException (_exports_DOMException) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMException_class_0 = SWIGV8_CreateClassTemplate("DOMException");
+_exports_DOMException_class_0->SetCallHandler(_wrap_new_DOMException);
+_exports_DOMException_class_0->Inherit(_exports_DOMException_class);
+_exports_DOMException_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMException_obj = _exports_DOMException_class_0->GetFunction();
+/* Class: DOMNode (_exports_DOMNode) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNode_class_0 = SWIGV8_CreateClassTemplate("DOMNode");
+_exports_DOMNode_class_0->SetCallHandler(_wrap_new_veto_DOMNode);
+_exports_DOMNode_class_0->Inherit(_exports_DOMNode_class);
+_exports_DOMNode_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMNode_obj = _exports_DOMNode_class_0->GetFunction();
+/* Class: DOMAttr (_exports_DOMAttr) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMAttr_class_0 = SWIGV8_CreateClassTemplate("DOMAttr");
+_exports_DOMAttr_class_0->SetCallHandler(_wrap_new_veto_DOMAttr);
+_exports_DOMAttr_class_0->Inherit(_exports_DOMAttr_class);
+_exports_DOMAttr_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMAttr_obj = _exports_DOMAttr_class_0->GetFunction();
+/* Class: DOMElement (_exports_DOMElement) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMElement_class_0 = SWIGV8_CreateClassTemplate("DOMElement");
+_exports_DOMElement_class_0->SetCallHandler(_wrap_new_veto_DOMElement);
+_exports_DOMElement_class_0->Inherit(_exports_DOMElement_class);
+_exports_DOMElement_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMElement_obj = _exports_DOMElement_class_0->GetFunction();
+/* Class: DOMEntity (_exports_DOMEntity) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMEntity_class_0 = SWIGV8_CreateClassTemplate("DOMEntity");
+_exports_DOMEntity_class_0->SetCallHandler(_wrap_new_veto_DOMEntity);
+_exports_DOMEntity_class_0->Inherit(_exports_DOMEntity_class);
+_exports_DOMEntity_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMEntity_obj = _exports_DOMEntity_class_0->GetFunction();
+/* Class: DOMDocumentType (_exports_DOMDocumentType) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMDocumentType_class_0 = SWIGV8_CreateClassTemplate("DOMDocumentType");
+_exports_DOMDocumentType_class_0->SetCallHandler(_wrap_new_veto_DOMDocumentType);
+_exports_DOMDocumentType_class_0->Inherit(_exports_DOMDocumentType_class);
+_exports_DOMDocumentType_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMDocumentType_obj = _exports_DOMDocumentType_class_0->GetFunction();
+/* Class: DOMCharacterData (_exports_DOMCharacterData) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMCharacterData_class_0 = SWIGV8_CreateClassTemplate("DOMCharacterData");
+_exports_DOMCharacterData_class_0->SetCallHandler(_wrap_new_veto_DOMCharacterData);
+_exports_DOMCharacterData_class_0->Inherit(_exports_DOMCharacterData_class);
+_exports_DOMCharacterData_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMCharacterData_obj = _exports_DOMCharacterData_class_0->GetFunction();
+/* Class: DOMComment (_exports_DOMComment) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMComment_class_0 = SWIGV8_CreateClassTemplate("DOMComment");
+_exports_DOMComment_class_0->SetCallHandler(_wrap_new_veto_DOMComment);
+_exports_DOMComment_class_0->Inherit(_exports_DOMComment_class);
+_exports_DOMComment_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMComment_obj = _exports_DOMComment_class_0->GetFunction();
+/* Class: DOMText (_exports_DOMText) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMText_class_0 = SWIGV8_CreateClassTemplate("DOMText");
+_exports_DOMText_class_0->SetCallHandler(_wrap_new_veto_DOMText);
+_exports_DOMText_class_0->Inherit(_exports_DOMText_class);
+_exports_DOMText_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMText_obj = _exports_DOMText_class_0->GetFunction();
+/* Class: DOMCDATASection (_exports_DOMCDATASection) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMCDATASection_class_0 = SWIGV8_CreateClassTemplate("DOMCDATASection");
+_exports_DOMCDATASection_class_0->SetCallHandler(_wrap_new_veto_DOMCDATASection);
+_exports_DOMCDATASection_class_0->Inherit(_exports_DOMCDATASection_class);
+_exports_DOMCDATASection_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMCDATASection_obj = _exports_DOMCDATASection_class_0->GetFunction();
+/* Class: DOMNodeList (_exports_DOMNodeList) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNodeList_class_0 = SWIGV8_CreateClassTemplate("DOMNodeList");
+_exports_DOMNodeList_class_0->SetCallHandler(_wrap_new_veto_DOMNodeList);
+_exports_DOMNodeList_class_0->Inherit(_exports_DOMNodeList_class);
+_exports_DOMNodeList_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMNodeList_obj = _exports_DOMNodeList_class_0->GetFunction();
+/* Class: DOMNamedNodeMap (_exports_DOMNamedNodeMap) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNamedNodeMap_class_0 = SWIGV8_CreateClassTemplate("DOMNamedNodeMap");
+_exports_DOMNamedNodeMap_class_0->SetCallHandler(_wrap_new_veto_DOMNamedNodeMap);
+_exports_DOMNamedNodeMap_class_0->Inherit(_exports_DOMNamedNodeMap_class);
+_exports_DOMNamedNodeMap_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMNamedNodeMap_obj = _exports_DOMNamedNodeMap_class_0->GetFunction();
+/* Class: DOMDocumentFragment (_exports_DOMDocumentFragment) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMDocumentFragment_class_0 = SWIGV8_CreateClassTemplate("DOMDocumentFragment");
+_exports_DOMDocumentFragment_class_0->SetCallHandler(_wrap_new_veto_DOMDocumentFragment);
+_exports_DOMDocumentFragment_class_0->Inherit(_exports_DOMDocumentFragment_class);
+_exports_DOMDocumentFragment_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMDocumentFragment_obj = _exports_DOMDocumentFragment_class_0->GetFunction();
+/* Class: DOMEntityReference (_exports_DOMEntityReference) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMEntityReference_class_0 = SWIGV8_CreateClassTemplate("DOMEntityReference");
+_exports_DOMEntityReference_class_0->SetCallHandler(_wrap_new_veto_DOMEntityReference);
+_exports_DOMEntityReference_class_0->Inherit(_exports_DOMEntityReference_class);
+_exports_DOMEntityReference_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMEntityReference_obj = _exports_DOMEntityReference_class_0->GetFunction();
+/* Class: DOMNotation (_exports_DOMNotation) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMNotation_class_0 = SWIGV8_CreateClassTemplate("DOMNotation");
+_exports_DOMNotation_class_0->SetCallHandler(_wrap_new_veto_DOMNotation);
+_exports_DOMNotation_class_0->Inherit(_exports_DOMNotation_class);
+_exports_DOMNotation_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMNotation_obj = _exports_DOMNotation_class_0->GetFunction();
+/* Class: DOMProcessingInstruction (_exports_DOMProcessingInstruction) */
+v8::Handle<v8::FunctionTemplate> _exports_DOMProcessingInstruction_class_0 = SWIGV8_CreateClassTemplate("DOMProcessingInstruction");
+_exports_DOMProcessingInstruction_class_0->SetCallHandler(_wrap_new_veto_DOMProcessingInstruction);
+_exports_DOMProcessingInstruction_class_0->Inherit(_exports_DOMProcessingInstruction_class);
+_exports_DOMProcessingInstruction_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_DOMProcessingInstruction_obj = _exports_DOMProcessingInstruction_class_0->GetFunction();
+/* Class: Event (_exports_Event) */
+v8::Handle<v8::FunctionTemplate> _exports_Event_class_0 = SWIGV8_CreateClassTemplate("Event");
+_exports_Event_class_0->SetCallHandler(_wrap_new_Event);
+_exports_Event_class_0->Inherit(_exports_Event_class);
+_exports_Event_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_Event_obj = _exports_Event_class_0->GetFunction();
+/* Class: ErrorEvent (_exports_ErrorEvent) */
+v8::Handle<v8::FunctionTemplate> _exports_ErrorEvent_class_0 = SWIGV8_CreateClassTemplate("ErrorEvent");
+_exports_ErrorEvent_class_0->SetCallHandler(_wrap_new_ErrorEvent);
+_exports_ErrorEvent_class_0->Inherit(_exports_ErrorEvent_class);
+_exports_ErrorEvent_class_0->SetHiddenPrototype(true);
+v8::Handle<v8::Object> _exports_ErrorEvent_obj = _exports_ErrorEvent_class_0->GetFunction();
+
+
+ /* add static class functions and variables */
+ SWIGV8_AddStaticVariable(_exports_DOMException_obj, "INDEX_SIZE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INDEX_SIZE_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "DOMSTRING_SIZE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_DOMSTRING_SIZE_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "HIERARCHY_REQUEST_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_HIERARCHY_REQUEST_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "WRONG_DOCUMENT_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_WRONG_DOCUMENT_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "INVALID_CHARACTER_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_CHARACTER_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "NO_DATA_ALLOWED_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_DATA_ALLOWED_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "NO_MODIFICATION_ALLOWED_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NO_MODIFICATION_ALLOWED_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "NOT_FOUND_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_FOUND_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "NOT_SUPPORTED_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NOT_SUPPORTED_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "INUSE_ATTRIBUTE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INUSE_ATTRIBUTE_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "INVALID_STATE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_STATE_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "SYNTAX_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_SYNTAX_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "INVALID_MODIFICATION_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_MODIFICATION_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "NAMESPACE_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_NAMESPACE_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "INVALID_ACCESS_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_INVALID_ACCESS_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "VALIDATION_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_VALIDATION_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMException_obj, "TYPE_MISMATCH_ERR", _wrap_XERCES_CPP_NAMESPACE_DOMException_TYPE_MISMATCH_ERR, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "ELEMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ELEMENT_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "ATTRIBUTE_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ATTRIBUTE_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "TEXT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_TEXT_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "CDATA_SECTION_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_CDATA_SECTION_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "ENTITY_REFERENCE_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_REFERENCE_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "ENTITY_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_ENTITY_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "PROCESSING_INSTRUCTION_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_PROCESSING_INSTRUCTION_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "COMMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_COMMENT_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_TYPE_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_TYPE_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_FRAGMENT_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_FRAGMENT_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "NOTATION_NODE", _wrap_XERCES_CPP_NAMESPACE_DOMNode_NOTATION_NODE, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_POSITION_DISCONNECTED", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_DISCONNECTED, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_POSITION_PRECEDING", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_PRECEDING, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_POSITION_FOLLOWING", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_FOLLOWING, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_POSITION_CONTAINS", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINS, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_POSITION_CONTAINED_BY", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_CONTAINED_BY, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_DOMNode_obj, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", _wrap_XERCES_CPP_NAMESPACE_DOMNode_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_Event_obj, "INTERNAL", _wrap_uscxml_Event_INTERNAL, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_Event_obj, "EXTERNAL", _wrap_uscxml_Event_EXTERNAL, JS_veto_set_variable);
+SWIGV8_AddStaticVariable(_exports_Event_obj, "PLATFORM", _wrap_uscxml_Event_PLATFORM, JS_veto_set_variable);
+SWIGV8_AddStaticFunction(_exports_Event_obj, "getParam", _wrap_Event__wrap_Event_getParam);
+
+
+ /* register classes */
+ exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMException"), _exports_DOMException_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMNode"), _exports_DOMNode_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMAttr"), _exports_DOMAttr_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMElement"), _exports_DOMElement_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMEntity"), _exports_DOMEntity_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMDocumentType"), _exports_DOMDocumentType_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMCharacterData"), _exports_DOMCharacterData_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMComment"), _exports_DOMComment_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMText"), _exports_DOMText_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMCDATASection"), _exports_DOMCDATASection_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMNodeList"), _exports_DOMNodeList_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMNamedNodeMap"), _exports_DOMNamedNodeMap_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMDocumentFragment"), _exports_DOMDocumentFragment_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMEntityReference"), _exports_DOMEntityReference_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMNotation"), _exports_DOMNotation_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("DOMProcessingInstruction"), _exports_DOMProcessingInstruction_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("Event"), _exports_Event_obj);
+exports_obj->Set(SWIGV8_SYMBOL_NEW("ErrorEvent"), _exports_ErrorEvent_obj);
+
+
+ /* create and register namespace objects */
+
+}
+
+#if defined(BUILDING_NODE_EXTENSION)
+NODE_MODULE(V8DOM, V8DOM_initialize)
+#endif
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h
deleted file mode 100644
index dd0c18a..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef V8DOM_H_LKE1HKJK
-#define V8DOM_H_LKE1HKJK
-
-#include "uscxml/Common.h"
-#include "uscxml/Interpreter.h"
-#include <v8.h>
-#include <XPath/XPath.hpp>
-#include "../Storage.h"
-
-#define V8_DESTRUCTOR(type) \
-static void jsDestructor(v8::Persistent<v8::Value> object, void* data) { \
- v8::HandleScope handleScope; \
- type* thing = static_cast<type*>(v8::Local<v8::External>::Cast(object->ToObject()->GetInternalField(0))->Value()); \
- delete thing->nativeObj; \
- delete thing; \
- object.Dispose(); \
- object.Clear(); \
-}
-
-#define V8_DESTRUCTOR_KEEP_WRAPPED(type) \
-static void jsDestructor(v8::Persistent<v8::Value> object, void* data) { \
-v8::HandleScope handleScope; \
-type* thing = static_cast<type*>(v8::Local<v8::External>::Cast(object->ToObject()->GetInternalField(0))->Value()); \
-delete thing; \
-object.Dispose(); \
-object.Clear(); \
-}
-
-namespace Arabica {
-namespace DOM {
-
-class V8DOM {
-public:
- V8DOM();
- virtual ~V8DOM();
-
- template <typename T>
- static T* toClassPtr(v8::Local<v8::Value> data) {
- if(data.IsEmpty())
- return NULL;
- else if(!data->IsExternal())
- return NULL;
- else
-// return v8::External::Cast(*data)->Value();
- return static_cast<T *>(v8::External::Unwrap(data));
- return NULL;
- }
- static v8::Local<v8::External> toExternal(void* pointer) {
- v8::HandleScope scope;
- return scope.Close(v8::External::New(pointer));
-// return v8::External::New(pointer);
- }
-
- uscxml::NameSpaceInfo* nsInfo;
- Arabica::XPath::XPath<std::string>* xpath;
- uscxml::Storage* storage;
-};
-
-class V8Exception : public std::runtime_error {
-public:
-
- V8Exception(const std::string& reason) :
- std::runtime_error("DOMException") {
- } // V8Exception
-
- V8Exception(const V8Exception& rhs) :
- std::runtime_error(rhs),
- reason_(rhs.reason_) {
- } // DOMException
-
- virtual ~V8Exception() throw() {
- } // DOMBadCast
-
- virtual const char* what() const throw() {
- return reason_.c_str();
- } // what
-
-private:
- DOMBadCast& operator=(const DOMBadCast&);
- bool operator==(const DOMBadCast&) const;
-
- std::string reason_;
-}; // class DOMException
-
-}
-}
-#endif /* end of include guard: V8DOM_H_LKE1HKJK */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 85ae0cd..8b2bb04 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -23,74 +23,50 @@
*/
#include "uscxml/Common.h"
-#include "uscxml/config.h"
-#include "V8DataModel.h"
-#include "V8DOM.h"
-#include "dom/V8Document.h"
-#include "dom/V8Node.h"
-#include "dom/V8Element.h"
-#include "dom/V8Text.h"
-#include "dom/V8CDATASection.h"
-#include "dom/V8SCXMLEvent.h"
-
-#include "dom/V8ArrayBuffer.h"
-#include "dom/V8Int8Array.h"
-#include "dom/V8Uint8Array.h"
-#include "dom/V8Uint8ClampedArray.h"
-#include "dom/V8Int16Array.h"
-#include "dom/V8Uint16Array.h"
-#include "dom/V8Int32Array.h"
-#include "dom/V8Uint32Array.h"
-#include "dom/V8Float32Array.h"
-#include "dom/V8Float64Array.h"
-#include "dom/V8DataView.h"
-
-#include "uscxml/Message.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
+#include "uscxml/util/URL.h"
+#include "uscxml/util/String.h"
-#define TO_V8_DOMVALUE(type) \
-v8::Handle<v8::Function> retCtor = V8##type::getTmpl()->GetFunction();\
-v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());\
-struct V8##type::V8##type##Private* retPrivData = new V8##type::V8##type##Private();\
-retPrivData->dom = _dom;\
-retPrivData->nativeObj = new type<std::string>(node);\
-retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));\
-retObj.MakeWeak(0, V8##type::jsDestructor);\
-return retObj;
+#include "V8DataModel.h"
+//#include "V8SCXMLEvent.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/util/DOM.h"
+#include <easylogging++.h>
-namespace uscxml {
+using namespace xercesc;
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
+static v8::Local<v8::Value> XMLString2JS(const XMLCh* input) {
+ char* res = xercesc::XMLString::transcode(input);
+ v8::Local<v8::Value> handle = v8::String::New(res);
+ return handle;
+}
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new V8DataModelProvider() );
- return true;
+static XMLCh* JS2XMLString(const v8::Local<v8::Value>& value) {
+ v8::String::AsciiValue s(value);
+ XMLCh* ret = xercesc::XMLString::transcode(*s);
+ return(ret);
}
-#endif
-V8DataModel::V8DataModel() : _ioProcessorsAreSet(false), _invokersAreSet(false) {
+// javascript magic here
+
+#define SWIG_V8_VERSION 0x034000
+#include "V8DOM.cpp.inc"
+
+namespace uscxml {
+
+V8DataModel::V8DataModel() {
// _contexts.push_back(v8::Context::New());
}
V8DataModel::~V8DataModel() {
- while(_contexts.size() > 0) {
- _contexts.back().Dispose();
- _contexts.pop_back();
- }
- if (_dom)
- delete _dom;
+ _context.Dispose();
+// if (_isolate != NULL) {
+// _isolate->Dispose();
+// }
}
void V8DataModel::addExtension(DataModelExtension* ext) {
+#if 0
if (_extensions.find(ext) != _extensions.end())
return;
@@ -100,7 +76,7 @@ void V8DataModel::addExtension(DataModelExtension* ext) {
v8::Locker locker;
v8::HandleScope scope;
v8::Context::Scope contextScope(_contexts.front());
- v8::Handle<v8::Object> currScope = _contexts.front()->Global();
+ v8::Local<v8::Object> currScope = _contexts.front()->Global();
std::list<std::string> locPath = tokenize(ext->provides(), '.');
std::list<std::string>::iterator locIter = locPath.begin();
@@ -126,9 +102,11 @@ void V8DataModel::addExtension(DataModelExtension* ext) {
break;
}
}
+#endif
}
-v8::Handle<v8::Value> V8DataModel::jsExtension(const v8::Arguments& args) {
+void V8DataModel::jsExtension(const v8::FunctionCallbackInfo<v8::Value>& info) {
+#if 0
DataModelExtension* extension = static_cast<DataModelExtension*>(v8::External::Unwrap(args.Data()));
v8::Local<v8::String> memberJS;
@@ -151,33 +129,101 @@ v8::Handle<v8::Value> V8DataModel::jsExtension(const v8::Arguments& args) {
return ((V8DataModel*)(extension->dm))->getDataAsValue(extension->getValueOf(memberName));
}
return v8::Undefined();
+#endif
}
-boost::shared_ptr<DataModelImpl> V8DataModel::create(InterpreterInfo* interpreter) {
- boost::shared_ptr<V8DataModel> dm = boost::shared_ptr<V8DataModel>(new V8DataModel());
- dm->_interpreter = interpreter;
- v8::Locker locker;
- v8::HandleScope scope;
+std::mutex V8DataModel::_initMutex;
+
+v8::Isolate* V8DataModel::_isolate = NULL;
+
+void V8NodeListIndexedPropertyHandler(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
+ xercesc::DOMNodeList* list;
+ SWIG_V8_GetInstancePtr(info.Holder(), (void**)&list);
+
+ if (list->getLength() >= index) {
+ xercesc::DOMNode* node = list->item(index);
+
+ v8::Handle<v8::Value> val = SWIG_NewPointerObj(SWIG_as_voidptr(node), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), 0 | 0 );
+ info.GetReturnValue().Set(val);
+ return;
+ }
+ info.GetReturnValue().Set(v8::Undefined());
- dm->_dom = new V8DOM();
-// dom->interpreter = interpreter;
- dm->_dom->xpath = new XPath<std::string>();
- dm->_dom->xpath->setNamespaceContext(*interpreter->getNameSpaceInfo().getNSContext());
- dm->_dom->storage = new Storage(URL::getResourceDir() + PATH_SEPERATOR + interpreter->getName() + ".storage");
- dm->_dom->nsInfo = new NameSpaceInfo(interpreter->getNameSpaceInfo());
- // see http://stackoverflow.com/questions/3171418/v8-functiontemplate-class-instance
+}
+
+std::shared_ptr<DataModelImpl> V8DataModel::create(DataModelCallbacks* callbacks) {
+ std::shared_ptr<V8DataModel> dm(new V8DataModel());
+ dm->_callbacks = callbacks;
+
+ // TODO: we cannot use one isolate per thread as swig's type will be unknown :(
+ // We could register them by hand and avoid the _export_ globals in swig?
+ if (dm->_isolate == NULL) {
+ dm->_isolate = v8::Isolate::New();
+ }
+
+ v8::Locker locker(dm->_isolate);
+ v8::Isolate::Scope isoScope(dm->_isolate);
+
+ // Create a handle scope to hold the temporary references.
+ v8::HandleScope scope(dm->_isolate);
+
+ // Create a template for the global object where we set the built-in global functions.
+ v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
// some free functions
- v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
- global->Set(v8::String::New("In"), v8::FunctionTemplate::New(jsIn, v8::External::New(reinterpret_cast<void*>(dm.get()))), v8::ReadOnly);
- global->Set(v8::String::New("print"), v8::FunctionTemplate::New(jsPrint, v8::External::New(reinterpret_cast<void*>(dm.get()))), v8::ReadOnly);
+ global->Set(v8::String::NewSymbol("print"),
+ v8::FunctionTemplate::New(dm->_isolate, jsPrint,v8::External::New(reinterpret_cast<void*>(dm.get()))));
+ global->Set(v8::String::NewSymbol("In"),
+ v8::FunctionTemplate::New(dm->_isolate, jsIn, v8::External::New(reinterpret_cast<void*>(dm.get()))));
+
+ v8::Local<v8::Context> context = v8::Context::New(dm->_isolate, NULL, global);
+
+ dm->_context.Reset(dm->_isolate, context);
- v8::Persistent<v8::Context> context = v8::Context::New(0, global);
+ // Enter the new context so all the following operations take place within it.
v8::Context::Scope contextScope(context);
+ assert(dm->_isolate->GetCurrentContext() == context);
+
+ // not thread safe!
+ {
+ std::lock_guard<std::mutex> lock(_initMutex);
+ SWIGV8_INIT(context->Global());
+
+ // register subscript operator with nodelist
+ v8::Handle<v8::FunctionTemplate> _exports_DOMNodeList_class = SWIGV8_CreateClassTemplate("_exports_DOMNodeList");
+
+ _exports_DOMNodeList_class->InstanceTemplate()->SetIndexedPropertyHandler(V8NodeListIndexedPropertyHandler);
+ SWIGV8_AddMemberFunction(_exports_DOMNodeList_class, "item", _wrap_DOMNodeList_item);
+ SWIGV8_AddMemberFunction(_exports_DOMNodeList_class, "getLength", _wrap_DOMNodeList_getLength);
+
+ SWIGV8_SET_CLASS_TEMPL(_exports_DOMNodeList_clientData.class_templ, _exports_DOMNodeList_class);
+
+ }
+
+ context->Global()->SetAccessor(v8::String::NewSymbol("_sessionid"),
+ V8DataModel::getAttribute,
+ V8DataModel::setWithException,
+ v8::String::New(callbacks->getSessionId().c_str()));
+ context->Global()->SetAccessor(v8::String::NewSymbol("_name"),
+ V8DataModel::getAttribute,
+ V8DataModel::setWithException,
+ v8::String::New(callbacks->getName().c_str()));
+ context->Global()->SetAccessor(v8::String::NewSymbol("_ioprocessors"),
+ V8DataModel::getIOProcessors,
+ V8DataModel::setWithException,
+ v8::External::New(reinterpret_cast<void*>(dm.get())));
+ context->Global()->SetAccessor(v8::String::NewSymbol("_invokers"),
+ V8DataModel::getInvokers,
+ V8DataModel::setWithException,
+ v8::External::New(reinterpret_cast<void*>(dm.get())));
+
+// v8::Persistent<v8::Value, v8::CopyablePersistentTraits<v8::Value> > persistent(_isolate, context);
+
+#if 0
// instantiate the document function
- v8::Handle<v8::Function> docCtor = V8Document::getTmpl()->GetFunction();
- v8::Handle<v8::Object> docObj = docCtor->NewInstance();
+ v8::Local<v8::Function> docCtor = V8Document::getTmpl()->GetFunction();
+ v8::Local<v8::Object> docObj = docCtor->NewInstance();
V8Document::V8DocumentPrivate* privData = new V8Document::V8DocumentPrivate();
privData->nativeObj = new Document<std::string>(interpreter->getDocument());
@@ -200,169 +246,209 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(InterpreterInfo* interprete
context->Global()->Set(v8::String::New("DataView"), V8DataView::getConstructor()->GetFunction());
- context->Global()->SetAccessor(v8::String::New("_sessionid"),
- V8DataModel::getAttribute,
- V8DataModel::setWithException,
- v8::String::New(interpreter->getSessionId().c_str()));
- context->Global()->SetAccessor(v8::String::New("_name"),
- V8DataModel::getAttribute,
- V8DataModel::setWithException,
- v8::String::New(interpreter->getName().c_str()));
- context->Global()->SetAccessor(v8::String::New("_ioprocessors"),
- V8DataModel::getIOProcessors,
- V8DataModel::setWithException,
- v8::External::New(reinterpret_cast<void*>(dm.get())));
- context->Global()->SetAccessor(v8::String::New("_invokers"),
- V8DataModel::getInvokers,
- V8DataModel::setWithException,
- v8::External::New(reinterpret_cast<void*>(dm.get())));
-
- dm->_contexts.push_back(context);
// instantiate objects - we have to have a context for that!
dm->eval(Element<std::string>(), "_x = {};");
+#endif
return dm;
}
-v8::Handle<v8::Value> V8DataModel::getAttribute(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- return info.Data();
+void V8DataModel::getAttribute(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
+ info.GetReturnValue().Set(info.Data());
}
-void V8DataModel::setWithException(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+void V8DataModel::setWithException(v8::Local<v8::String> property,
+ v8::Local<v8::Value> value,
+ const v8::PropertyCallbackInfo<void>& info) {
v8::String::AsciiValue data(property);
std::string msg = "Cannot set " + std::string(*data);
v8::ThrowException(v8::Exception::ReferenceError(v8::String::New(msg.c_str())));
}
-v8::Handle<v8::Value> V8DataModel::getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- V8DataModel* dataModel = V8DOM::toClassPtr<V8DataModel>(info.Data());
+void V8DataModel::getIOProcessors(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
+ v8::Local<v8::External> field = v8::Local<v8::External>::Cast(info.Data());
+ V8DataModel* dataModel = (V8DataModel*)field->Value();
+
+ if (dataModel->_ioProcessors.IsEmpty()) {
- if (!dataModel->_ioProcessorsAreSet) {
- dataModel->_ioProcessors = v8::Persistent<v8::Object>::New(v8::Object::New());
- //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New();
- std::map<std::string, IOProcessor> ioProcessors = dataModel->_interpreter->getIOProcessors();
+ v8::Local<v8::Object> ioProcs = v8::Local<v8::Object>::New(v8::Isolate::GetCurrent(), v8::Object::New());
+ //v8::Local<v8::Object> ioProcessorObj = v8::Object::New();
+ std::map<std::string, IOProcessor> ioProcessors = dataModel->_callbacks->getIOProcessors();
std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcessors.begin();
while(ioProcIter != ioProcessors.end()) {
// std::cout << ioProcIter->first << std::endl;
- dataModel->_ioProcessors->Set(v8::String::New(ioProcIter->first.c_str()),
- dataModel->getDataAsValue(ioProcIter->second.getDataModelVariables()));
+ ioProcs->Set(v8::String::New(ioProcIter->first.c_str()),
+ dataModel->getDataAsValue(ioProcIter->second.getDataModelVariables()));
ioProcIter++;
}
- dataModel->_ioProcessorsAreSet = true;
+ dataModel->_ioProcessors.Reset(v8::Isolate::GetCurrent(), ioProcs);
}
- return dataModel->_ioProcessors;
+ info.GetReturnValue().Set(dataModel->_ioProcessors);
}
-v8::Handle<v8::Value> V8DataModel::getInvokers(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- V8DataModel* dataModel = V8DOM::toClassPtr<V8DataModel>(info.Data());
+void V8DataModel::getInvokers(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
+ v8::Local<v8::External> field = v8::Local<v8::External>::Cast(info.Data());
+ V8DataModel* dataModel = (V8DataModel*)field->Value();
- if (!dataModel->_invokersAreSet) {
- dataModel->_invokers = v8::Persistent<v8::Object>::New(v8::Object::New());
- //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New();
- std::map<std::string, Invoker> invokers = dataModel->_interpreter->getInvokers();
+ if (dataModel->_invokers.IsEmpty()) {
+ v8::Local<v8::Object> invoks = v8::Local<v8::Object>::New(v8::Isolate::GetCurrent(), v8::Object::New());
+ //v8::Local<v8::Object> ioProcessorObj = v8::Object::New();
+ std::map<std::string, Invoker> invokers = dataModel->_callbacks->getInvokers();
std::map<std::string, Invoker>::const_iterator invokerIter = invokers.begin();
while(invokerIter != invokers.end()) {
// std::cout << ioProcIter->first << std::endl;
- dataModel->_invokers->Set(v8::String::New(invokerIter->first.c_str()),
- dataModel->getDataAsValue(invokerIter->second.getDataModelVariables()));
+ invoks->Set(v8::String::New(invokerIter->first.c_str()),
+ dataModel->getDataAsValue(invokerIter->second.getDataModelVariables()));
invokerIter++;
}
- dataModel->_invokersAreSet = true;
+ dataModel->_invokers.Reset(v8::Isolate::GetCurrent(), invoks);
}
- return dataModel->_invokers;
+ info.GetReturnValue().Set(dataModel->_invokers);
}
-void V8DataModel::pushContext() {
- _contexts.push_back(_contexts.back().New(_contexts.back()));
-}
+void V8DataModel::setEvent(const Event& event) {
+
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
-void V8DataModel::popContext() {
- if (_contexts.size() > 1) {
- _contexts.back().Dispose();
- _contexts.pop_back();
+ v8::HandleScope scope(_isolate);
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+
+ v8::Local<v8::Object> global = ctx->Global();
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+ assert(_isolate->GetCurrentContext() == ctx); // only valid in context::scope
+
+
+#if 0
+ // this would work as swig_exports_ will get redefined per isolate
+ {
+ std::lock_guard<std::mutex> lock(_initMutex);
+ SWIGV8_INIT(context->Global());
}
-}
+#endif
-void V8DataModel::initialize() {
-}
+ Event* evPtr = new Event(event);
-void V8DataModel::setEvent(const 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::FunctionTemplate> classTmpl = v8::Local<v8::FunctionTemplate>::New(_isolate, V8SCXMLEvent::getTmpl());
+// v8::Local<v8::Object> eventObj = classTmpl->InstanceTemplate()->NewInstance();
+// eventObj->SetAlignedPointerInInternalField(0, (void*)evPtr);
+// assert(eventObj->GetAlignedPointerFromInternalField(0) == evPtr);
- v8::Handle<v8::Function> eventCtor = V8SCXMLEvent::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> eventObj = v8::Persistent<v8::Object>::New(eventCtor->NewInstance());
+ v8::Local<v8::Value> eventVal = SWIG_V8_NewPointerObj(evPtr, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN);
+ v8::Local<v8::Object> eventObj = v8::Local<v8::Object>::Cast(eventVal);
- V8SCXMLEvent::V8SCXMLEventPrivate* privData = new V8SCXMLEvent::V8SCXMLEventPrivate();
- privData->nativeObj = new Event(event);
- privData->dom = _dom;
- eventObj->SetInternalField(0, V8DOM::toExternal(privData));
- eventObj.MakeWeak(0, V8SCXMLEvent::jsDestructor);
+ /*
+ v8::Local<v8::Array> properties = eventObj->GetPropertyNames();
+ for (int i = 0; i < properties->Length(); i++) {
+ assert(properties->Get(i)->IsString());
+ v8::String::AsciiValue key(v8::Local<v8::String>::Cast(properties->Get(i)));
+ std::cout << *key << std::endl;
+ }
+ */
+
+ // test333
+ if (event.origintype.size() > 0) {
+ eventObj->Set(v8::String::NewSymbol("origintype"),v8::String::NewFromUtf8(_isolate, event.origintype.c_str()));
+ } else {
+ eventObj->Set(v8::String::NewSymbol("origintype"),v8::Undefined(_isolate));
+ }
+ // test335
+ if (event.origin.size() > 0) {
+ eventObj->Set(v8::String::NewSymbol("origin"),v8::String::NewFromUtf8(_isolate, event.origin.c_str()));
+ } else {
+ eventObj->Set(v8::String::NewSymbol("origin"),v8::Undefined(_isolate));
+ }
+ // test337
+ if (!event.hideSendId) {
+ eventObj->Set(v8::String::NewSymbol("sendid"),v8::String::NewFromUtf8(_isolate, event.sendid.c_str()));
+ } else {
+ eventObj->Set(v8::String::NewSymbol("sendid"),v8::Undefined(_isolate));
+ }
+ // test339
+ if (event.invokeid.size() > 0) {
+ eventObj->Set(v8::String::NewSymbol("invokeid"),v8::String::NewFromUtf8(_isolate, event.invokeid.c_str()));
+ } else {
+ eventObj->Set(v8::String::NewSymbol("invokeid"),v8::Undefined(_isolate));
+ }
- if (event.raw.size() == 0) {
- std::stringstream ssRaw;
- ssRaw << event;
- privData->nativeObj->raw = ssRaw.str();
+ // test 331
+ switch (event.eventType) {
+ case Event::EXTERNAL:
+ eventObj->Set(v8::String::NewSymbol("type"), v8::String::NewFromUtf8(_isolate, "external"));
+ break;
+ case Event::INTERNAL:
+ eventObj->Set(v8::String::NewSymbol("type"), v8::String::NewFromUtf8(_isolate, "internal"));
+ break;
+ case Event::PLATFORM:
+ eventObj->Set(v8::String::NewSymbol("type"), v8::String::NewFromUtf8(_isolate, "platform"));
+ break;
}
- if (event.dom) {
- eventObj->Set(v8::String::New("data"), getNodeAsValue(event.dom));
- } else if (event.content.length() > 0) {
- // _event.data is a string or JSON
- Data json = Data::fromJSON(event.content);
- if (!json.empty()) {
- eventObj->Set(v8::String::New("data"), getDataAsValue(json));
- } else {
- eventObj->Set(v8::String::New("data"), v8::String::New(spaceNormalize(event.content).c_str()));
- }
+ if (event.data.node) {
+ eventObj->Set(v8::String::NewSymbol("data"), getNodeAsValue(event.data.node));
} else {
// _event.data is KVP
- Event eventCopy(event);
- if (!eventCopy.params.empty()) {
- Event::params_t::iterator paramIter = eventCopy.params.begin();
- while(paramIter != eventCopy.params.end()) {
- eventCopy.data.compound[paramIter->first] = paramIter->second;
+ Data data = event.data;
+ if (!event.params.empty()) {
+ Event::params_t::const_iterator paramIter = event.params.begin();
+ while(paramIter != event.params.end()) {
+ data.compound[paramIter->first] = paramIter->second;
paramIter++;
}
}
- if (!eventCopy.namelist.empty()) {
- Event::namelist_t::iterator nameListIter = eventCopy.namelist.begin();
- while(nameListIter != eventCopy.namelist.end()) {
- eventCopy.data.compound[nameListIter->first] = nameListIter->second;
+ if (!event.namelist.empty()) {
+ Event::namelist_t::const_iterator nameListIter = event.namelist.begin();
+ while(nameListIter != event.namelist.end()) {
+ data.compound[nameListIter->first] = nameListIter->second;
nameListIter++;
}
}
- if (!eventCopy.data.empty()) {
+ if (!data.empty()) {
// std::cout << Data::toJSON(eventCopy.data);
- eventObj->Set(v8::String::New("data"), getDataAsValue(eventCopy.data)); // set data part of _event
+ eventObj->Set(v8::String::NewSymbol("data"), getDataAsValue(data)); // set data part of _event
} else {
// test 343 / test 488
- eventObj->Set(v8::String::New("data"), v8::Undefined()); // set data part of _event
+ eventObj->Set(v8::String::NewSymbol("data"), v8::Undefined()); // set data part of _event
}
}
// we cannot make _event v8::ReadOnly as it will ignore subsequent setEvents
- global->Set(v8::String::New("_event"), eventObj);
+ global->Set(v8::String::NewSymbol("_event"), eventObj);
+ _event.Reset(_isolate, eventObj);
}
-Data V8DataModel::getStringAsData(const std::string& content) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.front());
- v8::Handle<v8::Value> result = evalAsValue(content);
+Data V8DataModel::getAsData(const std::string& content) {
+ return Data::fromJSON(content);
+}
+
+Data V8DataModel::evalAsData(const std::string& content) {
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
+
+ v8::HandleScope scope(_isolate);
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
+ v8::Local<v8::Value> result = evalAsValue(content);
Data data = getValueAsData(result);
return data;
}
-Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value) {
+Data V8DataModel::getValueAsData(const v8::Local<v8::Value>& value) {
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
+ v8::HandleScope scope(_isolate);
+
std::set<v8::Value*> foo = std::set<v8::Value*>();
return getValueAsData(value, foo);
}
-Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value, std::set<v8::Value*>& alreadySeen) {
+Data V8DataModel::getValueAsData(const v8::Local<v8::Value>& value, std::set<v8::Value*>& alreadySeen) {
+
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
Data data;
/// TODO: Breaking cycles does not work yet
@@ -372,7 +458,7 @@ Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value, std::set<v8
if (false) {
} else if (value->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value);
+ v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value);
for (int i = 0; i < array->Length(); i++) {
data.array.push_back(getValueAsData(array->Get(i), alreadySeen));
}
@@ -396,33 +482,36 @@ Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value, std::set<v8
} else if (value->IsNull()) {
LOG(ERROR) << "IsNull is unimplemented" << std::endl;
} else if (value->IsNumber()) {
- v8::String::AsciiValue prop(v8::Handle<v8::String>::Cast(v8::Handle<v8::Number>::Cast(value)));
+ v8::String::AsciiValue prop(v8::Local<v8::String>::Cast(v8::Local<v8::Number>::Cast(value)));
data.atom = *prop;
} else if (value->IsNumberObject()) {
LOG(ERROR) << "IsNumberObject is unimplemented" << std::endl;
} else if (value->IsObject()) {
- if (V8ArrayBuffer::hasInstance(value)) {
- uscxml::V8ArrayBuffer::V8ArrayBufferPrivate* privObj = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(value->ToObject()->GetInternalField(0));
- data.binary = privObj->nativeObj->_blob;
- return data;
- }
- if (V8Node::hasInstance(value)) {
- uscxml::V8Node::V8NodePrivate* privObj = V8DOM::toClassPtr<V8Node::V8NodePrivate >(value->ToObject()->GetInternalField(0));
- data.node = *privObj->nativeObj;
+
+// if (V8ArrayBuffer::hasInstance(value)) {
+// uscxml::V8ArrayBuffer::V8ArrayBufferPrivate* privObj = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(value->ToObject()->GetInternalField(0));
+// data.binary = privObj->nativeObj->_blob;
+// return data;
+// }
+
+ v8::Local<v8::FunctionTemplate> tmpl = v8::Local<v8::FunctionTemplate>::New(_isolate, _exports_DOMNode_clientData.class_templ);
+ if (tmpl->HasInstance(value)) {
+ SWIG_V8_GetInstancePtr(value, (void**)&(data.node));
return data;
}
- v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
+
+ v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
v8::Local<v8::Array> properties = object->GetPropertyNames();
for (int i = 0; i < properties->Length(); i++) {
assert(properties->Get(i)->IsString());
- v8::String::AsciiValue key(v8::Handle<v8::String>::Cast(properties->Get(i)));
+ v8::String::AsciiValue key(v8::Local<v8::String>::Cast(properties->Get(i)));
v8::Local<v8::Value> property = object->Get(properties->Get(i));
data.compound[*key] = getValueAsData(property, alreadySeen);
}
} else if (value->IsRegExp()) {
LOG(ERROR) << "IsRegExp is unimplemented" << std::endl;
} else if(value->IsString()) {
- v8::String::AsciiValue property(v8::Handle<v8::String>::Cast(value));
+ v8::String::AsciiValue property(v8::Local<v8::String>::Cast(value));
data.atom = *property;
data.type = Data::VERBATIM;
} else if(value->IsStringObject()) {
@@ -433,45 +522,32 @@ Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value, std::set<v8
LOG(ERROR) << "IsUint32 is unimplemented" << std::endl;
} else if(value->IsUndefined()) {
data.atom = "undefined";
+ } else {
+ LOG(ERROR) << "Value's type is unknown!" << std::endl;
}
return data;
}
-v8::Handle<v8::Value> V8DataModel::getNodeAsValue(const Node<std::string>& node) {
-
- switch (node.getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- TO_V8_DOMVALUE(Element);
- }
- case Node_base::TEXT_NODE: {
- TO_V8_DOMVALUE(Text);
- }
- case Node_base::CDATA_SECTION_NODE: {
- TO_V8_DOMVALUE(CDATASection);
- }
- case Node_base::DOCUMENT_NODE: {
- TO_V8_DOMVALUE(Document);
- }
- default: {
- TO_V8_DOMVALUE(Node);
- }
- }
-
+v8::Local<v8::Value> V8DataModel::getNodeAsValue(const xercesc::DOMNode* node) {
+ return SWIG_NewPointerObj(SWIG_as_voidptr(node),
+ SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,
+ SWIG_as_voidptrptr(&node)),
+ 0);
}
-v8::Handle<v8::Value> V8DataModel::getDataAsValue(const Data& data) {
+v8::Local<v8::Value> V8DataModel::getDataAsValue(const Data& data) {
+
if (data.compound.size() > 0) {
- v8::Handle<v8::Object> value = v8::Object::New();
+ v8::Local<v8::Object> value = v8::Object::New();
std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin();
while(compoundIter != data.compound.end()) {
-// std::cout << compoundIter->first.c_str() << std::endl;
- value->Set(v8::String::New(compoundIter->first.c_str()), getDataAsValue(compoundIter->second));
+ value->Set(v8::String::NewSymbol(compoundIter->first.c_str()), getDataAsValue(compoundIter->second));
compoundIter++;
}
return value;
}
if (data.array.size() > 0) {
- v8::Handle<v8::Object> value = v8::Array::New();
+ v8::Local<v8::Object> value = v8::Array::New(_isolate, data.array.size());
std::list<Data>::const_iterator arrayIter = data.array.begin();
uint32_t index = 0;
while(arrayIter != data.array.end()) {
@@ -490,61 +566,55 @@ v8::Handle<v8::Value> V8DataModel::getDataAsValue(const Data& data) {
break;
}
}
- if (data.binary) {
- uscxml::ArrayBuffer* arrBuffer = new uscxml::ArrayBuffer(data.binary);
- v8::Handle<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate();
- retPrivData->nativeObj = arrBuffer;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor);
- return retObj;
- }
+ if (data.node) {
+ return getNodeAsValue(data.node);
+ }
+
+// if (data.binary) {
+// uscxml::ArrayBuffer* arrBuffer = new uscxml::ArrayBuffer(data.binary);
+// v8::Local<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction();
+// v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+//
+// struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate();
+// retPrivData->nativeObj = arrBuffer;
+// retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+//
+// retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor);
+// return retObj;
+// }
// this will never be reached
return v8::Undefined();
}
-v8::Handle<v8::Value> V8DataModel::jsPrint(const v8::Arguments& args) {
- if (args.Length() > 0) {
- v8::String::AsciiValue printMsg(args[0]->ToString());
+void V8DataModel::jsPrint(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ if (info.Length() > 0) {
+ v8::String::AsciiValue printMsg(info[0]->ToString());
std::cout << *printMsg;
}
- return v8::Undefined();
}
-v8::Handle<v8::Value> V8DataModel::jsIn(const v8::Arguments& args) {
- V8DataModel* INSTANCE = static_cast<V8DataModel*>(v8::External::Unwrap(args.Data()));
- for (unsigned int i = 0; i < args.Length(); i++) {
- if (args[i]->IsString()) {
- std::string stateName(*v8::String::AsciiValue(args[i]->ToString()));
- if (INSTANCE->_interpreter->isInState(stateName)) {
+void V8DataModel::jsIn(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ v8::Local<v8::External> field = v8::Local<v8::External>::Cast(info.Data());
+ V8DataModel* dataModel = (V8DataModel*)field->Value();
+
+ for (unsigned int i = 0; i < info.Length(); i++) {
+ if (info[i]->IsString()) {
+ std::string stateName(*v8::String::AsciiValue(info[i]->ToString()));
+ if (dataModel->_callbacks->isInState(stateName)) {
continue;
}
}
- return v8::Boolean::New(false);
+ info.GetReturnValue().Set(false);
+ return;
}
- return v8::Boolean::New(true);
-}
-
-bool V8DataModel::validate(const std::string& location, const std::string& schema) {
- return true;
-}
-
-bool V8DataModel::isLocation(const std::string& expr) {
- // location needs to be RHS and ++ is only valid for RHS
- return isValidSyntax(expr + "++");
+ info.GetReturnValue().Set(true);
}
bool V8DataModel::isValidSyntax(const std::string& expr) {
- v8::Locker locker;
- v8::HandleScope handleScope;
v8::TryCatch tryCatch;
- v8::Context::Scope contextScope(_contexts.back());
- v8::Handle<v8::String> source = v8::String::New(expr.c_str());
- v8::Handle<v8::Script> script = v8::Script::Compile(source);
+ v8::Local<v8::String> source = v8::String::New(expr.c_str());
+ v8::Local<v8::Script> script = v8::Script::Compile(source);
if (script.IsEmpty() || tryCatch.HasCaught()) {
return false;
@@ -554,19 +624,18 @@ bool V8DataModel::isValidSyntax(const std::string& expr) {
}
uint32_t V8DataModel::getLength(const std::string& expr) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::TryCatch tryCatch;
- v8::Context::Scope contextScope(_contexts.back());
- v8::Handle<v8::Value> result = evalAsValue(expr);
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
+ v8::HandleScope scope(_isolate);
+
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
+ v8::Local<v8::Value> result = evalAsValue(expr);
if (!result.IsEmpty() && result->IsArray())
return result.As<v8::Array>()->Length();
- Event exceptionEvent;
- exceptionEvent.name = "error.execution";
- exceptionEvent.data.compound["cause"] = Data("'" + expr + "' does not evaluate to an array.", Data::VERBATIM);
-
- throw(exceptionEvent);
+ ERROR_EXECUTION_THROW("'" + expr + "' does not evaluate to an array.")
}
void V8DataModel::setForeach(const std::string& item,
@@ -576,10 +645,20 @@ void V8DataModel::setForeach(const std::string& item,
if (!isDeclared(item)) {
assign(item, Data());
}
+
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
+ v8::HandleScope scope(_isolate);
+
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
// assign array element to item
std::stringstream ss;
- ss << array << "[" << iteration << "]";
- assign(item, Data(ss.str(), Data::INTERPRETED));
+ ss << item << " = " << array << "[" << iteration << "]";
+// assign(item, Data(ss.str(), Data::INTERPRETED));
+ // test152: we need "'continue' = array[index]" to throw
+ evalAsValue(ss.str());
if (index.length() > 0) {
// assign iteration element to index
std::stringstream ss;
@@ -588,29 +667,23 @@ void V8DataModel::setForeach(const std::string& item,
}
}
-void V8DataModel::eval(const Element<std::string>& scriptElem,
- const std::string& expr) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.back());
- evalAsValue(expr);
-}
-
bool V8DataModel::isDeclared(const std::string& expr) {
/**
* Undeclared variables can be checked by trying to access them and catching
* a reference error.
*/
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.back());
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
- v8::TryCatch tryCatch;
- v8::Handle<v8::String> source = v8::String::New(expr.c_str());
- v8::Handle<v8::Script> script = v8::Script::Compile(source);
+ v8::HandleScope scope(_isolate);
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
+ v8::Local<v8::String> source = v8::String::New(expr.c_str());
+ v8::Local<v8::Script> script = v8::Script::Compile(source);
- v8::Handle<v8::Value> result;
+ v8::Local<v8::Value> result;
if (!script.IsEmpty())
result = script->Run();
@@ -621,152 +694,62 @@ bool V8DataModel::isDeclared(const std::string& expr) {
}
bool V8DataModel::evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
-}
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
-bool V8DataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.back());
- v8::Handle<v8::Value> result = evalAsValue(expr);
+ v8::HandleScope scope(_isolate);
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
+ v8::Local<v8::Value> result = evalAsValue(expr);
return(result->ToBoolean()->BooleanValue());
}
-std::string V8DataModel::evalAsString(const std::string& expr) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.back());
- v8::Handle<v8::Value> result = evalAsValue(expr);
- if (result->IsObject()) {
- v8::Local<v8::Object> obj = result->ToObject();
- v8::Local<v8::Object> proto;
-
- proto = obj->FindInstanceInPrototypeChain(V8Document::getTmpl());
- if (!proto.IsEmpty()) {
- struct V8Document::V8DocumentPrivate* privData =
- V8DOM::toClassPtr<V8Document::V8DocumentPrivate >(obj->GetInternalField(0));
- std::stringstream ss;
- ss << privData->nativeObj->getDocumentElement();
- return ss.str();
- }
-
- proto = obj->FindInstanceInPrototypeChain(V8Node::getTmpl());
- if (!proto.IsEmpty()) {
- struct V8Node::V8NodePrivate* privData =
- V8DOM::toClassPtr<V8Node::V8NodePrivate >(obj->GetInternalField(0));
- std::stringstream ss;
- ss << privData->nativeObj;
- return ss.str();
- }
- Data data = getValueAsData(result);
- return toStr(data);
- }
- if (result->IsNumber()) {
- return toStr(result->ToNumber()->NumberValue());
- }
- v8::String::AsciiValue data(result->ToString());
- return std::string(*data);
-}
+void V8DataModel::assign(const std::string& location, const Data& data) {
-double V8DataModel::evalAsNumber(const std::string& expr) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.back());
- v8::Handle<v8::Value> result = evalAsValue(expr);
- if (result->IsNumber()) {
- return result->ToNumber()->NumberValue();
- }
- return 0;
-}
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
+ v8::HandleScope scope(_isolate);
-void V8DataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.front());
- v8::Handle<v8::Object> global = _contexts.front()->Global();
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Local<v8::Object> global = ctx->Global();
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
- std::string key;
- if (HAS_ATTR(assignElem, "id")) {
- key = ATTR(assignElem, "id");
- } else if (HAS_ATTR(assignElem, "location")) {
- key = ATTR(assignElem, "location");
- }
- if (key.length() == 0)
- throw Event("error.execution", Event::PLATFORM);
-
- if (key.compare("_sessionid") == 0) // test 322
+ if (location.compare("_sessionid") == 0) // test 322
ERROR_EXECUTION_THROW("Cannot assign to _sessionId");
- if (key.compare("_name") == 0)
+ if (location.compare("_name") == 0)
ERROR_EXECUTION_THROW("Cannot assign to _name");
- if (key.compare("_ioprocessors") == 0) // test 326
+ if (location.compare("_ioprocessors") == 0) // test 326
ERROR_EXECUTION_THROW("Cannot assign to _ioprocessors");
- if (key.compare("_invokers") == 0)
+ if (location.compare("_invokers") == 0)
ERROR_EXECUTION_THROW("Cannot assign to _invokers");
- if (key.compare("_event") == 0)
+ if (location.compare("_event") == 0)
ERROR_EXECUTION_THROW("Cannot assign to _event");
- if (HAS_ATTR(assignElem, "expr")) {
- evalAsValue(key + " = " + ATTR(assignElem, "expr"));
- } else if (node) {
- global->Set(v8::String::New(key.c_str()), getNodeAsValue(node));
- } else if (content.size() > 0) {
- try {
- evalAsValue(key + " = " + content);
- } catch (...) {
- evalAsValue(key + " = " + "\"" + spaceNormalize(content) + "\"");
- }
+ if (data.node) {
+ global->Set(v8::String::NewSymbol(location.c_str()), getNodeAsValue(data.node));
} else {
- global->Set(v8::String::New(key.c_str()), v8::Undefined());
+ evalAsValue(location + " = " + Data::toJSON(data));
}
}
-void V8DataModel::assign(const std::string& location,
- const Data& data) {
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.front());
-
- std::stringstream ssJSON;
- ssJSON << data;
- evalAsValue(location + " = " + ssJSON.str());
-}
-
-void V8DataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& doc,
- const std::string& content) {
- try {
- assign(dataElem, doc, content);
- } catch (Event e) {
- // test 277
- std::string key;
- if (HAS_ATTR(dataElem, "id")) {
- key = ATTR(dataElem, "id");
- } else if (HAS_ATTR(dataElem, "location")) {
- key = ATTR(dataElem, "location");
- }
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.front());
-
- evalAsValue(key + " = undefined", true);
- throw e;
- }
-};
-
void V8DataModel::init(const std::string& location,
const Data& data) {
+ v8::Locker locker(_isolate);
+ v8::Isolate::Scope isoScope(_isolate);
+ v8::HandleScope scope(_isolate);
+
+ v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+ v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
try {
assign(location, data);
- } catch (Event e) {
+ } catch (ErrorEvent e) {
// test 277
- v8::Locker locker;
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(_contexts.front());
-
evalAsValue(location + " = undefined", true);
+
+ // we need to get error.execution into the queue
throw e;
}
}
@@ -791,12 +774,22 @@ std::string V8DataModel::andExpressions(std::list<std::string> expressions) {
return exprSS.str();
}
-v8::Handle<v8::Value> V8DataModel::evalAsValue(const std::string& expr, bool dontThrow) {
+v8::Local<v8::Value> V8DataModel::evalAsValue(const std::string& expr, bool dontThrow) {
+
+// v8::Locker locker(_isolate);
+// v8::Isolate::Scope isoScope(_isolate);
+//
+// v8::HandleScope scope(_isolate);
+// v8::EscapableHandleScope escape(_isolate);
+// v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context);
+// v8::Context::Scope contextScope(ctx); // segfaults at newinstance without!
+
v8::TryCatch tryCatch;
- v8::Handle<v8::String> source = v8::String::New(expr.c_str());
- v8::Handle<v8::Script> script = v8::Script::Compile(source);
- v8::Handle<v8::Value> result;
+ v8::Local<v8::String> source = v8::String::New(expr.c_str());
+ v8::Local<v8::Script> script = v8::Script::Compile(source);
+
+ v8::Local<v8::Value> result;
if (!script.IsEmpty())
result = script->Run();
@@ -811,14 +804,14 @@ v8::Handle<v8::Value> V8DataModel::evalAsValue(const std::string& expr, bool don
void V8DataModel::throwExceptionEvent(const v8::TryCatch& tryCatch) {
assert(tryCatch.HasCaught());
- Event exceptionEvent;
+ ErrorEvent exceptionEvent;
exceptionEvent.name = "error.execution";
exceptionEvent.eventType = Event::PLATFORM;
std::string exceptionString(*v8::String::AsciiValue(tryCatch.Exception()));
exceptionEvent.data.compound["cause"] = Data(exceptionString, Data::VERBATIM);;
- v8::Handle<v8::Message> message = tryCatch.Message();
+ v8::Local<v8::Message> message = tryCatch.Message();
if (!message.IsEmpty()) {
std::string filename(*v8::String::AsciiValue(message->GetScriptResourceName()));
exceptionEvent.data.compound["filename"] = Data(filename, Data::VERBATIM);
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
index 8e665b7..29b2b58 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
@@ -20,10 +20,10 @@
#ifndef V8DATAMODEL_H_KN8TWG0V
#define V8DATAMODEL_H_KN8TWG0V
-#include "uscxml/InterpreterInfo.h"
+#include "uscxml/plugins/DataModel.h"
#include <list>
+#include <set>
#include <v8.h>
-#include "V8DOM.h"
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
@@ -32,7 +32,6 @@
namespace uscxml {
class Event;
class Data;
-class V8SCXMLDOM;
}
namespace uscxml {
@@ -41,7 +40,9 @@ class V8DataModel : public DataModelImpl {
public:
V8DataModel();
virtual ~V8DataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
+ virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* callbacks);
+
+ virtual void addExtension(DataModelExtension* ext);
virtual std::list<std::string> getNames() {
std::list<std::string> names;
@@ -49,79 +50,61 @@ public:
return names;
}
- virtual void initialize();
- virtual void setEvent(const Event& event);
-
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
virtual bool isValidSyntax(const std::string& expr);
+ virtual void setEvent(const Event& event);
+
+ // foreach
virtual uint32_t getLength(const std::string& expr);
virtual void setForeach(const std::string& item,
const std::string& array,
const std::string& index,
uint32_t iteration);
- virtual void pushContext();
- virtual void popContext();
-
- virtual bool supportsJSON() {
- return true;
- }
-
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void assign(const std::string& location,
- const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void init(const std::string& location,
- const Data& data);
-
- virtual std::string andExpressions(std::list<std::string>);
- virtual Data getStringAsData(const std::string& content);
- virtual Data getValueAsData(const v8::Handle<v8::Value>& value,
- std::set<v8::Value*>& alreadySeen);
- virtual Data getValueAsData(const v8::Handle<v8::Value>& value);
+ virtual bool evalAsBool(const std::string& expr);
+ virtual Data evalAsData(const std::string& expr);
+ virtual Data getAsData(const std::string& content);
virtual bool isDeclared(const std::string& expr);
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
- virtual bool evalAsBool(const std::string& expr);
- virtual double evalAsNumber(const std::string& expr);
-
- virtual void addExtension(DataModelExtension* ext);
+ virtual void assign(const std::string& location, const Data& data);
+ virtual void init(const std::string& location, const Data& data);
- static v8::Handle<v8::Value> jsExtension(const v8::Arguments& args);
- static v8::Handle<v8::Value> jsIn(const v8::Arguments& args);
- static v8::Handle<v8::Value> jsPrint(const v8::Arguments& args);
+ virtual std::string andExpressions(std::list<std::string>);
protected:
- std::list<v8::Persistent<v8::Context> > _contexts;
- Arabica::DOM::V8DOM* _dom;
+ static void jsExtension(const v8::FunctionCallbackInfo<v8::Value>& info);
+ static void jsIn(const v8::FunctionCallbackInfo<v8::Value>& info);
+ static void jsPrint(const v8::FunctionCallbackInfo<v8::Value>& info);
+
+ v8::Persistent<v8::Object> _event;
+ v8::Persistent<v8::Context> _context;
+ static v8::Isolate* _isolate;
- bool _ioProcessorsAreSet;
- bool _invokersAreSet;
v8::Persistent<v8::Object> _ioProcessors;
v8::Persistent<v8::Object> _invokers;
- static v8::Handle<v8::Value> getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> getInvokers(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> getAttribute(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void setWithException(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
-
- v8::Handle<v8::Value> evalAsValue(const std::string& expr, bool dontThrow = false);
- v8::Handle<v8::Value> getDataAsValue(const Data& data);
- v8::Handle<v8::Value> getNodeAsValue(const Arabica::DOM::Node<std::string>& node);
+
+ static void getIOProcessors(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);
+ static void getInvokers(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);
+ static void getAttribute(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);
+ static void setWithException(v8::Local<v8::String> property,
+ v8::Local<v8::Value> value,
+ const v8::PropertyCallbackInfo<void>& info);
+
+ v8::Local<v8::Value> evalAsValue(const std::string& expr, bool dontThrow = false);
+ v8::Local<v8::Value> getDataAsValue(const Data& data);
+ Data getValueAsData(const v8::Local<v8::Value>& value);
+ v8::Local<v8::Value> getNodeAsValue(const xercesc::DOMNode* node);
void throwExceptionEvent(const v8::TryCatch& tryCatch);
std::set<DataModelExtension*> _extensions;
+
+private:
+ Data getValueAsData(const v8::Local<v8::Value>& value, std::set<v8::Value*>& alreadySeen);
+
+ static std::mutex _initMutex;
+
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/bindings.i b/src/uscxml/plugins/datamodel/ecmascript/v8/bindings.i
new file mode 100644
index 0000000..560671f
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/bindings.i
@@ -0,0 +1,45 @@
+#define XERCES_HAS_CPP_NAMESPACE 1
+
+%include <std_string.i>
+
+/*
+
+swig -I/Users/sradomski/Documents/TK/Code/uscxml2/build/cli/deps/xerces-c/include/ -javascript -jsc -c++ uscxml.i
+gcc -I/Users/sradomski/Documents/TK/Code/uscxml2/build/cli/deps/xerces-c/include/ ./uscxml_wrap.cxx
+
+*/
+
+%module V8DOM
+
+%import "uscxml/config.h"
+%import "uscxml/Common.h"
+
+%import "xercesc/util/XercesDefs.hpp"
+%import "xercesc/util/Xerces_autoconf_config.hpp"
+
+%include "../../common/bindings/dom/ignore.i"
+%include "../../common/bindings/dom/defines.i"
+%include "../../common/bindings/dom/typemaps-general.i"
+
+// in typemap
+%typemap(in) XMLCh * %{
+ $1 = JS2XMLString($input);
+%}
+
+%typemap(freearg) XMLCh * %{
+ delete[] $1;
+%}
+
+// out typemap
+%typemap(out) XMLCh * %{
+ $result = XMLString2JS($1);
+%}
+
+%include "../../common/bindings/dom/dom.i"
+
+// Operators we do want
+// %rename(operator_assignment) operator=;
+%rename(operator_equal_to) operator==;
+%rename(operator_not_equal_to) operator!=;
+
+%include "../../common/bindings/event.i"
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp
deleted file mode 100644
index 1328b19..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8ArrayBuffer::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8ArrayBuffer::Constr;
-
-v8::Handle<v8::Value> V8ArrayBuffer::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::ArrayBuffer* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::ArrayBuffer(localLength);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for ArrayBuffer");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8ArrayBuffer::byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getByteLength());
-}
-
-v8::Handle<v8::Value> V8ArrayBuffer::mimeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
-
- return v8::String::New(privData->nativeObj->getMimeType().c_str());
-}
-
-void V8ArrayBuffer::mimeTypeAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localMimeType(value);
- privData->nativeObj->setMimeType(*localMimeType);
-}
-
-v8::Handle<v8::Value> V8ArrayBuffer::md5Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 0) {
-
- std::string retVal = privData->nativeObj->md5();
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling md5");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8ArrayBuffer::base64Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 0) {
-
- std::string retVal = privData->nativeObj->base64();
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling base64");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8ArrayBuffer::sliceCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localBegin = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin, localEnd));
- v8::Handle<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localBegin = args[0]->ToNumber()->Int32Value();
-
- uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin));
- v8::Handle<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling slice");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8ArrayBuffer::isViewCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ArrayBufferPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- true) {
- void* localValue = v8::External::Unwrap(args[0]->ToObject()->GetInternalField(0));
-
- bool retVal = privData->nativeObj->isView(localValue);
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling isView");
- return v8::Undefined();
-}
-bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h
deleted file mode 100644
index 14b92b0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBuffer.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8ArrayBuffer_h
-#define V8ArrayBuffer_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8ArrayBuffer {
-public:
- struct V8ArrayBufferPrivate {
- V8DOM* dom;
- uscxml::ArrayBuffer* nativeObj;
- };
-
- V8_DESTRUCTOR(V8ArrayBufferPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> md5Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> base64Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> sliceCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> isViewCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> mimeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void mimeTypeAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("ArrayBuffer"));
- 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("byteLength"), V8ArrayBuffer::byteLengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("mimeType"), V8ArrayBuffer::mimeTypeAttrGetter, V8ArrayBuffer::mimeTypeAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("md5"),
- v8::FunctionTemplate::New(V8ArrayBuffer::md5Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("base64"),
- v8::FunctionTemplate::New(V8ArrayBuffer::base64Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("slice"),
- v8::FunctionTemplate::New(V8ArrayBuffer::sliceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isView"),
- v8::FunctionTemplate::New(V8ArrayBuffer::isViewCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8ArrayBuffer_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp
deleted file mode 100644
index 60a2530..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8ArrayBufferView::Tmpl;
-
-v8::Handle<v8::Value> V8ArrayBufferView::bufferAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ArrayBufferViewPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferViewPrivate >(self->GetInternalField(0));
-
- if (!privData->nativeObj->getBuffer()) return v8::Undefined();
- uscxml::ArrayBuffer* arbaicaRet = new uscxml::ArrayBuffer(privData->nativeObj->getBuffer());
-
- v8::Handle<v8::Function> arbaicaRetCtor = V8ArrayBuffer::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-
- struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8ArrayBuffer::jsDestructor);
- return arbaicaRetObj;
-
-}
-
-v8::Handle<v8::Value> V8ArrayBufferView::byteOffsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ArrayBufferViewPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferViewPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getByteOffset());
-}
-
-v8::Handle<v8::Value> V8ArrayBufferView::byteLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ArrayBufferViewPrivate* privData = V8DOM::toClassPtr<V8ArrayBufferViewPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getByteLength());
-}
-bool V8ArrayBufferView::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h
deleted file mode 100644
index 8ed542f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ArrayBufferView.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8ArrayBufferView_h
-#define V8ArrayBufferView_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8ArrayBufferView {
-public:
- struct V8ArrayBufferViewPrivate {
- V8DOM* dom;
- uscxml::ArrayBufferView* nativeObj;
- };
-
- V8_DESTRUCTOR(V8ArrayBufferViewPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> bufferAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> byteOffsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> byteLengthAttrGetter(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("ArrayBufferView"));
- 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("buffer"), V8ArrayBufferView::bufferAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("byteOffset"), V8ArrayBufferView::byteOffsetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("byteLength"), V8ArrayBufferView::byteLengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8ArrayBufferView_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
deleted file mode 100644
index 9480cb6..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Attr.h"
-#include "V8Element.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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));
-
- 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);
-}
-
-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());
-
- 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;
-
- 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);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
deleted file mode 100644
index ca0c58b..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Attr_h
-#define V8Attr_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Attr_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
deleted file mode 100644
index 2d833fe..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8CDATASection.h"
-#include "V8Text.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
-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
deleted file mode 100644
index b7d2a2e..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8CDATASection_h
-#define V8CDATASection_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Text.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8CDATASection {
-public:
- struct V8CDATASectionPrivate {
- V8DOM* dom;
- Arabica::DOM::CDATASection<std::string>* nativeObj;
- };
-
- 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();
-
- 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8CDATASection_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
deleted file mode 100644
index 217d035..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8CharacterData.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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);
-}
-
-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) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
-
- std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling substringData");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localArg(args[0]);
-
- privData->nativeObj->appendData(*localArg);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling appendData");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsString()) {
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[1]);
-
- privData->nativeObj->insertData(localOffset, *localArg);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling insertData");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->deleteData(localOffset, localCount);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling deleteData");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32() &&
- args[2]->IsString()) {
- 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);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling replaceData");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index bf21603..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8CharacterData_h
-#define V8CharacterData_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8CharacterData_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
deleted file mode 100644
index 9c7e0a7..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8CharacterData.h"
-#include "V8Comment.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
-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
deleted file mode 100644
index e0ed9a7..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Comment_h
-#define V8Comment_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8CharacterData.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Comment {
-public:
- struct V8CommentPrivate {
- V8DOM* dom;
- Arabica::DOM::Comment<std::string>* nativeObj;
- };
-
- 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();
-
- 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Comment_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
deleted file mode 100644
index a9c3838..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8DOMImplementation.h"
-#include "V8Document.h"
-#include "V8DocumentType.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
-
-v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
-
- bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling hasFeature");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsString() &&
- args[1]->IsString() &&
- args[2]->IsString()) {
- 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());
-
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createDocumentType");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsString() &&
- args[1]->IsString() &&
- args[2]->IsObject() && V8DocumentType::hasInstance(args[2])) {
- 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());
-
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Document::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createDocument");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 5627a19..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8DOMImplementation_h
-#define V8DOMImplementation_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8DOMImplementation {
-public:
- struct V8DOMImplementationPrivate {
- V8DOM* dom;
- Arabica::DOM::DOMImplementation<std::string>* nativeObj;
- };
-
- 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::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();
- (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));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8DOMImplementation_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp
deleted file mode 100644
index 1eaca4f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.cpp
+++ /dev/null
@@ -1,490 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8DataView.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8DataView::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8DataView::Constr;
-
-v8::Handle<v8::Value> V8DataView::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::DataView* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localByteLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::DataView(localBuffer, localByteOffset, localByteLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::DataView(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::DataView(localBuffer);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for DataView");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8DataView::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8DataView::V8DataViewPrivate* retPrivData = new V8DataView::V8DataViewPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8DataView::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8DataView::getInt8Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- char retVal = privData->nativeObj->getInt8(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getInt8");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getUint8Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- unsigned char retVal = privData->nativeObj->getUint8(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getUint8");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getInt16Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[1]->ToBoolean()->BooleanValue();
-
- short retVal = privData->nativeObj->getInt16(localByteOffset, localLittleEndian);
-
- return v8::Number::New(retVal);
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- short retVal = privData->nativeObj->getInt16(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getInt16");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getUint16Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[1]->ToBoolean()->BooleanValue();
-
- unsigned short retVal = privData->nativeObj->getUint16(localByteOffset, localLittleEndian);
-
- return v8::Number::New(retVal);
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- unsigned short retVal = privData->nativeObj->getUint16(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getUint16");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getInt32Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[1]->ToBoolean()->BooleanValue();
-
- long retVal = privData->nativeObj->getInt32(localByteOffset, localLittleEndian);
-
- return v8::Number::New(retVal);
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- long retVal = privData->nativeObj->getInt32(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getInt32");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getUint32Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[1]->ToBoolean()->BooleanValue();
-
- unsigned long retVal = privData->nativeObj->getUint32(localByteOffset, localLittleEndian);
-
- return v8::Number::New(retVal);
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- unsigned long retVal = privData->nativeObj->getUint32(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getUint32");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getFloat32Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[1]->ToBoolean()->BooleanValue();
-
- float retVal = privData->nativeObj->getFloat32(localByteOffset, localLittleEndian);
-
- return v8::Number::New(retVal);
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- float retVal = privData->nativeObj->getFloat32(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getFloat32");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::getFloat64Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[1]->ToBoolean()->BooleanValue();
-
- double retVal = privData->nativeObj->getFloat64(localByteOffset, localLittleEndian);
-
- return v8::Number::New(retVal);
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
-
- double retVal = privData->nativeObj->getFloat64(localByteOffset);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling getFloat64");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setInt8Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- char localValue = args[1]->ToNumber()->Int32Value();
-
- privData->nativeObj->setInt8(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setInt8");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- unsigned char localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->setUint8(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setUint8");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setInt16Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32() &&
- args[2]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- short localValue = args[1]->ToNumber()->Int32Value();
- bool localLittleEndian = args[2]->ToBoolean()->BooleanValue();
-
- privData->nativeObj->setInt16(localByteOffset, localValue, localLittleEndian);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- short localValue = args[1]->ToNumber()->Int32Value();
-
- privData->nativeObj->setInt16(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setInt16");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setUint16Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32() &&
- args[2]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- unsigned short localValue = args[1]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[2]->ToBoolean()->BooleanValue();
-
- privData->nativeObj->setUint16(localByteOffset, localValue, localLittleEndian);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- unsigned short localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->setUint16(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setUint16");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setInt32Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32() &&
- args[2]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- long localValue = args[1]->ToNumber()->Int32Value();
- bool localLittleEndian = args[2]->ToBoolean()->BooleanValue();
-
- privData->nativeObj->setInt32(localByteOffset, localValue, localLittleEndian);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- long localValue = args[1]->ToNumber()->Int32Value();
-
- privData->nativeObj->setInt32(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setInt32");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setUint32Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32() &&
- args[2]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localValue = args[1]->ToNumber()->Uint32Value();
- bool localLittleEndian = args[2]->ToBoolean()->BooleanValue();
-
- privData->nativeObj->setUint32(localByteOffset, localValue, localLittleEndian);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->setUint32(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setUint32");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setFloat32Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsNumber() &&
- args[2]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- float localValue = args[1]->ToNumber()->Value();
- bool localLittleEndian = args[2]->ToBoolean()->BooleanValue();
-
- privData->nativeObj->setFloat32(localByteOffset, localValue, localLittleEndian);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsNumber()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- float localValue = args[1]->ToNumber()->Value();
-
- privData->nativeObj->setFloat32(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setFloat32");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8DataView::setFloat64Callback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DataViewPrivate* privData = V8DOM::toClassPtr<V8DataViewPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsUint32() &&
- args[1]->IsNumber() &&
- args[2]->IsBoolean()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- double localValue = args[1]->ToNumber()->Value();
- bool localLittleEndian = args[2]->ToBoolean()->BooleanValue();
-
- privData->nativeObj->setFloat64(localByteOffset, localValue, localLittleEndian);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsNumber()) {
- unsigned long localByteOffset = args[0]->ToNumber()->Uint32Value();
- double localValue = args[1]->ToNumber()->Value();
-
- privData->nativeObj->setFloat64(localByteOffset, localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setFloat64");
- return v8::Undefined();
-}
-bool V8DataView::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h
deleted file mode 100644
index aa19473..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DataView.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8DataView_h
-#define V8DataView_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8DataView {
-public:
- struct V8DataViewPrivate {
- V8DOM* dom;
- uscxml::DataView* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DataViewPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getInt8Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getUint8Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getInt16Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getUint16Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getInt32Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getUint32Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getFloat32Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> getFloat64Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setInt8Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setUint8Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setInt16Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setUint16Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setInt32Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setUint32Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setFloat32Callback(const v8::Arguments&);
- static v8::Handle<v8::Value> setFloat64Callback(const v8::Arguments&);
-
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("DataView"));
- tmpl->ReadOnlyPrototype();
-
- 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("getInt8"),
- v8::FunctionTemplate::New(V8DataView::getInt8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getUint8"),
- v8::FunctionTemplate::New(V8DataView::getUint8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getInt16"),
- v8::FunctionTemplate::New(V8DataView::getInt16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getUint16"),
- v8::FunctionTemplate::New(V8DataView::getUint16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getInt32"),
- v8::FunctionTemplate::New(V8DataView::getInt32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getUint32"),
- v8::FunctionTemplate::New(V8DataView::getUint32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getFloat32"),
- v8::FunctionTemplate::New(V8DataView::getFloat32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getFloat64"),
- v8::FunctionTemplate::New(V8DataView::getFloat64Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setInt8"),
- v8::FunctionTemplate::New(V8DataView::setInt8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setUint8"),
- v8::FunctionTemplate::New(V8DataView::setUint8Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setInt16"),
- v8::FunctionTemplate::New(V8DataView::setInt16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setUint16"),
- v8::FunctionTemplate::New(V8DataView::setUint16Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setInt32"),
- v8::FunctionTemplate::New(V8DataView::setInt32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setUint32"),
- v8::FunctionTemplate::New(V8DataView::setUint32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setFloat32"),
- v8::FunctionTemplate::New(V8DataView::setFloat32Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setFloat64"),
- v8::FunctionTemplate::New(V8DataView::setFloat64Callback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8DataView_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
deleted file mode 100644
index 226cd26..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
+++ /dev/null
@@ -1,431 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Attr.h"
-#include "V8CDATASection.h"
-#include "V8Comment.h"
-#include "V8DOMImplementation.h"
-#include "V8Document.h"
-#include "V8DocumentFragment.h"
-#include "V8DocumentType.h"
-#include "V8Element.h"
-#include "V8EntityReference.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8ProcessingInstruction.h"
-#include "V8Text.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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());
-
- 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;
-
-}
-
-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());
-
- 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;
-
-}
-
-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::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;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
-
-}
-
-v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localTagName(args[0]);
-
- 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());
-
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createElement");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 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());
-
- struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createDocumentFragment");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createTextNode");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Comment::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createComment");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8CDATASection::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createCDATASection");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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());
-
- struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createProcessingInstruction");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createAttribute");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8EntityReference::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createEntityReference");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getElementsByTagName");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Node::hasInstance(args[0]) &&
- args[1]->IsBoolean()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling importNode");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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());
-
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getElementsByTagNameNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getElementById");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 373d18a..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Document_h
-#define V8Document_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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> createElementNSCustomCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeNSCustomCallback(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::Handle<v8::Value> localStorageCustomAttrGetter(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));
- instance->SetAccessor(v8::String::NewSymbol("localStorage"), V8Document::localStorageCustomAttrGetter, 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::createElementNSCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttributeNS"),
- v8::FunctionTemplate::New(V8Document::createAttributeNSCustomCallback, 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Document_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
deleted file mode 100644
index f9882f0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Document.h"
-#include "V8XPathResult.h"
-#include "V8Storage.h"
-#include "V8Attr.h"
-#include "V8Element.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8Document::localStorageCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-
- v8::Handle<v8::Function> retCtor = V8Storage::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- V8Storage::V8StoragePrivate* retPrivData = new V8Storage::V8StoragePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = privData->dom->storage;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8XPathResult::jsDestructor);
- return retObj;
-
-}
-
-
-v8::Handle<v8::Value> V8Document::evaluateCustomCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in evaluate");
-// if (!((V8Node::hasInstance(args[1])) && (V8XPathResult::hasInstance(args[3]))))
-// throw V8Exception("Parameter mismatch while calling evaluate");
-
- v8::Local<v8::Object> self = args.Holder();
- V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-
- v8::String::AsciiValue localExpression(args[0]);
-
- XPath::XPathValue<std::string>* retVal;
- try {
- if (args.Length() > 1) {
- V8Node::V8NodePrivate* otherNodePrivate = V8DOM::toClassPtr<V8Node::V8NodePrivate>(args[1]->ToObject()->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localContextNode = otherNodePrivate->nativeObj;
- retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *localContextNode));
- } else {
- retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *privData->nativeObj));
- }
- } catch (std::runtime_error e) {
- std::cout << e.what() << std::endl;
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8XPathResult::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- V8XPathResult::V8XPathResultPrivate* retPrivData = new V8XPathResult::V8XPathResultPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8XPathResult::jsDestructor);
- return retObj;
-
-}
-
-v8::Handle<v8::Value> V8Document::createElementNSCustomCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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));
- if (privData->dom->nsInfo->nsToPrefix.find(*localNamespaceURI) != privData->dom->nsInfo->nsToPrefix.end())
- retVal->setPrefix(privData->dom->nsInfo->nsToPrefix[*localNamespaceURI]);
-
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createElementNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Document::createAttributeNSCustomCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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));
- if (privData->dom->nsInfo->nsToPrefix.find(*localNamespaceURI) != privData->dom->nsInfo->nsToPrefix.end())
- retVal->setPrefix(privData->dom->nsInfo->nsToPrefix[*localNamespaceURI]);
-
- 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;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling createAttributeNS");
- return v8::Undefined();
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
deleted file mode 100644
index 359f6e5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8DocumentFragment.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
-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
deleted file mode 100644
index 89d19d3..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8DocumentFragment_h
-#define V8DocumentFragment_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8DocumentFragment {
-public:
- struct V8DocumentFragmentPrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentFragment<std::string>* nativeObj;
- };
-
- 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();
-
- 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8DocumentFragment_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
deleted file mode 100644
index a8839a4..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8DocumentType.h"
-#include "V8NamedNodeMap.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
-
- 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());
-
- 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::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;
-
-}
-
-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));
-
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
-
-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
deleted file mode 100644
index 9aec676..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8DocumentType_h
-#define V8DocumentType_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8DocumentType_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
deleted file mode 100644
index 15d4c94..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Attr.h"
-#include "V8Element.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- return v8::String::New(privData->nativeObj->getTagName().c_str());
-}
-
-v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localName(args[0]);
-
- std::string retVal = privData->nativeObj->getAttribute(*localName);
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling getAttribute");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localName(args[0]);
- v8::String::AsciiValue localValue(args[1]);
-
- privData->nativeObj->setAttribute(*localName, *localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setAttribute");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localName(args[0]);
-
- privData->nativeObj->removeAttribute(*localName);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling removeAttribute");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getAttributeNode");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Attr::hasInstance(args[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());
-
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling setAttributeNode");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Attr::hasInstance(args[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());
-
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling removeAttributeNode");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getElementsByTagName");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
-
- std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling getAttributeNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsString() &&
- args[1]->IsString() &&
- args[2]->IsString()) {
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- v8::String::AsciiValue localValue(args[2]);
-
- privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setAttributeNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
-
- privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling removeAttributeNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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());
-
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getAttributeNodeNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Attr::hasInstance(args[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());
-
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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());
-
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling getElementsByTagNameNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localName(args[0]);
-
- bool retVal = privData->nativeObj->hasAttribute(*localName);
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling hasAttribute");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
-
- bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling hasAttributeNS");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index ec87070..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Element_h
-#define V8Element_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Element_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
deleted file mode 100644
index e26bdb6..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Entity.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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));
-
- 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
deleted file mode 100644
index f6947b0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Entity_h
-#define V8Entity_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Entity_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
deleted file mode 100644
index eb12655..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8EntityReference.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
-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
deleted file mode 100644
index 47b4430..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8EntityReference_h
-#define V8EntityReference_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8EntityReference {
-public:
- struct V8EntityReferencePrivate {
- V8DOM* dom;
- Arabica::DOM::EntityReference<std::string>* nativeObj;
- };
-
- 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();
-
- 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8EntityReference_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp
deleted file mode 100644
index e49c2dc..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Float32Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Float32Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Float32Array::Constr;
-
-v8::Handle<v8::Value> V8Float32Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Float32Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Float32Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Float32Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Float32Array::hasInstance(args[0])) {
-
- uscxml::Float32Array* localArray = V8DOM::toClassPtr<V8Float32Array::V8Float32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Float32Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Float32Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Float32Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<float> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToNumber()->Value());
- }
- localInstance = new uscxml::Float32Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Float32Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Float32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Float32Array::V8Float32ArrayPrivate* retPrivData = new V8Float32Array::V8Float32ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Float32Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Float32Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Float32Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- float retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Float32Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Float32Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Float32Array* localArray = V8DOM::toClassPtr<V8Float32Array::V8Float32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsNumber()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- float localValue = args[1]->ToNumber()->Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<float> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToNumber()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Float32Array::hasInstance(args[0])) {
- uscxml::Float32Array* localArray = V8DOM::toClassPtr<V8Float32Array::V8Float32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<float> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToNumber()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Float32Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Float32ArrayPrivate* privData = V8DOM::toClassPtr<V8Float32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Float32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Float32Array::V8Float32ArrayPrivate* retPrivData = new V8Float32Array::V8Float32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Float32Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Float32Array* retVal = new uscxml::Float32Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Float32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Float32Array::V8Float32ArrayPrivate* retPrivData = new V8Float32Array::V8Float32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Float32Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Float32Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h
deleted file mode 100644
index 6684b58..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float32Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Float32Array_h
-#define V8Float32Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Float32Array {
-public:
- struct V8Float32ArrayPrivate {
- V8DOM* dom;
- uscxml::Float32Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Float32ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Float32Array"));
- 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"), V8Float32Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Float32Array::indexedPropertyCustomGetter, V8Float32Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Float32Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Float32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Float32Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Float32Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp
deleted file mode 100644
index 3b844b5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Float64Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Float64Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Float64Array::Constr;
-
-v8::Handle<v8::Value> V8Float64Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Float64Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Float64Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Float64Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Float64Array::hasInstance(args[0])) {
-
- uscxml::Float64Array* localArray = V8DOM::toClassPtr<V8Float64Array::V8Float64ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Float64Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Float64Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Float64Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<double> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToNumber()->Value());
- }
- localInstance = new uscxml::Float64Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Float64Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Float64Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Float64Array::V8Float64ArrayPrivate* retPrivData = new V8Float64Array::V8Float64ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Float64Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Float64Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Float64Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- double retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Float64Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Float64Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Float64Array* localArray = V8DOM::toClassPtr<V8Float64Array::V8Float64ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsNumber()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- double localValue = args[1]->ToNumber()->Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<double> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToNumber()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Float64Array::hasInstance(args[0])) {
- uscxml::Float64Array* localArray = V8DOM::toClassPtr<V8Float64Array::V8Float64ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<double> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToNumber()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Float64Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Float64ArrayPrivate* privData = V8DOM::toClassPtr<V8Float64ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Float64Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Float64Array::V8Float64ArrayPrivate* retPrivData = new V8Float64Array::V8Float64ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Float64Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Float64Array* retVal = new uscxml::Float64Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Float64Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Float64Array::V8Float64ArrayPrivate* retPrivData = new V8Float64Array::V8Float64ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Float64Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Float64Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h
deleted file mode 100644
index 0aa54a8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Float64Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Float64Array_h
-#define V8Float64Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Float64Array {
-public:
- struct V8Float64ArrayPrivate {
- V8DOM* dom;
- uscxml::Float64Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Float64ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Float64Array"));
- 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"), V8Float64Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Float64Array::indexedPropertyCustomGetter, V8Float64Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Float64Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Float64Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Float64Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Float64Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp
deleted file mode 100644
index 6a7e136..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Int16Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Int16Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Int16Array::Constr;
-
-v8::Handle<v8::Value> V8Int16Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Int16Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int16Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int16Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Int16Array::hasInstance(args[0])) {
-
- uscxml::Int16Array* localArray = V8DOM::toClassPtr<V8Int16Array::V8Int16ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Int16Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Int16Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int16Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<short> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInt32()->Value());
- }
- localInstance = new uscxml::Int16Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Int16Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Int16Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int16Array::V8Int16ArrayPrivate* retPrivData = new V8Int16Array::V8Int16ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int16Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Int16Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Int16Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- short retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Int16Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Int16Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Int16Array* localArray = V8DOM::toClassPtr<V8Int16Array::V8Int16ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- short localValue = args[1]->ToNumber()->Int32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<short> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInt32()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Int16Array::hasInstance(args[0])) {
- uscxml::Int16Array* localArray = V8DOM::toClassPtr<V8Int16Array::V8Int16ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<short> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInt32()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Int16Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int16ArrayPrivate* privData = V8DOM::toClassPtr<V8Int16ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Int16Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int16Array::V8Int16ArrayPrivate* retPrivData = new V8Int16Array::V8Int16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int16Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Int16Array* retVal = new uscxml::Int16Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Int16Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int16Array::V8Int16ArrayPrivate* retPrivData = new V8Int16Array::V8Int16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int16Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Int16Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h
deleted file mode 100644
index 0de8d89..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int16Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Int16Array_h
-#define V8Int16Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Int16Array {
-public:
- struct V8Int16ArrayPrivate {
- V8DOM* dom;
- uscxml::Int16Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Int16ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Int16Array"));
- 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"), V8Int16Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Int16Array::indexedPropertyCustomGetter, V8Int16Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Int16Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Int16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Int16Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Int16Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp
deleted file mode 100644
index c4055ca..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Int32Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Int32Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Int32Array::Constr;
-
-v8::Handle<v8::Value> V8Int32Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Int32Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int32Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int32Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Int32Array::hasInstance(args[0])) {
-
- uscxml::Int32Array* localArray = V8DOM::toClassPtr<V8Int32Array::V8Int32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Int32Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Int32Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int32Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<long> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInteger()->Value());
- }
- localInstance = new uscxml::Int32Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Int32Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Int32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int32Array::V8Int32ArrayPrivate* retPrivData = new V8Int32Array::V8Int32ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int32Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Int32Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Int32Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- long retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Int32Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Int32Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Int32Array* localArray = V8DOM::toClassPtr<V8Int32Array::V8Int32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- long localValue = args[1]->ToNumber()->Int32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<long> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInteger()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Int32Array::hasInstance(args[0])) {
- uscxml::Int32Array* localArray = V8DOM::toClassPtr<V8Int32Array::V8Int32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<long> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInteger()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Int32Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int32ArrayPrivate* privData = V8DOM::toClassPtr<V8Int32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Int32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int32Array::V8Int32ArrayPrivate* retPrivData = new V8Int32Array::V8Int32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int32Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Int32Array* retVal = new uscxml::Int32Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Int32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int32Array::V8Int32ArrayPrivate* retPrivData = new V8Int32Array::V8Int32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int32Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Int32Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h
deleted file mode 100644
index 431c355..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int32Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Int32Array_h
-#define V8Int32Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Int32Array {
-public:
- struct V8Int32ArrayPrivate {
- V8DOM* dom;
- uscxml::Int32Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Int32ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Int32Array"));
- 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"), V8Int32Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Int32Array::indexedPropertyCustomGetter, V8Int32Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Int32Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Int32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Int32Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Int32Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp
deleted file mode 100644
index 9698414..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Int8Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Int8Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Int8Array::Constr;
-
-v8::Handle<v8::Value> V8Int8Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Int8Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int8Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int8Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Int8Array::hasInstance(args[0])) {
-
- uscxml::Int8Array* localArray = V8DOM::toClassPtr<V8Int8Array::V8Int8ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Int8Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Int8Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Int8Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInt32()->Value());
- }
- localInstance = new uscxml::Int8Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Int8Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Int8Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int8Array::V8Int8ArrayPrivate* retPrivData = new V8Int8Array::V8Int8ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int8Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Int8Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Int8Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- char retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Int8Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Int8Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Int8Array* localArray = V8DOM::toClassPtr<V8Int8Array::V8Int8ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsInt32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- char localValue = args[1]->ToNumber()->Int32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInt32()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Int8Array::hasInstance(args[0])) {
- uscxml::Int8Array* localArray = V8DOM::toClassPtr<V8Int8Array::V8Int8ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToInt32()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Int8Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Int8ArrayPrivate* privData = V8DOM::toClassPtr<V8Int8ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Int8Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int8Array::V8Int8ArrayPrivate* retPrivData = new V8Int8Array::V8Int8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int8Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Int8Array* retVal = new uscxml::Int8Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Int8Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Int8Array::V8Int8ArrayPrivate* retPrivData = new V8Int8Array::V8Int8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Int8Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Int8Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h
deleted file mode 100644
index 396139d..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Int8Array_h
-#define V8Int8Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Int8Array {
-public:
- struct V8Int8ArrayPrivate {
- V8DOM* dom;
- uscxml::Int8Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Int8ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Int8Array"));
- 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"), V8Int8Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Int8Array::indexedPropertyCustomGetter, V8Int8Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Int8Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Int8Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Int8Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
deleted file mode 100644
index b55b9d1..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8NamedNodeMap.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling getNamedItem");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Node::hasInstance(args[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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling setNamedItem");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling removeNamedItem");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling item");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling getNamedItemNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Node::hasInstance(args[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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling setNamedItemNS");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling removeNamedItemNS");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 71e501b..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8NamedNodeMap_h
-#define V8NamedNodeMap_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8NamedNodeMap_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
deleted file mode 100644
index ec66b15..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Document.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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);
-}
-
-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());
-}
-
-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());
-
- 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::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());
-
- 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::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));
-
- 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());
-
- 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));
-
- 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());
-
- 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::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;
-
-}
-
-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));
-
- if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
- Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
-
- v8::Handle<v8::Function> arbaicaRetCtor = V8Document::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;
-
-}
-
-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::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));
-
- return v8::String::New(privData->nativeObj->getPrefix().c_str());
-}
-
-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);
-}
-
-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) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Node::hasInstance(args[0]) &&
- args[1]->IsObject() && V8Node::hasInstance(args[1])) {
- 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;
-
- 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;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling insertBefore");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Node::hasInstance(args[0]) &&
- args[1]->IsObject() && V8Node::hasInstance(args[1])) {
- 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;
-
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling replaceChild");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Node::hasInstance(args[0])) {
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling removeChild");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Node::hasInstance(args[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->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;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling appendChild");
- return v8::Undefined();
-}
-
-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));
- if (false) {
- } else if (args.Length() == 0) {
-
- bool retVal = privData->nativeObj->hasChildNodes();
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling hasChildNodes");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsBoolean()) {
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling cloneNode");
- return v8::Undefined();
-}
-
-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));
- if (false) {
- } else if (args.Length() == 0) {
-
- privData->nativeObj->normalize();
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling normalize");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
-
- bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling isSupported");
- return v8::Undefined();
-}
-
-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));
- if (false) {
- } else if (args.Length() == 0) {
-
- bool retVal = privData->nativeObj->hasAttributes();
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling hasAttributes");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 5a512ef..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Node_h
-#define V8Node_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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> attributesCustomAttrGetter(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::attributesCustomAttrGetter, 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Node_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp
deleted file mode 100644
index af43e20..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Node.h"
-#include "V8NamedNodeMap.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8Node::attributesCustomAttrGetter(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->hasAttributes()) {
- return v8::Undefined();
- }
-
- 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;
-
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
deleted file mode 100644
index efe5fa8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Node.h"
-#include "V8NodeList.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- 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());
-
- 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;
-
- }
- throw V8Exception("Parameter mismatch while calling item");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 570ad66..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8NodeList_h
-#define V8NodeList_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8NodeList {
-public:
- struct V8NodeListPrivate {
- V8DOM* dom;
- Arabica::DOM::NodeList<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodeListPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- 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> 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("NodeList"));
- 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"), V8NodeList::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8NodeList::indexedPropertyCustomGetter, 0);
- 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8NodeList_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeListCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeListCustom.cpp
deleted file mode 100644
index 69af5b0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeListCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8NodeList.h"
-#include "V8Element.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8NodeList::indexedPropertyCustomGetter(uint32_t index, const v8::AccessorInfo &info) {
- v8::Local<v8::Object> self = info.Holder();
- V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
-
- if (privData->nativeObj->getLength() >= index) {
- switch(privData->nativeObj->item(index).getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->item(index));
-
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
- }
- default: {
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(index));
-
- 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;
- }
- }
- }
-
- return v8::Undefined();
-
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
deleted file mode 100644
index a011465..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8NodeSet.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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));
- if (false) {
- } else if (args.Length() == 0) {
-
- privData->nativeObj->to_document_order();
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling toDocumentOrder");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 85254d5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8NodeSet_h
-#define V8NodeSet_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8NodeSet_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp
deleted file mode 100644
index 31298f0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8NodeSet.h"
-#include "V8Element.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8NodeSet::indexedPropertyCustomGetter(uint32_t index, const v8::AccessorInfo &info) {
- v8::Local<v8::Object> self = info.Holder();
- V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
-
- if (privData->nativeObj->size() >= index) {
- switch((*privData->nativeObj)[index].getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>((*privData->nativeObj)[index]);
-
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
- }
- default: {
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>((*privData->nativeObj)[index]);
-
- 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;
- }
- }
- }
-
- return v8::Undefined();
-
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
deleted file mode 100644
index 1ec9b88..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Node.h"
-#include "V8Notation.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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
deleted file mode 100644
index 9c574bd..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Notation_h
-#define V8Notation_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Notation {
-public:
- struct V8NotationPrivate {
- V8DOM* dom;
- Arabica::DOM::Notation<std::string>* nativeObj;
- };
-
- 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::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();
- (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));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Notation_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
deleted file mode 100644
index 06fdc7a..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Node.h"
-#include "V8ProcessingInstruction.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
deleted file mode 100644
index 20700d2..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8ProcessingInstruction_h
-#define V8ProcessingInstruction_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8Node.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8ProcessingInstruction {
-public:
- struct V8ProcessingInstructionPrivate {
- V8DOM* dom;
- Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
- };
-
- 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::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();
- (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));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8ProcessingInstruction_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
deleted file mode 100644
index d459bc2..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Node.h"
-#include "V8SCXMLEvent.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
-
-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());
-}
-
-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));
-
- if (privData->nativeObj->origin.length() == 0)
- return v8::Undefined();
- 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));
-
- if (privData->nativeObj->origintype.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->origintype.c_str());
-}
-
-v8::Handle<v8::Value> V8SCXMLEvent::rawAttrGetter(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->raw.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->raw.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));
-
- 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());
-
- 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> 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));
-
- if (privData->nativeObj->invokeid.length() == 0)
- return v8::Undefined();
- 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
deleted file mode 100644
index 72f85c6..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8SCXMLEvent_h
-#define V8SCXMLEvent_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8SCXMLEvent {
-public:
- struct V8SCXMLEventPrivate {
- V8DOM* dom;
- uscxml::Event* nativeObj;
- };
-
- V8_DESTRUCTOR(V8SCXMLEventPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> typeCustomAttrGetter(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> rawAttrGetter(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> sendidCustomAttrGetter(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::typeCustomAttrGetter, 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("raw"), V8SCXMLEvent::rawAttrGetter, 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::sendidCustomAttrGetter, 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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8SCXMLEvent_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp
deleted file mode 100644
index 0876f81..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEventCustom.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8SCXMLEvent.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8SCXMLEvent::typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-
- switch (privData->nativeObj->eventType) {
- case uscxml::Event::INTERNAL:
- return v8::String::New("internal");
- break;
- case uscxml::Event::EXTERNAL:
- return v8::String::New("external");
- break;
- case uscxml::Event::PLATFORM:
- return v8::String::New("platform");
- break;
- default:
- break;
- }
- return v8::String::New("unknown");
-}
-
-v8::Handle<v8::Value> V8SCXMLEvent::sendidCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-
- if (privData->nativeObj->sendid.length() == 0 || privData->nativeObj->hideSendId)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->sendid.c_str());
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.cpp
deleted file mode 100644
index f1fb9b6..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8Storage.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Storage::Tmpl;
-
-v8::Handle<v8::Value> V8Storage::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8StoragePrivate* privData = V8DOM::toClassPtr<V8StoragePrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Storage::keyCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8StoragePrivate* privData = V8DOM::toClassPtr<V8StoragePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- std::string retVal = privData->nativeObj->key(localIndex);
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling key");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Storage::getItemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8StoragePrivate* privData = V8DOM::toClassPtr<V8StoragePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localKey(args[0]);
-
- std::string retVal = privData->nativeObj->getItem(*localKey);
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling getItem");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Storage::setItemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8StoragePrivate* privData = V8DOM::toClassPtr<V8StoragePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsString() &&
- args[1]->IsString()) {
- v8::String::AsciiValue localKey(args[0]);
- v8::String::AsciiValue localValue(args[1]);
-
- privData->nativeObj->setItem(*localKey, *localValue);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling setItem");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Storage::removeItemCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8StoragePrivate* privData = V8DOM::toClassPtr<V8StoragePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsString()) {
- v8::String::AsciiValue localKey(args[0]);
-
- privData->nativeObj->removeItem(*localKey);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling removeItem");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Storage::clearCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8StoragePrivate* privData = V8DOM::toClassPtr<V8StoragePrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 0) {
-
- privData->nativeObj->clear();
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling clear");
- return v8::Undefined();
-}
-bool V8Storage::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.h
deleted file mode 100644
index b3d4c53..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Storage.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Storage_h
-#define V8Storage_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Storage {
-public:
- struct V8StoragePrivate {
- V8DOM* dom;
- uscxml::Storage* nativeObj;
- };
-
- V8_DESTRUCTOR_KEEP_WRAPPED(V8StoragePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> keyCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> clearCallback(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("Storage"));
- 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"), V8Storage::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("key"),
- v8::FunctionTemplate::New(V8Storage::keyCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getItem"),
- v8::FunctionTemplate::New(V8Storage::getItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setItem"),
- v8::FunctionTemplate::New(V8Storage::setItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeItem"),
- v8::FunctionTemplate::New(V8Storage::removeItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("clear"),
- v8::FunctionTemplate::New(V8Storage::clearCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Storage_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
deleted file mode 100644
index ec06237..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8CharacterData.h"
-#include "V8Text.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
-
-v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- 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());
-
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling splitText");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 1151311..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Text_h
-#define V8Text_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "V8CharacterData.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Text {
-public:
- struct V8TextPrivate {
- V8DOM* dom;
- Arabica::DOM::Text<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8TextPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- 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();
-
- 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));
-
-
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Text_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8TypedArrayCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8TypedArrayCustom.cpp
deleted file mode 100644
index dc25a4f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8TypedArrayCustom.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "../../TypedArray.h"
-#include "V8ArrayBuffer.h"
-#include "V8Int8Array.h"
-#include "V8Uint8Array.h"
-#include "V8Uint8ClampedArray.h"
-#include "V8Int16Array.h"
-#include "V8Uint16Array.h"
-#include "V8Int32Array.h"
-#include "V8Uint32Array.h"
-#include "V8Float32Array.h"
-#include "V8Float64Array.h"
-#include "V8DataView.h"
-
-#define V8_TYPED_ARRAY_GET_PRIVATE(type) \
-v8::Local<v8::Object> self = info.Holder(); \
-uscxml::type* array = V8DOM::toClassPtr<V8##type##Private >(self->GetInternalField(0))->nativeObj; \
-if (index > array->getLength()) \
- return v8::Undefined();
-
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8Int8Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Int8Array);
- array->set(index, value->ToInt32()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Int16Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Int16Array);
- array->set(index, value->ToInt32()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Int32Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Int32Array);
- array->set(index, value->ToInt32()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Uint8Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint8Array);
- array->set(index, value->ToUint32()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Uint16Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint16Array);
- array->set(index, value->ToUint32()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Uint32Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint32Array);
- array->set(index, value->ToUint32()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Float32Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Float32Array);
- array->set(index, value->ToNumber()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Float64Array::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Float64Array);
- array->set(index, value->ToNumber()->Value());
- return value;
-}
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::indexedPropertyCustomSetter(unsigned int index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint8ClampedArray);
- array->set(index, value->ToUint32()->Value() & 0xff);
- return value;
-}
-
-// ----------------
-
-v8::Handle<v8::Value> V8Int8Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Int8Array);
- return v8::Int32::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Int16Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Int16Array);
- return v8::Int32::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Int32Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Int32Array);
- return v8::Int32::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Uint8Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint8Array);
- return v8::Uint32::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Uint16Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint16Array);
- return v8::Uint32::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Uint32Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint32Array);
- return v8::Uint32::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Float32Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Float32Array);
- return v8::Number::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Float64Array::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Float64Array);
- return v8::Number::New(array->get(index));
-}
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::indexedPropertyCustomGetter(unsigned int index, const v8::AccessorInfo &info) {
- V8_TYPED_ARRAY_GET_PRIVATE(Uint8ClampedArray);
- return v8::Uint32::New(array->get(index));
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp
deleted file mode 100644
index 1fbe1d5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Uint16Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Uint16Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Uint16Array::Constr;
-
-v8::Handle<v8::Value> V8Uint16Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Uint16Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint16Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint16Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint16Array::hasInstance(args[0])) {
-
- uscxml::Uint16Array* localArray = V8DOM::toClassPtr<V8Uint16Array::V8Uint16ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint16Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint16Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint16Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<unsigned short> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- localInstance = new uscxml::Uint16Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Uint16Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Uint16Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint16Array::V8Uint16ArrayPrivate* retPrivData = new V8Uint16Array::V8Uint16ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint16Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Uint16Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Uint16Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- unsigned short retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint16Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Uint16Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Uint16Array* localArray = V8DOM::toClassPtr<V8Uint16Array::V8Uint16ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- unsigned short localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<unsigned short> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint16Array::hasInstance(args[0])) {
- uscxml::Uint16Array* localArray = V8DOM::toClassPtr<V8Uint16Array::V8Uint16ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<unsigned short> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint16Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint16ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint16ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Uint16Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint16Array::V8Uint16ArrayPrivate* retPrivData = new V8Uint16Array::V8Uint16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint16Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Uint16Array* retVal = new uscxml::Uint16Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Uint16Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint16Array::V8Uint16ArrayPrivate* retPrivData = new V8Uint16Array::V8Uint16ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint16Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Uint16Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h
deleted file mode 100644
index 3f94ab8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint16Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Uint16Array_h
-#define V8Uint16Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Uint16Array {
-public:
- struct V8Uint16ArrayPrivate {
- V8DOM* dom;
- uscxml::Uint16Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Uint16ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Uint16Array"));
- 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"), V8Uint16Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Uint16Array::indexedPropertyCustomGetter, V8Uint16Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Uint16Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Uint16Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Uint16Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Uint16Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp
deleted file mode 100644
index 10f3b3c..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Uint32Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Uint32Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Uint32Array::Constr;
-
-v8::Handle<v8::Value> V8Uint32Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Uint32Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint32Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint32Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint32Array::hasInstance(args[0])) {
-
- uscxml::Uint32Array* localArray = V8DOM::toClassPtr<V8Uint32Array::V8Uint32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint32Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint32Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint32Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<unsigned long> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- localInstance = new uscxml::Uint32Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Uint32Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Uint32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint32Array::V8Uint32ArrayPrivate* retPrivData = new V8Uint32Array::V8Uint32ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint32Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Uint32Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Uint32Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- unsigned long retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint32Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Uint32Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Uint32Array* localArray = V8DOM::toClassPtr<V8Uint32Array::V8Uint32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- unsigned long localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<unsigned long> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint32Array::hasInstance(args[0])) {
- uscxml::Uint32Array* localArray = V8DOM::toClassPtr<V8Uint32Array::V8Uint32ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<unsigned long> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint32Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint32ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint32ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Uint32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint32Array::V8Uint32ArrayPrivate* retPrivData = new V8Uint32Array::V8Uint32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint32Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Uint32Array* retVal = new uscxml::Uint32Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Uint32Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint32Array::V8Uint32ArrayPrivate* retPrivData = new V8Uint32Array::V8Uint32ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint32Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Uint32Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h
deleted file mode 100644
index 2ecaa9e..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint32Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Uint32Array_h
-#define V8Uint32Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Uint32Array {
-public:
- struct V8Uint32ArrayPrivate {
- V8DOM* dom;
- uscxml::Uint32Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Uint32ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Uint32Array"));
- 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"), V8Uint32Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Uint32Array::indexedPropertyCustomGetter, V8Uint32Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Uint32Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Uint32Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Uint32Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Uint32Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp
deleted file mode 100644
index 3a8248a..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Uint8Array.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Uint8Array::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Uint8Array::Constr;
-
-v8::Handle<v8::Value> V8Uint8Array::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Uint8Array* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint8Array(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint8Array(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint8Array::hasInstance(args[0])) {
-
- uscxml::Uint8Array* localArray = V8DOM::toClassPtr<V8Uint8Array::V8Uint8ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint8Array(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint8Array(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint8Array(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<unsigned char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- localInstance = new uscxml::Uint8Array(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Uint8Array");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Uint8Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint8Array::V8Uint8ArrayPrivate* retPrivData = new V8Uint8Array::V8Uint8ArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint8Array::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Uint8Array::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Uint8Array::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- unsigned char retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint8Array::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Uint8Array::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Uint8Array* localArray = V8DOM::toClassPtr<V8Uint8Array::V8Uint8ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- unsigned char localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<unsigned char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint8Array::hasInstance(args[0])) {
- uscxml::Uint8Array* localArray = V8DOM::toClassPtr<V8Uint8Array::V8Uint8ArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<unsigned char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint8Array::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint8ArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Uint8Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint8Array::V8Uint8ArrayPrivate* retPrivData = new V8Uint8Array::V8Uint8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint8Array::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Uint8Array* retVal = new uscxml::Uint8Array(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Uint8Array::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint8Array::V8Uint8ArrayPrivate* retPrivData = new V8Uint8Array::V8Uint8ArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint8Array::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Uint8Array::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h
deleted file mode 100644
index 9ecc219..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Uint8Array_h
-#define V8Uint8Array_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Uint8Array {
-public:
- struct V8Uint8ArrayPrivate {
- V8DOM* dom;
- uscxml::Uint8Array* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Uint8ArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Uint8Array"));
- 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"), V8Uint8Array::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Uint8Array::indexedPropertyCustomGetter, V8Uint8Array::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Uint8Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Uint8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Uint8Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Uint8Array_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp
deleted file mode 100644
index e05c8a8..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Uint8ClampedArray.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Persistent<v8::FunctionTemplate> V8Uint8ClampedArray::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Uint8ClampedArray::Constr;
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::constructor(const v8::Arguments& args) {
- if (!args.IsConstructCall())
- return v8::ThrowException(v8::String::New("Cannot call constructor as function"));
-
- uscxml::Uint8ClampedArray* localInstance = NULL;
- if (false) {
- } else if (args.Length() == 3 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32() &&
- args[2]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- unsigned long localLength = args[2]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint8ClampedArray(localBuffer, localByteOffset, localLength);
-
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localByteOffset = args[1]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint8ClampedArray(localBuffer, localByteOffset);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint8ClampedArray::hasInstance(args[0])) {
-
- uscxml::Uint8ClampedArray* localArray = V8DOM::toClassPtr<V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint8ClampedArray(localArray);
-
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8ArrayBuffer::hasInstance(args[0])) {
-
- uscxml::ArrayBuffer* localBuffer = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- localInstance = new uscxml::Uint8ClampedArray(localBuffer);
-
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
-
- unsigned long localLength = args[0]->ToNumber()->Uint32Value();
- localInstance = new uscxml::Uint8ClampedArray(localLength);
-
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
-
- std::vector<unsigned char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- localInstance = new uscxml::Uint8ClampedArray(localArray);
-
- }
- if (!localInstance) {
- throw V8Exception("Parameter mismatch while calling constructor for Uint8ClampedArray");
- return v8::Undefined();
- }
-
- v8::Handle<v8::Function> retCtor = V8Uint8ClampedArray::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate* retPrivData = new V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate();
- retPrivData->nativeObj = localInstance;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint8ClampedArray::jsDestructor);
- return retObj;
-}
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0));
-
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::getCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 1 &&
- args[0]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
-
- unsigned char retVal = privData->nativeObj->get(localIndex);
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling get");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::setCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsObject() && V8Uint8ClampedArray::hasInstance(args[0]) &&
- args[1]->IsUint32()) {
- uscxml::Uint8ClampedArray* localArray = V8DOM::toClassPtr<V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsUint32() &&
- args[1]->IsUint32()) {
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- unsigned char localValue = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localIndex, localValue);
-
- return v8::Undefined();
- } else if (args.Length() == 2 &&
- args[0]->IsArray() &&
- args[1]->IsUint32()) {
- std::vector<unsigned char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
- unsigned long localOffset = args[1]->ToNumber()->Uint32Value();
-
- privData->nativeObj->set(localArray, localOffset);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsObject() && V8Uint8ClampedArray::hasInstance(args[0])) {
- uscxml::Uint8ClampedArray* localArray = V8DOM::toClassPtr<V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- } else if (args.Length() == 1 &&
- args[0]->IsArray()) {
- std::vector<unsigned char> localArray;
- v8::Handle<v8::Array> localArrayArray(v8::Array::Cast(*args[0]));
- for (int i = 0; i < localArrayArray->Length(); i++) {
- localArray.push_back(localArrayArray->Get(i)->ToUint32()->Value());
- }
-
- privData->nativeObj->set(localArray);
-
- return v8::Undefined();
- }
- throw V8Exception("Parameter mismatch while calling set");
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Uint8ClampedArray::subarrayCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8Uint8ClampedArrayPrivate* privData = V8DOM::toClassPtr<V8Uint8ClampedArrayPrivate >(self->GetInternalField(0));
- if (false) {
- } else if (args.Length() == 2 &&
- args[0]->IsInt32() &&
- args[1]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
- long localEnd = args[1]->ToNumber()->Int32Value();
-
- uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart, localEnd));
- v8::Handle<v8::Function> retCtor = V8Uint8ClampedArray::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate* retPrivData = new V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint8ClampedArray::jsDestructor);
- return retObj;
-
- } else if (args.Length() == 1 &&
- args[0]->IsInt32()) {
- long localStart = args[0]->ToNumber()->Int32Value();
-
- uscxml::Uint8ClampedArray* retVal = new uscxml::Uint8ClampedArray(privData->nativeObj->subarray(localStart));
- v8::Handle<v8::Function> retCtor = V8Uint8ClampedArray::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate* retPrivData = new V8Uint8ClampedArray::V8Uint8ClampedArrayPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Uint8ClampedArray::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling subarray");
- return v8::Undefined();
-}
-bool V8Uint8ClampedArray::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h
deleted file mode 100644
index 3fa08de..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Uint8ClampedArray.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8Uint8ClampedArray_h
-#define V8Uint8ClampedArray_h
-
-#include <string>
-#include "../../TypedArray.h"
-#include "DOM/Node.hpp"
-#include "V8ArrayBufferView.h"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-namespace DOM {
-
-class V8Uint8ClampedArray {
-public:
- struct V8Uint8ClampedArrayPrivate {
- V8DOM* dom;
- uscxml::Uint8ClampedArray* nativeObj;
- };
-
- V8_DESTRUCTOR(V8Uint8ClampedArrayPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
-
- static v8::Handle<v8::Value> constructor(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Constr;
- static v8::Handle<v8::FunctionTemplate> getConstructor() {
- if (Constr.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor);
- Constr = v8::Persistent<v8::FunctionTemplate>::New(constr);
- }
- return Constr;
- }
-
- 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("Uint8ClampedArray"));
- 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"), V8Uint8ClampedArray::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8Uint8ClampedArray::indexedPropertyCustomGetter, V8Uint8ClampedArray::indexedPropertyCustomSetter);
- prototype->Set(v8::String::NewSymbol("get"),
- v8::FunctionTemplate::New(V8Uint8ClampedArray::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("set"),
- v8::FunctionTemplate::New(V8Uint8ClampedArray::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("subarray"),
- v8::FunctionTemplate::New(V8Uint8ClampedArray::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- tmpl->Inherit(V8ArrayBufferView::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
-
-};
-
-}
-}
-
-#endif // V8Uint8ClampedArray_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
deleted file mode 100644
index 8bfd883..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8NodeSet.h"
-#include "V8XPathResult.h"
-
-namespace Arabica {
-namespace DOM {
-
-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));
-
- 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));
-
- 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));
-
- 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));
- if (false) {
- } else if (args.Length() == 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());
-
- struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8NodeSet::jsDestructor);
- return retObj;
-
- }
- throw V8Exception("Parameter mismatch while calling asNodeSet");
- return v8::Undefined();
-}
-
-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));
- if (false) {
- } else if (args.Length() == 0) {
-
- bool retVal = privData->nativeObj->asBool();
-
- return v8::Boolean::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling asBool");
- return v8::Undefined();
-}
-
-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));
- if (false) {
- } else if (args.Length() == 0) {
-
- std::string retVal = privData->nativeObj->asString();
-
- return v8::String::New(retVal.c_str());
- }
- throw V8Exception("Parameter mismatch while calling asString");
- return v8::Undefined();
-}
-
-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));
- if (false) {
- } else if (args.Length() == 0) {
-
- double retVal = privData->nativeObj->asNumber();
-
- return v8::Number::New(retVal);
- }
- throw V8Exception("Parameter mismatch while calling asNumber");
- return v8::Undefined();
-}
-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
deleted file mode 100644
index 3aab7b0..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * @file
- * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-
-#ifndef V8XPathResult_h
-#define V8XPathResult_h
-
-#include <string>
-#include "DOM/Node.hpp"
-#include "string"
-#include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h"
-#include <v8.h>
-
-namespace Arabica {
-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();
- (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;
- }
-
-
-};
-
-}
-}
-
-#endif // V8XPathResult_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp
deleted file mode 100644
index 3e4063f..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "V8XPathResult.h"
-#include "V8Node.h"
-
-namespace Arabica {
-namespace DOM {
-
-v8::Handle<v8::Value> V8XPathResult::singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->asNodeSet()[0]);
-
- 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;
-}
-
-}
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDOM.cpp.inc b/src/uscxml/plugins/datamodel/lua/LuaDOM.cpp.inc
new file mode 100644
index 0000000..5a256b6
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/lua/LuaDOM.cpp.inc
@@ -0,0 +1,8969 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.8
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+#ifndef SWIGLUA
+#define SWIGLUA
+#endif
+
+#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
+#define SWIG_LUA_MODULE_GLOBAL
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+ struct SwigMovePointer {
+ T *ptr;
+ SwigMovePointer(T *p) : ptr(p) { }
+ ~SwigMovePointer() { delete ptr; }
+ SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+ } pointer;
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+ SwigValueWrapper() : pointer(0) { }
+ SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+ operator T&() const { return *pointer.ptr; }
+ T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+ return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * This section contains generic SWIG labels for method/variable
+ * declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+# define SWIGINLINE inline
+# else
+# define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+# elif defined(__ICC)
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+# pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+# define SWIGUNUSEDPARM(p)
+# else
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# ifndef GCC_HASCLASSVISIBILITY
+# define GCC_HASCLASSVISIBILITY
+# endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT
+# else
+# define SWIGEXPORT __declspec(dllexport)
+# endif
+# else
+# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+# define SWIGEXPORT __attribute__ ((visibility("default")))
+# else
+# define SWIGEXPORT
+# endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# define SWIGSTDCALL __stdcall
+# else
+# define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
+#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
+# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
+#endif
+
+/* Intel's compiler complains if a variable which was never initialised is
+ * cast to void, which is a common idiom which we use to indicate that we
+ * are aware a variable isn't used. So we just silence that warning.
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
+ */
+#ifdef __INTEL_COMPILER
+# pragma warning disable 592
+#endif
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+ or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+ creating a static or dynamic library from the SWIG runtime code.
+ In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+ But only do this if strictly necessary, ie, if you have problems
+ with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/* Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN 0x1
+
+
+/*
+ Flags/methods for returning states.
+
+ The SWIG conversion methods, as ConvertPtr, return an integer
+ that tells if the conversion was successful or not. And if not,
+ an error code can be returned (see swigerrors.swg for the codes).
+
+ Use the following macros/flags to set or process the returning
+ states.
+
+ In old versions of SWIG, code such as the following was usually written:
+
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+ // success code
+ } else {
+ //fail code
+ }
+
+ Now you can be more explicit:
+
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ } else {
+ // fail code
+ }
+
+ which is the same really, but now you can also do
+
+ Type *ptr;
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ if (SWIG_IsNewObj(res) {
+ ...
+ delete *ptr;
+ } else {
+ ...
+ }
+ } else {
+ // fail code
+ }
+
+ I.e., now SWIG_ConvertPtr can return new objects and you can
+ identify the case and take care of the deallocation. Of course that
+ also requires SWIG_ConvertPtr to return new result values, such as
+
+ int SWIG_ConvertPtr(obj, ptr,...) {
+ if (<obj is ok>) {
+ if (<need new object>) {
+ *ptr = <ptr to new allocated object>;
+ return SWIG_NEWOBJ;
+ } else {
+ *ptr = <ptr to old object>;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ return SWIG_BADOBJ;
+ }
+ }
+
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+ SWIG errors code.
+
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+ allows to return the 'cast rank', for example, if you have this
+
+ int food(double)
+ int fooi(int);
+
+ and you call
+
+ food(1) // cast rank '1' (1 -> 1.0)
+ fooi(1) // cast rank '0'
+
+ just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK (0)
+#define SWIG_ERROR (-1)
+#define SWIG_IsOK(r) (r >= 0)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ (SWIG_ERROR)
+#define SWIG_OLDOBJ (SWIG_OK)
+#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+# ifndef SWIG_TypeRank
+# define SWIG_TypeRank unsigned long
+# endif
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# define SWIG_MAXCASTRANK (2)
+# endif
+# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
+# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+# define SWIG_AddCast(r) (r)
+# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+} swig_module_info;
+
+/*
+ Compare two type names skipping the space characters, therefore
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+ Return 0 when the two name types are equivalent, as in
+ strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+ const char *f2, const char *l2) {
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+ }
+ return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+ int equiv = 1;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (equiv != 0 && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
+ }
+ equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+ if (*ne) ++ne;
+ }
+ return equiv;
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+ return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+ Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+ if (ty) {
+ swig_cast_info *iter = ty->cast;
+ while (iter) {
+ if (strcmp(iter->type->name, c) == 0) {
+ if (iter == ty->cast)
+ return iter;
+ /* Move iter to the top of the linked list */
+ iter->prev->next = iter->next;
+ if (iter->next)
+ iter->next->prev = iter->prev;
+ iter->next = ty->cast;
+ iter->prev = 0;
+ if (ty->cast) ty->cast->prev = iter;
+ ty->cast = iter;
+ return iter;
+ }
+ iter = iter->next;
+ }
+ }
+ return 0;
+}
+
+/*
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+ if (ty) {
+ swig_cast_info *iter = ty->cast;
+ while (iter) {
+ if (iter->type == from) {
+ if (iter == ty->cast)
+ return iter;
+ /* Move iter to the top of the linked list */
+ iter->prev->next = iter->next;
+ if (iter->next)
+ iter->next->prev = iter->prev;
+ iter->next = ty->cast;
+ iter->prev = 0;
+ if (ty->cast) ty->cast->prev = iter;
+ ty->cast = iter;
+ return iter;
+ }
+ iter = iter->next;
+ }
+ }
+ return 0;
+}
+
+/*
+ Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+ Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast) return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast)(ptr);
+ if (ty) lastty = ty;
+ }
+ return lastty;
+}
+
+/*
+ Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
+
+/*
+ Return the pretty name associated with this type,
+ that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type) return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|') last_name = s+1;
+ return last_name;
+ }
+ else
+ return type->name;
+}
+
+/*
+ Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+}
+
+/*
+ Search for a swig_type_info structure only by mangled name
+ Search is a O(log #types)
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ size_t l = 0;
+ size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
+}
+
+/*
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
+ It first searches the mangled names of the types, which is a O(log #types)
+ If a type is not found it then searches the human readable names, which is O(#types).
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+}
+
+/*
+ Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
+
+/*
+ Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ char d = *(c++);
+ unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+}
+
+/*
+ Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+ strcpy(r,name);
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2*sz + 2 + lname) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ if (lname) {
+ strncpy(r,name,lname+1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ memset(ptr,0,sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * luarun.swg
+ *
+ * This file contains the runtime support for Lua modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "lua.h"
+#include "lauxlib.h"
+#include <stdlib.h> /* for malloc */
+#include <assert.h> /* for a few sanity tests */
+
+/* -----------------------------------------------------------------------------
+ * Lua flavors
+ * ----------------------------------------------------------------------------- */
+
+#define SWIG_LUA_FLAVOR_LUA 1
+#define SWIG_LUA_FLAVOR_ELUA 2
+#define SWIG_LUA_FLAVOR_ELUAC 3
+
+#if !defined(SWIG_LUA_TARGET)
+# error SWIG_LUA_TARGET not defined
+#endif
+
+#if defined(SWIG_LUA_ELUA_EMULATE)
+
+struct swig_elua_entry;
+
+typedef struct swig_elua_key {
+ int type;
+ union {
+ const char* strkey;
+ lua_Number numkey;
+ } key;
+} swig_elua_key;
+
+typedef struct swig_elua_val {
+ int type;
+ union {
+ lua_Number number;
+ const struct swig_elua_entry *table;
+ const char *string;
+ lua_CFunction function;
+ struct {
+ char member;
+ long lvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+ } userdata;
+ } value;
+} swig_elua_val;
+
+typedef struct swig_elua_entry {
+ swig_elua_key key;
+ swig_elua_val value;
+} swig_elua_entry;
+
+#define LSTRKEY(x) {LUA_TSTRING, {.strkey = x} }
+#define LNUMKEY(x) {LUA_TNUMBER, {.numkey = x} }
+#define LNILKEY {LUA_TNIL, {.strkey = 0} }
+
+#define LNUMVAL(x) {LUA_TNUMBER, {.number = x} }
+#define LFUNCVAL(x) {LUA_TFUNCTION, {.function = x} }
+#define LROVAL(x) {LUA_TTABLE, {.table = x} }
+#define LNILVAL {LUA_TNIL, {.string = 0} }
+#define LSTRVAL(x) {LUA_TSTRING, {.string = x} }
+
+#define LUA_REG_TYPE swig_elua_entry
+
+#define SWIG_LUA_ELUA_EMUL_METATABLE_KEY "__metatable"
+
+#define lua_pushrotable(L,p)\
+ lua_newtable(L);\
+ assert(p);\
+ SWIG_Lua_elua_emulate_register(L,(swig_elua_entry*)(p));
+
+#define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
+ LSTRKEY(B), {LUA_TUSERDATA, { .userdata={0,0,(void*)(C),&D} } }
+
+#define SWIG_LUA_CONSTTAB_BINARY(B,S,C,D)\
+ LSTRKEY(B), {LUA_TUSERDATA, { .userdata={1,S,(void*)(C),&D} } }
+#endif
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
+# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
+# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
+# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
+ /* Those two types of constants are not supported in elua */
+
+#ifndef SWIG_LUA_CONSTTAB_POINTER
+#warning eLua does not support pointers as constants. By default, nil will be used as value
+#define SWIG_LUA_CONSTTAB_POINTER(B,C,D) LSTRKEY(B), LNILVAL
+#endif
+
+#ifndef SWIG_LUA_CONSTTAB_BINARY
+#warning eLua does not support pointers to member as constants. By default, nil will be used as value
+#define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D) LSTRKEY(B), LNILVAL
+#endif
+#else /* SWIG_LUA_FLAVOR_LUA */
+# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
+# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
+# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
+# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
+# define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
+ SWIG_LUA_POINTER, (char *)B, 0, 0, (void *)C, &D
+# define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D)\
+ SWIG_LUA_BINARY, (char *)B, S, 0, (void *)C, &D
+#endif
+
+#ifndef SWIG_LUA_ELUA_EMULATE
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
+# define LSTRVAL LRO_STRVAL
+#endif
+#endif /* SWIG_LUA_ELUA_EMULATE*/
+
+#ifndef SWIG_LUA_ELUA_EMULATE
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+
+#ifndef MIN_OPT_LEVEL
+#define MIN_OPT_LEVEL 2
+#endif
+
+#include "lrodefs.h"
+#include "lrotable.h"
+#endif
+#endif /* SWIG_LUA_ELUA_EMULATE*/
+/* -----------------------------------------------------------------------------
+ * compatibility defines
+ * ----------------------------------------------------------------------------- */
+
+/* History of Lua C API length functions: In Lua 5.0 (and before?)
+ there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen",
+ but a compatibility define of "lua_strlen" was added. In Lua 5.2,
+ this function was again renamed, to "lua_rawlen" (to emphasize that
+ it doesn't call the "__len" metamethod), and the compatibility
+ define of lua_strlen was removed. All SWIG uses have been updated
+ to "lua_rawlen", and we add our own defines of that here for older
+ versions of Lua. */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
+# define lua_rawlen lua_strlen
+#elif LUA_VERSION_NUM == 501
+# define lua_rawlen lua_objlen
+#endif
+
+
+/* lua_pushglobaltable is the recommended "future-proof" way to get
+ the global table for Lua 5.2 and later. Here we define
+ lua_pushglobaltable ourselves for Lua versions before 5.2. */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
+# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
+#endif
+
+/* lua_absindex was introduced in Lua 5.2 */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
+# define lua_absindex(L,i) ((i)>0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
+#endif
+
+/* lua_rawsetp was introduced in Lua 5.2 */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
+#define lua_rawsetp(L,index,ptr)\
+ lua_pushlightuserdata(L,(void*)(ptr));\
+ lua_insert(L,-2);\
+ lua_rawset(L,index);
+
+#define lua_rawgetp(L,index,ptr)\
+ lua_pushlightuserdata(L,(void*)(ptr));\
+ lua_rawget(L,index);
+
+#endif
+
+/* --------------------------------------------------------------------------
+ * Helper functions for error handling
+ * -------------------------------------------------------------------------- */
+
+/* Push the string STR on the Lua stack, like lua_pushstring, but
+ prefixed with the the location of the innermost Lua call-point
+ (as formated by luaL_where). */
+SWIGRUNTIME void
+SWIG_Lua_pusherrstring (lua_State *L, const char *str)
+{
+ luaL_where (L, 1);
+ lua_pushstring (L, str);
+ lua_concat (L, 2);
+}
+
+/* Push a formatted string generated from FMT and following args on
+ the Lua stack, like lua_pushfstring, but prefixed with the the
+ location of the innermost Lua call-point (as formated by luaL_where). */
+SWIGRUNTIME void
+SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
+{
+ va_list argp;
+ va_start(argp, fmt);
+ luaL_where(L, 1);
+ lua_pushvfstring(L, fmt, argp);
+ va_end(argp);
+ lua_concat(L, 2);
+}
+
+
+/* -----------------------------------------------------------------------------
+ * global swig types
+ * ----------------------------------------------------------------------------- */
+/* Constant table */
+#define SWIG_LUA_INT 1
+#define SWIG_LUA_FLOAT 2
+#define SWIG_LUA_STRING 3
+#define SWIG_LUA_POINTER 4
+#define SWIG_LUA_BINARY 5
+#define SWIG_LUA_CHAR 6
+
+/* Structure for variable linking table */
+typedef struct {
+ const char *name;
+ lua_CFunction get;
+ lua_CFunction set;
+} swig_lua_var_info;
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+typedef const LUA_REG_TYPE swig_lua_method;
+typedef const LUA_REG_TYPE swig_lua_const_info;
+#else /* Normal lua */
+typedef luaL_Reg swig_lua_method;
+
+/* Constant information structure */
+typedef struct {
+ int type;
+ char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+} swig_lua_const_info;
+
+#endif
+
+typedef struct {
+ const char *name;
+ lua_CFunction getmethod;
+ lua_CFunction setmethod;
+} swig_lua_attribute;
+
+
+struct swig_lua_class;
+/* Can be used to create namespaces. Currently used to wrap class static methods/variables/constants */
+typedef struct swig_lua_namespace {
+ const char *name;
+ swig_lua_method *ns_methods;
+ swig_lua_attribute *ns_attributes;
+ swig_lua_const_info *ns_constants;
+ struct swig_lua_class **ns_classes;
+ struct swig_lua_namespace **ns_namespaces;
+} swig_lua_namespace;
+
+typedef struct swig_lua_class {
+ const char *name; /* Name that this class has in Lua */
+ const char *fqname; /* Fully qualified name - Scope + class name */
+ swig_type_info **type;
+ lua_CFunction constructor;
+ void (*destructor)(void *);
+ swig_lua_method *methods;
+ swig_lua_attribute *attributes;
+ swig_lua_namespace *cls_static;
+ swig_lua_method *metatable; /* 0 for -eluac */
+ struct swig_lua_class **bases;
+ const char **base_names;
+} swig_lua_class;
+
+/* this is the struct for wrapping all pointers in SwigLua
+*/
+typedef struct {
+ swig_type_info *type;
+ int own; /* 1 if owned & must be destroyed */
+ void *ptr;
+} swig_lua_userdata;
+
+/* this is the struct for wrapping arbitrary packed binary data
+(currently it is only used for member function pointers)
+the data ordering is similar to swig_lua_userdata, but it is currently not possible
+to tell the two structures apart within SWIG, other than by looking at the type
+*/
+typedef struct {
+ swig_type_info *type;
+ int own; /* 1 if owned & must be destroyed */
+ char data[1]; /* arbitary amount of data */
+} swig_lua_rawdata;
+
+/* Common SWIG API */
+#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
+#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
+#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
+#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
+
+/* Runtime API */
+#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
+#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
+#define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
+
+/* Contract support */
+#define SWIG_contract_assert(expr, msg) \
+ if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
+
+
+/* helper #defines */
+#define SWIG_fail {goto fail;}
+#define SWIG_fail_arg(func_name,argnum,type) \
+ {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
+ func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
+ goto fail;}
+#define SWIG_fail_ptr(func_name,argnum,type) \
+ SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
+#define SWIG_check_num_args(func_name,a,b) \
+ if (lua_gettop(L)<a || lua_gettop(L)>b) \
+ {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
+ goto fail;}
+
+
+#define SWIG_Lua_get_table(L,n) \
+ (lua_pushstring(L, n), lua_rawget(L,-2))
+
+#define SWIG_Lua_add_function(L,n,f) \
+ (lua_pushstring(L, n), \
+ lua_pushcfunction(L, f), \
+ lua_rawset(L,-3))
+
+#define SWIG_Lua_add_boolean(L,n,b) \
+ (lua_pushstring(L, n), \
+ lua_pushboolean(L, b), \
+ lua_rawset(L,-3))
+
+/* special helper for allowing 'nil' for usertypes */
+#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
+
+#ifdef __cplusplus
+/* Special helper for member function pointers
+it gets the address, casts it, then dereferences it */
+/*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */
+#endif
+
+/* storing/access of swig_module_info */
+SWIGRUNTIME swig_module_info *
+SWIG_Lua_GetModule(lua_State *L) {
+ swig_module_info *ret = 0;
+ lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+ lua_rawget(L,LUA_REGISTRYINDEX);
+ if (lua_islightuserdata(L,-1))
+ ret=(swig_module_info*)lua_touserdata(L,-1);
+ lua_pop(L,1); /* tidy */
+ return ret;
+}
+
+SWIGRUNTIME void
+SWIG_Lua_SetModule(lua_State *L, swig_module_info *module) {
+ /* add this all into the Lua registry: */
+ lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+ lua_pushlightuserdata(L,(void*)module);
+ lua_rawset(L,LUA_REGISTRYINDEX);
+}
+
+/* -----------------------------------------------------------------------------
+ * global variable support code: modules
+ * ----------------------------------------------------------------------------- */
+
+/* this function is called when trying to set an immutable.
+default action is to print an error.
+This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
+SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L)
+{
+/* there should be 1 param passed in: the new value */
+#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
+ lua_pop(L,1); /* remove it */
+ luaL_error(L,"This variable is immutable");
+#endif
+ return 0; /* should not return anything */
+}
+
+#ifdef SWIG_LUA_ELUA_EMULATE
+
+SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own);
+SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type);
+static int swig_lua_elua_emulate_unique_key;
+
+/* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */
+SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table)
+{
+ int i, table_parsed, parsed_tables_array, target_table;
+ assert(lua_istable(L,-1));
+ target_table = lua_gettop(L);
+ /* Get the registry where we put all parsed tables to avoid loops */
+ lua_rawgetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
+ if(lua_isnil(L,-1)) {
+ lua_pop(L,1);
+ lua_newtable(L);
+ lua_pushvalue(L,-1);
+ lua_rawsetp(L,LUA_REGISTRYINDEX,(void*)(&swig_lua_elua_emulate_unique_key));
+ }
+ parsed_tables_array = lua_gettop(L);
+ lua_pushvalue(L,target_table);
+ lua_rawsetp(L, parsed_tables_array, table);
+ table_parsed = 0;
+ const int SWIGUNUSED pairs_start = lua_gettop(L);
+ for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++)
+ {
+ const swig_elua_entry *entry = table + i;
+ int is_metatable = 0;
+ switch(entry->key.type) {
+ case LUA_TSTRING:
+ lua_pushstring(L,entry->key.key.strkey);
+ if(strcmp(entry->key.key.strkey, SWIG_LUA_ELUA_EMUL_METATABLE_KEY) == 0)
+ is_metatable = 1;
+ break;
+ case LUA_TNUMBER:
+ lua_pushnumber(L,entry->key.key.numkey);
+ break;
+ case LUA_TNIL:
+ lua_pushnil(L);
+ break;
+ default:
+ assert(0);
+ }
+ switch(entry->value.type) {
+ case LUA_TSTRING:
+ lua_pushstring(L,entry->value.value.string);
+ break;
+ case LUA_TNUMBER:
+ lua_pushnumber(L,entry->value.value.number);
+ break;
+ case LUA_TFUNCTION:
+ lua_pushcfunction(L,entry->value.value.function);
+ break;
+ case LUA_TTABLE:
+ lua_rawgetp(L,parsed_tables_array, entry->value.value.table);
+ table_parsed = !lua_isnil(L,-1);
+ if(!table_parsed) {
+ lua_pop(L,1); /*remove nil */
+ lua_newtable(L);
+ SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
+ }
+ if(is_metatable) {
+ assert(lua_istable(L,-1));
+ lua_pushvalue(L,-1);
+ lua_setmetatable(L,target_table);
+ }
+
+ break;
+ case LUA_TUSERDATA:
+ if(entry->value.value.userdata.member)
+ SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
+ entry->value.value.userdata.lvalue,
+ *(entry->value.value.userdata.ptype));
+ else
+ SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
+ *(entry->value.value.userdata.ptype),0);
+ break;
+ case LUA_TNIL:
+ lua_pushnil(L);
+ break;
+ default:
+ assert(0);
+ }
+ assert(lua_gettop(L) == pairs_start + 2);
+ lua_rawset(L,target_table);
+ }
+ lua_pop(L,1); /* Removing parsed tables storage */
+ assert(lua_gettop(L) == target_table);
+}
+
+SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L)
+{
+ lua_pushnil(L);
+ lua_rawsetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
+}
+
+SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L);
+
+SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
+{
+ SWIG_check_num_args("getmetatable(SWIG eLua emulation)", 1, 1);
+ SWIG_Lua_get_class_registry(L);
+ lua_getfield(L,-1,"lua_getmetatable");
+ lua_remove(L,-2); /* remove the registry*/
+ assert(!lua_isnil(L,-1));
+ lua_pushvalue(L,1);
+ assert(lua_gettop(L) == 3); /* object | function | object again */
+ lua_call(L,1,1);
+ if(!lua_isnil(L,-1)) /*There is an ordinary metatable */
+ return 1;
+ /*if it is a table, then emulate elua behaviour - check for __metatable attribute of a table*/
+ assert(lua_gettop(L) == 2);
+ if(lua_istable(L,-2)) {
+ lua_pop(L,1); /*remove the nil*/
+ lua_getfield(L,-1, SWIG_LUA_ELUA_EMUL_METATABLE_KEY);
+ }
+ assert(lua_gettop(L) == 2);
+ return 1;
+
+fail:
+ lua_error(L);
+ return 0;
+}
+
+SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
+{
+ SWIG_Lua_get_class_registry(L);
+ lua_pushglobaltable(L);
+ lua_pushstring(L,"lua_getmetatable");
+ lua_getfield(L,-2,"getmetatable");
+ assert(!lua_isnil(L,-1));
+ lua_rawset(L,-4);
+ lua_pushstring(L, "getmetatable");
+ lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
+ lua_rawset(L,-3);
+ lua_pop(L,2);
+
+}
+/* END OF REMOVE */
+
+#endif
+/* -----------------------------------------------------------------------------
+ * global variable support code: namespaces and modules (which are the same thing)
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L)
+{
+/* there should be 2 params passed in
+ (1) table (not the meta table)
+ (2) string name of the attribute
+*/
+ assert(lua_istable(L,-2)); /* just in case */
+ lua_getmetatable(L,-2);
+ assert(lua_istable(L,-1));
+ SWIG_Lua_get_table(L,".get"); /* find the .get table */
+ assert(lua_istable(L,-1));
+ /* look for the key in the .get table */
+ lua_pushvalue(L,2); /* key */
+ lua_rawget(L,-2);
+ lua_remove(L,-2); /* stack tidy, remove .get table */
+ if (lua_iscfunction(L,-1))
+ { /* found it so call the fn & return its value */
+ lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */
+ lua_remove(L,-2); /* stack tidy, remove metatable */
+ return 1;
+ }
+ lua_pop(L,1); /* remove whatever was there */
+ /* ok, so try the .fn table */
+ SWIG_Lua_get_table(L,".fn"); /* find the .get table */
+ assert(lua_istable(L,-1)); /* just in case */
+ lua_pushvalue(L,2); /* key */
+ lua_rawget(L,-2); /* look for the fn */
+ lua_remove(L,-2); /* stack tidy, remove .fn table */
+ if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
+ { /* found it so return the fn & let lua call it */
+ lua_remove(L,-2); /* stack tidy, remove metatable */
+ return 1;
+ }
+ lua_pop(L,1); /* remove whatever was there */
+ return 0;
+}
+
+SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L)
+{
+/* there should be 3 params passed in
+ (1) table (not the meta table)
+ (2) string name of the attribute
+ (3) any for the new value
+*/
+
+ assert(lua_istable(L,1));
+ lua_getmetatable(L,1); /* get the meta table */
+ assert(lua_istable(L,-1));
+
+ SWIG_Lua_get_table(L,".set"); /* find the .set table */
+ if (lua_istable(L,-1))
+ {
+ /* look for the key in the .set table */
+ lua_pushvalue(L,2); /* key */
+ lua_rawget(L,-2);
+ if (lua_iscfunction(L,-1))
+ { /* found it so call the fn & return its value */
+ lua_pushvalue(L,3); /* value */
+ lua_call(L,1,0);
+ return 0;
+ }
+ lua_pop(L,1); /* remove the value */
+ }
+ lua_pop(L,1); /* remove the value .set table */
+ lua_pop(L,1); /* remote metatable */
+ lua_rawset(L,-3);
+ return 0;
+}
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
+SWIGINTERN void SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]); /* forward declaration */
+SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn); /* forward declaration */
+SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss);
+
+/* helper function - register namespace methods and attributes into namespace */
+SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns)
+{
+ int i;
+ /* There must be namespace table (not metatable) at the top of the stack */
+ assert(lua_istable(L,-1));
+ SWIG_Lua_InstallConstants(L, ns->ns_constants);
+
+ /* add methods to the namespace/module table */
+ for(i=0;ns->ns_methods[i].name;i++){
+ SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].func);
+ }
+ lua_getmetatable(L,-1);
+
+ /* add fns */
+ for(i=0;ns->ns_attributes[i].name;i++){
+ SWIG_Lua_add_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
+ }
+
+ /* clear stack - remove metatble */
+ lua_pop(L,1);
+ return 0;
+}
+
+/* Register all classes in the namespace */
+SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns)
+{
+ swig_lua_class **classes;
+
+ /* There must be a module/namespace table at the top of the stack */
+ assert(lua_istable(L,-1));
+
+ classes = ns->ns_classes;
+
+ if( classes != 0 ) {
+ while(*classes != 0) {
+ SWIG_Lua_class_register(L, *classes);
+ classes++;
+ }
+ }
+}
+
+/* Helper function. Creates namespace table and adds it to module table
+ if 'reg' is true, then will register namespace table to parent one (must be on top of the stack
+ when function is called).
+ Function always returns newly registered table on top of the stack.
+*/
+SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg)
+{
+ swig_lua_namespace **sub_namespace;
+ /* 1 argument - table on the top of the stack */
+ const int SWIGUNUSED begin = lua_gettop(L);
+ assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table or parent namespace table */
+ lua_checkstack(L,5);
+ lua_newtable(L); /* namespace itself */
+ lua_newtable(L); /* metatable for namespace */
+
+ /* add a table called ".get" */
+ lua_pushstring(L,".get");
+ lua_newtable(L);
+ lua_rawset(L,-3);
+ /* add a table called ".set" */
+ lua_pushstring(L,".set");
+ lua_newtable(L);
+ lua_rawset(L,-3);
+ /* add a table called ".fn" */
+ lua_pushstring(L,".fn");
+ lua_newtable(L);
+ lua_rawset(L,-3);
+
+ /* add accessor fns for using the .get,.set&.fn */
+ SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
+ SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
+
+ lua_setmetatable(L,-2); /* set metatable */
+
+ /* Register all functions, variables etc */
+ SWIG_Lua_add_namespace_details(L,ns);
+ /* Register classes */
+ SWIG_Lua_add_namespace_classes(L,ns);
+
+ sub_namespace = ns->ns_namespaces;
+ if( sub_namespace != 0) {
+ while(*sub_namespace != 0) {
+ SWIG_Lua_namespace_register(L, *sub_namespace, 1);
+ lua_pop(L,1); /* removing sub-namespace table */
+ sub_namespace++;
+ }
+ }
+
+ if (reg) {
+ lua_pushstring(L,ns->name);
+ lua_pushvalue(L,-2);
+ lua_rawset(L,-4); /* add namespace to module table */
+ }
+ assert(lua_gettop(L) == begin+1);
+}
+#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
+
+/* -----------------------------------------------------------------------------
+ * global variable support code: classes
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname);
+
+typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
+
+SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type,
+ int first_arg, swig_lua_base_iterator_func func, int *const ret)
+{
+ /* first_arg - position of the object in stack. Everything that is above are arguments
+ * and is passed to every evocation of the func */
+ int last_arg = lua_gettop(L);/* position of last argument */
+ int original_metatable = last_arg + 1;
+ size_t bases_count;
+ int result = SWIG_ERROR;
+ int bases_table;
+ (void)swig_type;
+ lua_getmetatable(L,first_arg);
+
+ /* initialise base search */
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+ SWIG_Lua_get_table(L,".bases");
+ assert(lua_istable(L,-1));
+ bases_count = lua_rawlen(L,-1);
+ bases_table = lua_gettop(L);
+#else
+ /* In elua .bases table doesn't exist. Use table from swig_lua_class */
+ (void)bases_table;
+ assert(swig_type!=0);
+ swig_module_info *module=SWIG_GetModule(L);
+ swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases;
+ const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names;
+ bases_count = 0;
+ for(;base_names[bases_count];
+ bases_count++);/* get length of bases */
+#endif
+
+ if(ret)
+ *ret = 0;
+ if(bases_count>0)
+ {
+ int to_remove;
+ size_t i;
+ int j;
+ int subcall_last_arg;
+ int subcall_first_arg = lua_gettop(L) + 1;/* Here a copy of first_arg and arguments begin */
+ int valid = 1;
+ swig_type_info *base_swig_type = 0;
+ for(j=first_arg;j<=last_arg;j++)
+ lua_pushvalue(L,j);
+ subcall_last_arg = lua_gettop(L);
+
+ /* Trick: temporarily replacing original metatable with metatable for base class and call getter */
+ for(i=0;i<bases_count;i++) {
+ /* Iteration through class bases */
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+ lua_rawgeti(L,bases_table,i+1);
+ base_swig_type = 0;
+ if(lua_isnil(L,-1)) {
+ valid = 0;
+ lua_pop(L,1);
+ } else {
+ valid = 1;
+ }
+#else /* In elua .bases table doesn't exist. Use table from swig_lua_class */
+ swig_lua_class *base_class = bases[i];
+ if(!base_class) {
+ valid = 0;
+ } else {
+ valid = 1;
+ SWIG_Lua_get_class_metatable(L,base_class->fqname);
+ base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]);
+ assert(base_swig_type != 0);
+ }
+#endif
+
+ if(!valid)
+ continue;
+ assert(lua_isuserdata(L, subcall_first_arg));
+ assert(lua_istable(L,-1));
+ lua_setmetatable(L,subcall_first_arg); /* Set new metatable */
+ assert(lua_gettop(L) == subcall_last_arg);
+ result = func(L, base_swig_type,subcall_first_arg, ret); /* Forward call */
+ if(result != SWIG_ERROR) {
+ break;
+ }
+ }
+ /* Restore original metatable */
+ lua_pushvalue(L,original_metatable);
+ lua_setmetatable(L,first_arg);
+ /* Clear - remove everything between last_arg and subcall_last_arg including */
+ to_remove = subcall_last_arg - last_arg;
+ for(j=0;j<to_remove;j++)
+ lua_remove(L,last_arg+1);
+ } else {
+ /* Remove everything after last_arg */
+ lua_pop(L, lua_gettop(L) - last_arg);
+ }
+ if(ret) assert(lua_gettop(L) == last_arg + *ret);
+ return result;
+}
+
+/* The class.get method helper, performs the lookup of class attributes.
+ * It returns an error code. Number of function return values is passed inside 'ret'.
+ * first_arg is not used in this function because function always has 2 arguments.
+ */
+SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
+{
+/* there should be 2 params passed in
+ (1) userdata (not the meta table)
+ (2) string name of the attribute
+*/
+ int bases_search_result;
+ int substack_start = lua_gettop(L)-2;
+ assert(first_arg == substack_start+1);
+ lua_checkstack(L,5);
+ assert(lua_isuserdata(L,-2)); /* just in case */
+ lua_getmetatable(L,-2); /* get the meta table */
+ assert(lua_istable(L,-1)); /* just in case */
+ SWIG_Lua_get_table(L,".get"); /* find the .get table */
+ assert(lua_istable(L,-1)); /* just in case */
+ /* look for the key in the .get table */
+ lua_pushvalue(L,substack_start+2); /* key */
+ lua_rawget(L,-2);
+ lua_remove(L,-2); /* stack tidy, remove .get table */
+ if (lua_iscfunction(L,-1))
+ { /* found it so call the fn & return its value */
+ lua_pushvalue(L,substack_start+1); /* the userdata */
+ lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
+ lua_remove(L,-2); /* stack tidy, remove metatable */
+ if(ret)
+ *ret = 1;
+ return SWIG_OK;
+ }
+ lua_pop(L,1); /* remove whatever was there */
+ /* ok, so try the .fn table */
+ SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
+ assert(lua_istable(L,-1)); /* just in case */
+ lua_pushvalue(L,substack_start+2); /* key */
+ lua_rawget(L,-2); /* look for the fn */
+ lua_remove(L,-2); /* stack tidy, remove .fn table */
+ if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
+ { /* found it so return the fn & let lua call it */
+ lua_remove(L,-2); /* stack tidy, remove metatable */
+ if(ret)
+ *ret = 1;
+ return SWIG_OK;
+ }
+ lua_pop(L,1); /* remove whatever was there */
+ /* NEW: looks for the __getitem() fn
+ this is a user provided get fn */
+ SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
+ if (lua_iscfunction(L,-1)) /* if its there */
+ { /* found it so call the fn & return its value */
+ lua_pushvalue(L,substack_start+1); /* the userdata */
+ lua_pushvalue(L,substack_start+2); /* the parameter */
+ lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
+ lua_remove(L,-2); /* stack tidy, remove metatable */
+ if(ret) *ret = 1;
+ return SWIG_OK;
+ }
+ lua_pop(L,1);
+ /* Remove the metatable */
+ lua_pop(L,1);
+ /* Search in base classes */
+ bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret);
+ return bases_search_result; /* sorry not known */
+}
+
+/* the class.get method, performs the lookup of class attributes
+ */
+SWIGINTERN int SWIG_Lua_class_get(lua_State *L)
+{
+/* there should be 2 params passed in
+ (1) userdata (not the meta table)
+ (2) string name of the attribute
+*/
+ int result;
+ swig_lua_userdata *usr;
+ swig_type_info *type;
+ int ret = 0;
+ assert(lua_isuserdata(L,1));
+ usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
+ type = usr->type;
+ result = SWIG_Lua_class_do_get(L,type,1,&ret);
+ if(result == SWIG_OK)
+ return ret;
+
+ return 0;
+}
+
+/* helper for the class.set method, performs the lookup of class attributes
+ * It returns error code. Number of function return values is passed inside 'ret'
+ */
+SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret)
+{
+/* there should be 3 params passed in
+ (1) table (not the meta table)
+ (2) string name of the attribute
+ (3) any for the new value
+ */
+
+ int bases_search_result;
+ int substack_start = lua_gettop(L) - 3;
+ lua_checkstack(L,5);
+ assert(lua_isuserdata(L,substack_start+1)); /* just in case */
+ lua_getmetatable(L,substack_start+1); /* get the meta table */
+ assert(lua_istable(L,-1)); /* just in case */
+ if(ret)
+ *ret = 0; /* it is setter - number of return values is always 0 */
+
+ SWIG_Lua_get_table(L,".set"); /* find the .set table */
+ if (lua_istable(L,-1))
+ {
+ /* look for the key in the .set table */
+ lua_pushvalue(L,substack_start+2); /* key */
+ lua_rawget(L,-2);
+ lua_remove(L,-2); /* tidy stack, remove .set table */
+ if (lua_iscfunction(L,-1))
+ { /* found it so call the fn & return its value */
+ lua_pushvalue(L,substack_start+1); /* userdata */
+ lua_pushvalue(L,substack_start+3); /* value */
+ lua_call(L,2,0);
+ lua_remove(L,substack_start+4); /*remove metatable*/
+ return SWIG_OK;
+ }
+ lua_pop(L,1); /* remove the value */
+ } else {
+ lua_pop(L,1); /* remove the answer for .set table request*/
+ }
+ /* NEW: looks for the __setitem() fn
+ this is a user provided set fn */
+ SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
+ if (lua_iscfunction(L,-1)) /* if its there */
+ { /* found it so call the fn & return its value */
+ lua_pushvalue(L,substack_start+1); /* the userdata */
+ lua_pushvalue(L,substack_start+2); /* the parameter */
+ lua_pushvalue(L,substack_start+3); /* the value */
+ lua_call(L,3,0); /* 3 values in ,0 out */
+ lua_remove(L,-2); /* stack tidy, remove metatable */
+ return SWIG_OK;
+ }
+ lua_pop(L,1); /* remove value */
+
+ lua_pop(L,1); /* remove metatable */
+ /* Search among bases */
+ bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret);
+ if(ret)
+ assert(*ret == 0);
+ assert(lua_gettop(L) == substack_start + 3);
+ return bases_search_result;
+}
+
+/* This is the actual method exported to Lua. It calls SWIG_Lua_class_do_set and correctly
+ * handles return values.
+ */
+SWIGINTERN int SWIG_Lua_class_set(lua_State *L)
+{
+/* There should be 3 params passed in
+ (1) table (not the meta table)
+ (2) string name of the attribute
+ (3) any for the new value
+ */
+ int ret = 0;
+ int result;
+ swig_lua_userdata *usr;
+ swig_type_info *type;
+ assert(lua_isuserdata(L,1));
+ usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
+ type = usr->type;
+ result = SWIG_Lua_class_do_set(L,type,1,&ret);
+ if(result != SWIG_OK) {
+ SWIG_Lua_pushferrstring(L,"Assignment not possible. No setter/member with this name. For custom assignments implement __setitem method.");
+ lua_error(L);
+ } else {
+ assert(ret==0);
+ }
+ return 0;
+}
+
+/* the class.destruct method called by the interpreter */
+SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L)
+{
+/* there should be 1 params passed in
+ (1) userdata (not the meta table) */
+ swig_lua_userdata *usr;
+ swig_lua_class *clss;
+ assert(lua_isuserdata(L,-1)); /* just in case */
+ usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
+ /* if must be destroyed & has a destructor */
+ if (usr->own) /* if must be destroyed */
+ {
+ clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
+ if (clss && clss->destructor) /* there is a destroy fn */
+ {
+ clss->destructor(usr->ptr); /* bye bye */
+ }
+ }
+ return 0;
+}
+
+/* the class.__tostring method called by the interpreter and print */
+SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
+{
+/* there should be 1 param passed in
+ (1) userdata (not the metatable) */
+ const char *className;
+ void* userData;
+ assert(lua_isuserdata(L,1)); /* just in case */
+ userData = lua_touserdata(L,1); /* get the userdata address for later */
+ lua_getmetatable(L,1); /* get the meta table */
+ assert(lua_istable(L,-1)); /* just in case */
+
+ lua_getfield(L, -1, ".type");
+ className = lua_tostring(L, -1);
+
+ lua_pushfstring(L, "<%s userdata: %p>", className, userData);
+ return 1;
+}
+
+/* to manually disown some userdata */
+SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
+{
+/* there should be 1 params passed in
+ (1) userdata (not the meta table) */
+ swig_lua_userdata *usr;
+ assert(lua_isuserdata(L,-1)); /* just in case */
+ usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
+
+ usr->own = 0; /* clear our ownership */
+ return 0;
+}
+
+/* lua callable function to compare userdata's value
+the issue is that two userdata may point to the same thing
+but to lua, they are different objects */
+SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L)
+{
+ int result;
+ swig_lua_userdata *usr1,*usr2;
+ if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
+ return 0; /* nil reply */
+ usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
+ usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
+ /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
+ result=(usr1->ptr==usr2->ptr);
+ lua_pushboolean(L,result);
+ return 1;
+}
+
+/* populate table at the top of the stack with metamethods that ought to be inherited */
+SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L)
+{
+ SWIG_Lua_add_boolean(L, "__add", 1);
+ SWIG_Lua_add_boolean(L, "__sub", 1);
+ SWIG_Lua_add_boolean(L, "__mul", 1);
+ SWIG_Lua_add_boolean(L, "__div", 1);
+ SWIG_Lua_add_boolean(L, "__mod", 1);
+ SWIG_Lua_add_boolean(L, "__pow", 1);
+ SWIG_Lua_add_boolean(L, "__unm", 1);
+ SWIG_Lua_add_boolean(L, "__len", 1 );
+ SWIG_Lua_add_boolean(L, "__concat", 1 );
+ SWIG_Lua_add_boolean(L, "__eq", 1);
+ SWIG_Lua_add_boolean(L, "__lt", 1);
+ SWIG_Lua_add_boolean(L, "__le", 1);
+ SWIG_Lua_add_boolean(L, "__call", 1);
+ SWIG_Lua_add_boolean(L, "__tostring", 1);
+ SWIG_Lua_add_boolean(L, "__gc", 0);
+}
+
+/* creates the swig registry */
+SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L)
+{
+ /* create main SWIG registry table */
+ lua_pushstring(L,"SWIG");
+ lua_newtable(L);
+ /* populate it with some predefined data */
+
+ /* .library table. Placeholder */
+ lua_pushstring(L,".library");
+ lua_newtable(L);
+ {
+ /* list of metamethods that class inherits from its bases */
+ lua_pushstring(L,"inheritable_metamethods");
+ lua_newtable(L);
+ /* populate with list of metamethods */
+ SWIG_Lua_populate_inheritable_metamethods(L);
+ lua_rawset(L,-3);
+ }
+ lua_rawset(L,-3);
+
+ lua_rawset(L,LUA_REGISTRYINDEX);
+}
+
+/* gets the swig registry (or creates it) */
+SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L)
+{
+ /* add this all into the swig registry: */
+ lua_pushstring(L,"SWIG");
+ lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
+ if (!lua_istable(L,-1)) /* not there */
+ { /* must be first time, so add it */
+ lua_pop(L,1); /* remove the result */
+ SWIG_Lua_create_class_registry(L);
+ /* then get it */
+ lua_pushstring(L,"SWIG");
+ lua_rawget(L,LUA_REGISTRYINDEX);
+ }
+}
+
+SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L)
+{
+ SWIG_Lua_get_class_registry(L);
+ lua_pushstring(L, ".library");
+ lua_rawget(L,-2);
+ assert( !lua_isnil(L,-1) );
+ lua_pushstring(L, "inheritable_metamethods");
+ lua_rawget(L,-2);
+
+ /* Remove class registry and library table */
+ lua_remove(L,-2);
+ lua_remove(L,-2);
+}
+
+/* Helper function to get the classes metatable from the register */
+SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
+{
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L,cname); /* get the name */
+ lua_rawget(L,-2); /* get it */
+ lua_remove(L,-2); /* tidy up (remove registry) */
+}
+
+/* Set up the base classes pointers.
+Each class structure has a list of pointers to the base class structures.
+This function fills them.
+It cannot be done at compile time, as this will not work with hireachies
+spread over more than one swig file.
+Therefore it must be done at runtime, querying the SWIG type system.
+*/
+SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
+{
+ int i=0;
+ swig_module_info *module=SWIG_GetModule(L);
+ for(i=0;clss->base_names[i];i++)
+ {
+ if (clss->bases[i]==0) /* not found yet */
+ {
+ /* lookup and cache the base class */
+ swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
+ if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
+ }
+ }
+}
+
+#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+/* Merges two tables */
+SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source)
+{
+ /* iterating */
+ lua_pushnil(L);
+ while (lua_next(L,source) != 0) {
+ /* -1 - value, -2 - index */
+ /* have to copy to assign */
+ lua_pushvalue(L,-2); /* copy of index */
+ lua_pushvalue(L,-2); /* copy of value */
+ lua_rawset(L, target);
+ lua_pop(L,1);
+ /* only key is left */
+ }
+}
+
+/* Merges two tables with given name. original - index of target metatable, base - index of source metatable */
+SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char* name, int original, int base)
+{
+ /* push original[name], then base[name] */
+ lua_pushstring(L,name);
+ lua_rawget(L,original);
+ int original_table = lua_gettop(L);
+ lua_pushstring(L,name);
+ lua_rawget(L,base);
+ int base_table = lua_gettop(L);
+ SWIG_Lua_merge_tables_by_index(L, original_table, base_table);
+ /* clearing stack */
+ lua_pop(L,2);
+}
+
+/* Function takes all symbols from base and adds it to derived class. It's just a helper. */
+SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls)
+{
+ /* There is one parameter - original, i.e. 'derived' class metatable */
+ assert(lua_istable(L,-1));
+ int original = lua_gettop(L);
+ SWIG_Lua_get_class_metatable(L,base_cls->fqname);
+ int base = lua_gettop(L);
+ SWIG_Lua_merge_tables(L, ".fn", original, base );
+ SWIG_Lua_merge_tables(L, ".set", original, base );
+ SWIG_Lua_merge_tables(L, ".get", original, base );
+ lua_pop(L,1);
+}
+
+/* Function squashes all symbols from 'clss' bases into itself */
+SWIGINTERN void SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss)
+{
+ int i;
+ SWIG_Lua_get_class_metatable(L,clss->fqname);
+ for(i=0;clss->base_names[i];i++)
+ {
+ if (clss->bases[i]==0) /* Somehow it's not found. Skip it */
+ continue;
+ /* Thing is: all bases are already registered. Thus they have already executed
+ * this function. So we just need to squash them into us, because their bases
+ * are already squashed into them. No need for recursion here!
+ */
+ SWIG_Lua_class_squash_base(L, clss->bases[i]);
+ }
+ lua_pop(L,1); /*tidy stack*/
+}
+#endif
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
+/* helper add a variable to a registered class */
+SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn)
+{
+ assert(lua_istable(L,-1)); /* just in case */
+ SWIG_Lua_get_table(L,".get"); /* find the .get table */
+ assert(lua_istable(L,-1)); /* just in case */
+ SWIG_Lua_add_function(L,name,getFn);
+ lua_pop(L,1); /* tidy stack (remove table) */
+ if (setFn)
+ {
+ SWIG_Lua_get_table(L,".set"); /* find the .set table */
+ assert(lua_istable(L,-1)); /* just in case */
+ SWIG_Lua_add_function(L,name,setFn);
+ lua_pop(L,1); /* tidy stack (remove table) */
+ }
+}
+
+/* helper to recursively add class static details (static attributes, operations and constants) */
+SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss)
+{
+ int i = 0;
+ /* The class namespace table must be on the top of the stack */
+ assert(lua_istable(L,-1));
+ /* call all the base classes first: we can then override these later: */
+ for(i=0;clss->bases[i];i++)
+ {
+ SWIG_Lua_add_class_static_details(L,clss->bases[i]);
+ }
+
+ SWIG_Lua_add_namespace_details(L, clss->cls_static);
+}
+
+SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss); /* forward declaration */
+
+/* helper to recursively add class details (attributes & operations) */
+SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss)
+{
+ int i;
+ size_t bases_count = 0;
+ /* Add bases to .bases table */
+ SWIG_Lua_get_table(L,".bases");
+ assert(lua_istable(L,-1)); /* just in case */
+ for(i=0;clss->bases[i];i++)
+ {
+ SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
+ /* Base class must be already registered */
+ assert(lua_istable(L,-1));
+ lua_rawseti(L,-2,i+1); /* In lua indexing starts from 1 */
+ bases_count++;
+ }
+ assert(lua_rawlen(L,-1) == bases_count);
+ lua_pop(L,1); /* remove .bases table */
+ /* add attributes */
+ for(i=0;clss->attributes[i].name;i++){
+ SWIG_Lua_add_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
+ }
+ /* add methods to the metatable */
+ SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
+ assert(lua_istable(L,-1)); /* just in case */
+ for(i=0;clss->methods[i].name;i++){
+ SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].func);
+ }
+ lua_pop(L,1); /* tidy stack (remove table) */
+ /* add operator overloads
+ This adds methods from metatable array to metatable. Can mess up garbage
+ collectind if someone defines __gc method
+ */
+ if(clss->metatable) {
+ for(i=0;clss->metatable[i].name;i++) {
+ SWIG_Lua_add_function(L,clss->metatable[i].name,clss->metatable[i].func);
+ }
+ }
+
+#if !defined(SWIG_LUA_SQUASH_BASES)
+ /* Adding metamethods that are defined in base classes. If bases were squashed
+ * then it is obviously unnecessary
+ */
+ SWIG_Lua_add_class_user_metamethods(L, clss);
+#endif
+}
+
+/* Helpers to add user defined class metamedhods - __add, __sub etc. The helpers are needed
+ for the following issue: Lua runtime checks for metamethod existence with rawget function
+ ignoring our SWIG-provided __index and __newindex functions. Thus our inheritance-aware method
+ search algorithm doesn't work in such case. (Not to say that Lua runtime queries metamethod directly
+ in metatable and not in object).
+ Current solution is this: if somewhere in hierarchy metamethod __x is defined, then all descendants
+ are automatically given a special proxy __x that calls the real __x method.
+ Obvious idea - to copy __x instead of creating __x-proxy is wrong because if someone changes __x in runtime,
+ those changes must be reflected in all descendants.
+*/
+
+SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/
+
+/* The real function that resolves a metamethod.
+ * Function searches given class and all it's bases(recursively) for first instance of something that is
+ * not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation
+ * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
+ * answer.
+ * Returns 1 if found, 0 otherwise.
+ * clss is class which metatable we will search for method
+ * metamethod_name_idx is index in L where metamethod name (as string) lies
+ * skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check
+ * is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from
+ * SWIG_Lua_resolve_metamethod
+ * */
+SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
+ int skip_check)
+{
+ /* This function is called recursively */
+ int result = 0;
+ int i = 0;
+
+ if (!skip_check) {
+ SWIG_Lua_get_class_metatable(L, clss->fqname);
+ lua_pushvalue(L, metamethod_name_idx);
+ lua_rawget(L,-2);
+ /* If this is cfunction and it is equal to SWIG_Lua_resolve_metamethod then
+ * this isn't the function we are looking for :)
+ * lua_tocfunction will return NULL if not cfunction
+ */
+ if (!lua_isnil(L,-1) && lua_tocfunction(L,-1) != SWIG_Lua_resolve_metamethod ) {
+ lua_remove(L,-2); /* removing class metatable */
+ return 1;
+ }
+ lua_pop(L,2); /* remove class metatable and query result */
+ }
+
+ /* Forwarding calls to bases */
+ for(i=0;clss->bases[i];i++)
+ {
+ result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0);
+ if (result)
+ break;
+ }
+
+ return result;
+}
+
+/* The proxy function for metamethod. All parameters are passed as cclosure. Searches for actual method
+ * and calls it */
+SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
+{
+ int numargs;
+ int metamethod_name_idx;
+ const swig_lua_class* clss;
+ int result;
+
+ lua_checkstack(L,5);
+ numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
+
+ /* Get upvalues from closure */
+ lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
+ metamethod_name_idx = lua_gettop(L);
+
+ lua_pushvalue(L, lua_upvalueindex(2));
+ clss = (const swig_lua_class*)(lua_touserdata(L,-1));
+ lua_pop(L,1); /* remove lightuserdata with clss from stack */
+
+ /* Actual work */
+ result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1);
+ if (!result) {
+ SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actual metamethod. Memory corruption is most likely explanation.");
+ lua_error(L);
+ return 0;
+ }
+
+ lua_remove(L,-2); /* remove metamethod key */
+ lua_insert(L,1); /* move function to correct position */
+ lua_call(L, numargs, LUA_MULTRET);
+ return lua_gettop(L); /* return all results */
+}
+
+
+/* If given metamethod must be present in given class, then creates appropriate proxy
+ * Returns 1 if successfully added, 0 if not added because no base class has it, -1
+ * if method is defined in the class metatable itself
+ */
+SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index)
+{
+ int key_index;
+ int success = 0;
+ int i = 0;
+
+ /* metamethod name - on the top of the stack */
+ assert(lua_isstring(L,-1));
+
+ key_index = lua_gettop(L);
+
+ /* Check whether method is already defined in metatable */
+ lua_pushvalue(L,key_index); /* copy of the key */
+ lua_gettable(L,metatable_index);
+ if( !lua_isnil(L,-1) ) {
+ lua_pop(L,1);
+ return -1;
+ }
+ lua_pop(L,1);
+
+ /* Iterating over immediate bases */
+ for(i=0;clss->bases[i];i++)
+ {
+ const swig_lua_class *base = clss->bases[i];
+ SWIG_Lua_get_class_metatable(L, base->fqname);
+ lua_pushvalue(L, key_index);
+ lua_rawget(L, -2);
+ if( !lua_isnil(L,-1) ) {
+ lua_pushvalue(L, key_index);
+
+ /* Add proxy function */
+ lua_pushvalue(L, key_index); /* first closure value is function name */
+ lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
+ lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
+
+ lua_rawset(L, metatable_index);
+ success = 1;
+ }
+ lua_pop(L,1); /* remove function or nil */
+ lua_pop(L,1); /* remove base class metatable */
+
+ if( success )
+ break;
+ }
+
+ return success;
+}
+
+SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
+{
+ int metatable_index;
+ int metamethods_info_index;
+ int tostring_undefined;
+ int eq_undefined = 0;
+
+ SWIG_Lua_get_class_metatable(L, clss->fqname);
+ metatable_index = lua_gettop(L);
+ SWIG_Lua_get_inheritable_metamethods(L);
+ assert(lua_istable(L,-1));
+ metamethods_info_index = lua_gettop(L);
+ lua_pushnil(L); /* first key */
+ while(lua_next(L, metamethods_info_index) != 0 ) {
+ /* key at index -2, value at index -1 */
+ const int is_inheritable = lua_toboolean(L,-2);
+ lua_pop(L,1); /* remove value - we don't need it anymore */
+
+ if(is_inheritable) { /* if metamethod is inheritable */
+ SWIG_Lua_add_class_user_metamethod(L,clss,metatable_index);
+ }
+ }
+
+ lua_pop(L,1); /* remove inheritable metatmethods table */
+
+ /* Special handling for __tostring method */
+ lua_pushstring(L, "__tostring");
+ lua_pushvalue(L,-1);
+ lua_rawget(L,metatable_index);
+ tostring_undefined = lua_isnil(L,-1);
+ lua_pop(L,1);
+ if( tostring_undefined ) {
+ lua_pushcfunction(L, SWIG_Lua_class_tostring);
+ lua_rawset(L, metatable_index);
+ } else {
+ lua_pop(L,1); /* remove copy of the key */
+ }
+
+ /* Special handling for __eq method */
+ lua_pushstring(L, "__eq");
+ lua_pushvalue(L,-1);
+ lua_rawget(L,metatable_index);
+ eq_undefined = lua_isnil(L,-1);
+ lua_pop(L,1);
+ if( eq_undefined ) {
+ lua_pushcfunction(L, SWIG_Lua_class_equal);
+ lua_rawset(L, metatable_index);
+ } else {
+ lua_pop(L,1); /* remove copy of the key */
+ }
+ /* Warning: __index and __newindex are SWIG-defined. For user-defined operator[]
+ * a __getitem/__setitem method should be defined
+ */
+ lua_pop(L,1); /* pop class metatable */
+}
+
+/* Register class static methods,attributes etc as well as constructor proxy */
+SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss)
+{
+ const int SWIGUNUSED begin = lua_gettop(L);
+ lua_checkstack(L,5); /* just in case */
+ assert(lua_istable(L,-1)); /* just in case */
+ assert(strcmp(clss->name, clss->cls_static->name) == 0); /* in class those 2 must be equal */
+
+ SWIG_Lua_namespace_register(L,clss->cls_static, 1);
+
+ assert(lua_istable(L,-1)); /* just in case */
+
+ /* add its constructor to module with the name of the class
+ so you can do MyClass(...) as well as new_MyClass(...)
+ BUT only if a constructor is defined
+ (this overcomes the problem of pure virtual classes without constructors)*/
+ if (clss->constructor)
+ {
+ lua_getmetatable(L,-1);
+ assert(lua_istable(L,-1)); /* just in case */
+ SWIG_Lua_add_function(L,"__call", clss->constructor);
+ lua_pop(L,1);
+ }
+
+ assert(lua_istable(L,-1)); /* just in case */
+ SWIG_Lua_add_class_static_details(L, clss);
+
+ /* clear stack */
+ lua_pop(L,1);
+ assert( lua_gettop(L) == begin );
+}
+
+/* Performs the instance (non-static) class registration process. Metatable for class is created
+ * and added to the class registry.
+ */
+SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss)
+{
+ const int SWIGUNUSED begin = lua_gettop(L);
+ int i;
+ /* if name already there (class is already registered) then do nothing */
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L,clss->fqname); /* get the name */
+ lua_rawget(L,-2);
+ if(!lua_isnil(L,-1)) {
+ lua_pop(L,2);
+ assert(lua_gettop(L)==begin);
+ return;
+ }
+ lua_pop(L,2); /* tidy stack */
+ /* Recursively initialize all bases */
+ for(i=0;clss->bases[i];i++)
+ {
+ SWIG_Lua_class_register_instance(L,clss->bases[i]);
+ }
+ /* Again, get registry and push name */
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L,clss->fqname); /* get the name */
+ lua_newtable(L); /* create the metatable */
+#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+ /* If squashing is requested, then merges all bases metatable into this one.
+ * It would get us all special methods: __getitem, __add etc.
+ * This would set .fn, .type, and other .xxx incorrectly, but we will overwrite it right away
+ */
+ {
+ int new_metatable_index = lua_absindex(L,-1);
+ for(i=0;clss->bases[i];i++)
+ {
+ int base_metatable;
+ SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
+ base_metatable = lua_absindex(L,-1);
+ SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable);
+ lua_pop(L,1);
+ }
+ }
+ /* And now we will overwrite all incorrectly set data */
+#endif
+ /* add string of class name called ".type" */
+ lua_pushstring(L,".type");
+ lua_pushstring(L,clss->fqname);
+ lua_rawset(L,-3);
+ /* add a table called bases */
+ lua_pushstring(L,".bases");
+ lua_newtable(L);
+ lua_rawset(L,-3);
+ /* add a table called ".get" */
+ lua_pushstring(L,".get");
+ lua_newtable(L);
+ lua_rawset(L,-3);
+ /* add a table called ".set" */
+ lua_pushstring(L,".set");
+ lua_newtable(L);
+ lua_rawset(L,-3);
+ /* add a table called ".fn" */
+ lua_pushstring(L,".fn");
+ lua_newtable(L);
+ /* add manual disown method */
+ SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
+ lua_rawset(L,-3);
+ /* add accessor fns for using the .get,.set&.fn */
+ SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
+ SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
+ SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
+ /* add it */
+ lua_rawset(L,-3); /* metatable into registry */
+ lua_pop(L,1); /* tidy stack (remove registry) */
+ assert(lua_gettop(L) == begin);
+
+#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+ /* Now merge all symbols from .fn, .set, .get etc from bases to our tables */
+ SWIG_Lua_class_squash_bases(L,clss);
+#endif
+ SWIG_Lua_get_class_metatable(L,clss->fqname);
+ SWIG_Lua_add_class_instance_details(L,clss); /* recursive adding of details (atts & ops) */
+ lua_pop(L,1); /* tidy stack (remove class metatable) */
+ assert( lua_gettop(L) == begin );
+}
+
+SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
+{
+ int SWIGUNUSED begin;
+ assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */
+ SWIG_Lua_class_register_instance(L,clss);
+ SWIG_Lua_class_register_static(L,clss);
+
+ /* Add links from static part to instance part and vice versa */
+ /* [SWIG registry] [Module]
+ * "MyClass" ----> [MyClass metatable] <===== "MyClass" -+> [static part]
+ * ".get" ----> ... | | getmetatable()----|
+ * ".set" ----> ... | | |
+ * ".static" --------------)----------------/ [static part metatable]
+ * | ".get" --> ...
+ * | ".set" --> ....
+ * |=============================== ".instance"
+ */
+ begin = lua_gettop(L);
+ lua_pushstring(L,clss->cls_static->name);
+ lua_rawget(L,-2); /* get class static table */
+ assert(lua_istable(L,-1));
+ lua_getmetatable(L,-1);
+ assert(lua_istable(L,-1)); /* get class static metatable */
+ lua_pushstring(L,".instance"); /* prepare key */
+
+ SWIG_Lua_get_class_metatable(L,clss->fqname); /* get class metatable */
+ assert(lua_istable(L,-1));
+ lua_pushstring(L,".static"); /* prepare key */
+ lua_pushvalue(L, -4); /* push static class TABLE */
+ assert(lua_istable(L,-1));
+ lua_rawset(L,-3); /* assign static class table(!NOT metatable) as ".static" member of class metatable */
+ lua_rawset(L,-3); /* assign class metatable as ".instance" member of class static METATABLE */
+ lua_pop(L,2);
+ assert(lua_gettop(L) == begin);
+}
+#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss)
+{
+ const int SWIGUNUSED begin = lua_gettop(L);
+ int i;
+ /* if name already there (class is already registered) then do nothing */
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L,clss->fqname); /* get the name */
+ lua_rawget(L,-2);
+ if(!lua_isnil(L,-1)) {
+ lua_pop(L,2);
+ assert(lua_gettop(L)==begin);
+ return;
+ }
+ lua_pop(L,2); /* tidy stack */
+ /* Recursively initialize all bases */
+ for(i=0;clss->bases[i];i++)
+ {
+ SWIG_Lua_elua_class_register_instance(L,clss->bases[i]);
+ }
+ /* Again, get registry and push name */
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L,clss->fqname); /* get the name */
+ assert(clss->metatable);
+ lua_pushrotable(L, (void*)(clss->metatable)); /* create the metatable */
+ lua_rawset(L,-3);
+ lua_pop(L,1);
+ assert(lua_gettop(L) == begin);
+}
+#endif /* elua && eluac */
+
+/* -----------------------------------------------------------------------------
+ * Class/structure conversion fns
+ * ----------------------------------------------------------------------------- */
+
+/* helper to add metatable to new lua object */
+SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L,swig_type_info *type)
+{
+ if (type->clientdata) /* there is clientdata: so add the metatable */
+ {
+ SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->fqname);
+ if (lua_istable(L,-1))
+ {
+ lua_setmetatable(L,-2);
+ }
+ else
+ {
+ lua_pop(L,1);
+ }
+ }
+}
+
+/* pushes a new object into the lua stack */
+SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own)
+{
+ swig_lua_userdata *usr;
+ if (!ptr){
+ lua_pushnil(L);
+ return;
+ }
+ usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
+ usr->ptr=ptr; /* set the ptr */
+ usr->type=type;
+ usr->own=own;
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
+ SWIG_Lua_AddMetatable(L,type); /* add metatable */
+#endif
+}
+
+/* takes a object from the lua stack & converts it into an object of the correct type
+ (if possible) */
+SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags)
+{
+ swig_lua_userdata *usr;
+ swig_cast_info *cast;
+ if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
+ usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
+ if (usr)
+ {
+ if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
+ {
+ usr->own=0;
+ }
+ if (!type) /* special cast void*, no casting fn */
+ {
+ *ptr=usr->ptr;
+ return SWIG_OK; /* ok */
+ }
+ cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
+ if (cast)
+ {
+ int newmemory = 0;
+ *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ return SWIG_OK; /* ok */
+ }
+ }
+ return SWIG_ERROR; /* error */
+}
+
+SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags,
+ int argnum,const char *func_name){
+ void *result;
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
+ luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
+ func_name,(type && type->str)?type->str:"void*",argnum);
+ }
+ return result;
+}
+
+/* pushes a packed userdata. user for member fn pointers only */
+SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type)
+{
+ swig_lua_rawdata *raw;
+ assert(ptr); /* not acceptable to pass in a NULL value */
+ raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
+ raw->type=type;
+ raw->own=0;
+ memcpy(raw->data,ptr,size); /* copy the data */
+ SWIG_Lua_AddMetatable(L,type); /* add metatable */
+}
+
+/* converts a packed userdata. user for member fn pointers only */
+SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
+{
+ swig_lua_rawdata *raw;
+ raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
+ if (!raw) return SWIG_ERROR; /* error */
+ if (type==0 || type==raw->type) /* void* or identical type */
+ {
+ memcpy(ptr,raw->data,size); /* copy it */
+ return SWIG_OK; /* ok */
+ }
+ return SWIG_ERROR; /* error */
+}
+
+/* a function to get the typestring of a piece of data */
+SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
+{
+ swig_lua_userdata *usr;
+ if (lua_isuserdata(L,tp))
+ {
+ usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
+ if (usr && usr->type && usr->type->str)
+ return usr->type->str;
+ return "userdata (unknown type)";
+ }
+ return lua_typename(L,lua_type(L,tp));
+}
+
+/* lua callable function to get the userdata's type */
+SWIGRUNTIME int SWIG_Lua_type(lua_State *L)
+{
+ lua_pushstring(L,SWIG_Lua_typename(L,1));
+ return 1;
+}
+
+/* -----------------------------------------------------------------------------
+ * global variable support code: class/struct typemap functions
+ * ----------------------------------------------------------------------------- */
+
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
+/* Install Constants */
+SWIGINTERN void
+SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
+ int i;
+ for (i = 0; constants[i].type; i++) {
+ switch(constants[i].type) {
+ case SWIG_LUA_INT:
+ lua_pushstring(L,constants[i].name);
+ lua_pushinteger(L,(lua_Number)constants[i].lvalue);
+ lua_rawset(L,-3);
+ break;
+ case SWIG_LUA_FLOAT:
+ lua_pushstring(L,constants[i].name);
+ lua_pushnumber(L,(lua_Number)constants[i].dvalue);
+ lua_rawset(L,-3);
+ break;
+ case SWIG_LUA_CHAR:
+ lua_pushstring(L,constants[i].name);
+ {
+ char c = constants[i].lvalue;
+ lua_pushlstring(L,&c,1);
+ }
+ lua_rawset(L,-3);
+ break;
+ case SWIG_LUA_STRING:
+ lua_pushstring(L,constants[i].name);
+ lua_pushstring(L,(char *) constants[i].pvalue);
+ lua_rawset(L,-3);
+ break;
+ case SWIG_LUA_POINTER:
+ lua_pushstring(L,constants[i].name);
+ SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
+ lua_rawset(L,-3);
+ break;
+ case SWIG_LUA_BINARY:
+ lua_pushstring(L,constants[i].name);
+ SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
+ lua_rawset(L,-3);
+ break;
+ default:
+ break;
+ }
+ }
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * executing lua code from within the wrapper
+ * ----------------------------------------------------------------------------- */
+
+#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
+#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
+#endif
+/* Executes a C string in Lua which is a really simple way of calling lua from C
+Unfortunately lua keeps changing its APIs, so we need a conditional compile
+In lua 5.0.X it's lua_dostring()
+In lua 5.1.X it's luaL_dostring()
+*/
+SWIGINTERN int
+SWIG_Lua_dostring(lua_State *L, const char *str) {
+ int ok,top;
+ if (str==0 || str[0]==0) return 0; /* nothing to do */
+ top=lua_gettop(L); /* save stack */
+#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
+ ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
+#else
+ ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
+#endif
+ if (ok!=0) {
+ SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
+ }
+ lua_settop(L,top); /* restore the stack */
+ return ok;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* ------------------------------ end luarun.swg ------------------------------ */
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_Data swig_types[0]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr swig_types[1]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection swig_types[2]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData swig_types[3]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment swig_types[4]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument swig_types[5]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment swig_types[6]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType swig_types[7]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement swig_types[8]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity swig_types[9]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference swig_types[10]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException swig_types[11]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap swig_types[12]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode swig_types[13]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList swig_types[14]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation swig_types[15]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction swig_types[16]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText swig_types[17]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo swig_types[18]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler swig_types[19]
+#define SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager swig_types[20]
+#define SWIGTYPE_p_bool swig_types[21]
+#define SWIGTYPE_p_int16_t swig_types[22]
+#define SWIGTYPE_p_int32_t swig_types[23]
+#define SWIGTYPE_p_int64_t swig_types[24]
+#define SWIGTYPE_p_namelist_t swig_types[25]
+#define SWIGTYPE_p_params_t swig_types[26]
+#define SWIGTYPE_p_size_t swig_types[27]
+#define SWIGTYPE_p_ssize_t swig_types[28]
+#define SWIGTYPE_p_std__listT_Data_t swig_types[29]
+#define SWIGTYPE_p_std__multimapT_std__string_Data_t swig_types[30]
+#define SWIGTYPE_p_std__string swig_types[31]
+#define SWIGTYPE_p_uint16_t swig_types[32]
+#define SWIGTYPE_p_uint32_t swig_types[33]
+#define SWIGTYPE_p_uint64_t swig_types[34]
+#define SWIGTYPE_p_unsigned_char swig_types[35]
+#define SWIGTYPE_p_uscxml__ErrorEvent swig_types[36]
+#define SWIGTYPE_p_uscxml__Event swig_types[37]
+#define SWIGTYPE_p_void swig_types[38]
+static swig_type_info *swig_types[40];
+static swig_module_info swig_module = {swig_types, 39, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_name "LuaDOM"
+#define SWIG_init luaopen_LuaDOM
+#define SWIG_init_user luaopen_LuaDOM_user
+
+#define SWIG_LUACODE luaopen_LuaDOM_luacode
+
+namespace swig {
+typedef struct{} LANGUAGE_OBJ;
+}
+
+
+#include <string>
+
+
+SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
+ int ret = lua_isstring(L, idx);
+ if (!ret)
+ ret = lua_isnil(L, idx);
+ return ret;
+}
+
+
+#include "xercesc/sax/InputSource.hpp"
+#include "xercesc/sax/SAXException.hpp"
+#include "xercesc/sax/SAXParseException.hpp"
+#include "xercesc/sax/Locator.hpp"
+#include "xercesc/sax/HandlerBase.hpp"
+#include "xercesc/sax2/Attributes.hpp"
+#include "xercesc/sax2/ContentHandler.hpp"
+#include "xercesc/sax2/LexicalHandler.hpp"
+#include "xercesc/sax2/DefaultHandler.hpp"
+#include "xercesc/sax2/SAX2XMLReader.hpp"
+#include "xercesc/sax2/XMLReaderFactory.hpp"
+#include "xercesc/util/PlatformUtils.hpp"
+#include "xercesc/util/TransService.hpp"
+#include "xercesc/util/XMLString.hpp"
+#include "xercesc/util/XMLUri.hpp"
+#include "xercesc/util/QName.hpp"
+#include "xercesc/util/HexBin.hpp"
+#include "xercesc/util/Base64.hpp"
+#include "xercesc/parsers/AbstractDOMParser.hpp"
+#include "xercesc/parsers/XercesDOMParser.hpp"
+#include "xercesc/parsers/SAXParser.hpp"
+#include "xercesc/dom/DOM.hpp"
+#include "xercesc/framework/LocalFileInputSource.hpp"
+#include "xercesc/framework/MemBufInputSource.hpp"
+#include "xercesc/framework/StdInInputSource.hpp"
+#include "xercesc/framework/URLInputSource.hpp"
+#include "xercesc/framework/XMLGrammarDescription.hpp"
+#include "xercesc/framework/XMLDTDDescription.hpp"
+#include "xercesc/framework/XMLSchemaDescription.hpp"
+#include "xercesc/util/NameIdPool.hpp"
+#include "xercesc/util/XMLEnumerator.hpp"
+#include "xercesc/framework/XMLValidator.hpp"
+#include "xercesc/validators/common/Grammar.hpp"
+#include "xercesc/validators/DTD/DTDAttDef.hpp"
+#include "xercesc/validators/DTD/DTDAttDefList.hpp"
+#include "xercesc/validators/DTD/DTDGrammar.hpp"
+#include "xercesc/validators/DTD/DTDValidator.hpp"
+#include "xercesc/validators/schema/SchemaGrammar.hpp"
+#include "xercesc/validators/schema/SchemaValidator.hpp"
+#include "xercesc/validators/schema/SchemaAttDefList.hpp"
+#include "xercesc/validators/schema/SchemaAttDef.hpp"
+#include "xercesc/framework/XMLFormatter.hpp"
+#include "xercesc/framework/MemBufFormatTarget.hpp"
+#include "xercesc/framework/LocalFileFormatTarget.hpp"
+#include "xercesc/framework/StdOutFormatTarget.hpp"
+#include "xercesc/framework/Wrapper4InputSource.hpp"
+#include "xercesc/framework/psvi/PSVIHandler.hpp"
+
+// for resolving XMLExceptions
+#include "xercesc/util/ArrayIndexOutOfBoundsException.hpp"
+#include "xercesc/util/EmptyStackException.hpp"
+#include "xercesc/util/IllegalArgumentException.hpp"
+#include "xercesc/util/InvalidCastException.hpp"
+#include "xercesc/util/IOException.hpp"
+#include "xercesc/util/NoSuchElementException.hpp"
+#include "xercesc/util/NullPointerException.hpp"
+#include "xercesc/util/NumberFormatException.hpp"
+#include "xercesc/util/ParseException.hpp"
+#include "xercesc/util/RuntimeException.hpp"
+#include "xercesc/util/SchemaDateTimeException.hpp"
+#include "xercesc/util/TranscodingException.hpp"
+#include "xercesc/util/UnexpectedEOFException.hpp"
+#include "xercesc/util/UnsupportedEncodingException.hpp"
+#include "xercesc/util/UTFDataFormatException.hpp"
+#include "xercesc/util/XMLNetAccessor.hpp"
+#include "xercesc/internal/XSerializationException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeFacetException.hpp"
+#include "xercesc/validators/datatype/InvalidDatatypeValueException.hpp"
+#include "xercesc/validators/schema/identity/XPathException.hpp"
+
+XERCES_CPP_NAMESPACE_USE
+
+// we initialize the static UTF-8 transcoding info
+// these are used by the typemaps to convert between
+// Xerces internal UTF-16 and Perl's internal UTF-8
+static XMLCh* UTF8_ENCODING = NULL;
+static XMLTranscoder* UTF8_TRANSCODER = NULL;
+
+static bool DEBUG_UTF8_OUT = 0;
+static bool DEBUG_UTF8_IN = 0;
+
+
+
+static swig_type_info *
+DOMNode_dynamic_cast(void **ptr) {
+ DOMNode **nptr = (DOMNode **) ptr;
+ if (*nptr == NULL) {
+ return NULL;
+ }
+ short int type = (*nptr)->getNodeType();
+ if (type == DOMNode::TEXT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText;
+ }
+ if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction;
+ }
+ if (type == DOMNode::DOCUMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument;
+ }
+ if (type == DOMNode::ELEMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement;
+ }
+ if (type == DOMNode::ENTITY_REFERENCE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::CDATA_SECTION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection;
+ }
+ if (type == DOMNode::COMMENT_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment;
+ }
+ if (type == DOMNode::DOCUMENT_TYPE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType;
+ }
+ if (type == DOMNode::ENTITY_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity;
+ }
+ if (type == DOMNode::ATTRIBUTE_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr;
+ }
+ if (type == DOMNode::NOTATION_NODE) {
+ return SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation;
+ }
+ return NULL;
+}
+
+SWIGINTERN bool XERCES_CPP_NAMESPACE_DOMNode_operator_Se__Se_(XERCES_CPP_NAMESPACE::DOMNode *self,XERCES_CPP_NAMESPACE::DOMNode const *other){
+ return self->isSameNode(other);
+ }
+
+using uscxml::Data;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+static int _wrap_new_string__SWIG_0(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *result = 0 ;
+
+ SWIG_check_num_args("std::string::string",0,0)
+ result = (std::string *)new std::string();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_std__string,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_string__SWIG_1(lua_State* L) {
+ int SWIG_arg = 0;
+ char *arg1 = (char *) 0 ;
+ std::string *result = 0 ;
+
+ SWIG_check_num_args("std::string::string",1,1)
+ if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("std::string::string",1,"char const *");
+ arg1 = (char *)lua_tostring(L, 1);
+ result = (std::string *)new std::string((char const *)arg1);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_std__string,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_string(lua_State* L) {
+ int argc;
+ int argv[2]={
+ 1,2
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 0) {
+ return _wrap_new_string__SWIG_0(L);
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ _v = SWIG_lua_isnilstring(L,argv[0]);
+ }
+ if (_v) {
+ return _wrap_new_string__SWIG_1(L);
+ }
+ }
+
+ SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_string'\n"
+ " Possible C/C++ prototypes are:\n"
+ " std::string::string()\n"
+ " std::string::string(char const *)\n");
+ lua_error(L);return 0;
+}
+
+
+static int _wrap_string_size(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = (std::string *) 0 ;
+ unsigned int result;
+
+ SWIG_check_num_args("std::string::size",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::size",1,"std::string const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
+ SWIG_fail_ptr("string_size",1,SWIGTYPE_p_std__string);
+ }
+
+ result = (unsigned int)((std::string const *)arg1)->size();
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_string_length(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = (std::string *) 0 ;
+ unsigned int result;
+
+ SWIG_check_num_args("std::string::length",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::length",1,"std::string const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
+ SWIG_fail_ptr("string_length",1,SWIGTYPE_p_std__string);
+ }
+
+ result = (unsigned int)((std::string const *)arg1)->length();
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_string_empty(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = (std::string *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("std::string::empty",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::empty",1,"std::string const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
+ SWIG_fail_ptr("string_empty",1,SWIGTYPE_p_std__string);
+ }
+
+ result = (bool)((std::string const *)arg1)->empty();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_string_c_str(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = (std::string *) 0 ;
+ char *result = 0 ;
+
+ SWIG_check_num_args("std::string::c_str",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::c_str",1,"std::string const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
+ SWIG_fail_ptr("string_c_str",1,SWIGTYPE_p_std__string);
+ }
+
+ result = (char *)((std::string const *)arg1)->c_str();
+ lua_pushstring(L,(const char *)result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_string_data(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = (std::string *) 0 ;
+ char *result = 0 ;
+
+ SWIG_check_num_args("std::string::data",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::data",1,"std::string const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
+ SWIG_fail_ptr("string_data",1,SWIGTYPE_p_std__string);
+ }
+
+ result = (char *)((std::string const *)arg1)->data();
+ lua_pushstring(L,(const char *)result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_string_assign(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = (std::string *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ SWIG_check_num_args("std::string::assign",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::assign",1,"std::string *");
+ if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("std::string::assign",2,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
+ SWIG_fail_ptr("string_assign",1,SWIGTYPE_p_std__string);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ (arg1)->assign((char const *)arg2);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_string(void *obj) {
+std::string *arg1 = (std::string *) obj;
+delete arg1;
+}
+static int _proxy__wrap_new_string(lua_State *L) {
+ assert(lua_istable(L,1));
+ lua_pushcfunction(L,_wrap_new_string);
+ assert(!lua_isnil(L,-1));
+ lua_replace(L,1); /* replace our table with real constructor */
+ lua_call(L,lua_gettop(L)-1,1);
+ return 1;
+}
+static swig_lua_attribute swig_string_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_string_methods[]= {
+ { "size", _wrap_string_size},
+ { "length", _wrap_string_length},
+ { "empty", _wrap_string_empty},
+ { "c_str", _wrap_string_c_str},
+ { "data", _wrap_string_data},
+ { "assign", _wrap_string_assign},
+ {0,0}
+};
+static swig_lua_method swig_string_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_string_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_string_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_string_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_string_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_string_Sf_SwigStatic = {
+ "string",
+ swig_string_Sf_SwigStatic_methods,
+ swig_string_Sf_SwigStatic_attributes,
+ swig_string_Sf_SwigStatic_constants,
+ swig_string_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_string_bases[] = {0};
+static const char *swig_string_base_names[] = {0};
+static swig_lua_class _wrap_class_string = { "string", "string", &SWIGTYPE_p_std__string,_proxy__wrap_new_string, swig_delete_string, swig_string_methods, swig_string_attributes, &swig_string_Sf_SwigStatic, swig_string_meta, swig_string_bases, swig_string_base_names };
+
+static int _wrap_DEBUG_UTF8_OUT_set(lua_State* L) {
+ int SWIG_arg = 0;
+ bool arg1 ;
+
+ SWIG_check_num_args("DEBUG_UTF8_OUT",1,1)
+ if(!lua_isboolean(L,1)) SWIG_fail_arg("DEBUG_UTF8_OUT",1,"bool");
+ arg1 = (lua_toboolean(L, 1)!=0);
+ DEBUG_UTF8_OUT = arg1;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DEBUG_UTF8_OUT_get(lua_State* L) {
+ int SWIG_arg = 0;
+ bool result;
+
+ SWIG_check_num_args("DEBUG_UTF8_OUT",0,0)
+ result = (bool)DEBUG_UTF8_OUT;
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DEBUG_UTF8_IN_set(lua_State* L) {
+ int SWIG_arg = 0;
+ bool arg1 ;
+
+ SWIG_check_num_args("DEBUG_UTF8_IN",1,1)
+ if(!lua_isboolean(L,1)) SWIG_fail_arg("DEBUG_UTF8_IN",1,"bool");
+ arg1 = (lua_toboolean(L, 1)!=0);
+ DEBUG_UTF8_IN = arg1;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DEBUG_UTF8_IN_get(lua_State* L) {
+ int SWIG_arg = 0;
+ bool result;
+
+ SWIG_check_num_args("DEBUG_UTF8_IN",0,0)
+ result = (bool)DEBUG_UTF8_IN;
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_DOMException__SWIG_0(lua_State* L) {
+ int SWIG_arg = 0;
+ short arg1 ;
+ short arg2 ;
+ XERCES_CPP_NAMESPACE::MemoryManager *arg3 = (XERCES_CPP_NAMESPACE::MemoryManager *) (XERCES_CPP_NAMESPACE::MemoryManager *)0 ;
+ XERCES_CPP_NAMESPACE::DOMException *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::DOMException",3,3)
+ if(!lua_isnumber(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::DOMException",1,"short");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::DOMException",2,"short");
+ if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::DOMException",3,"XERCES_CPP_NAMESPACE::MemoryManager *const");
+ arg1 = (short)lua_tonumber(L, 1);
+ arg2 = (short)lua_tonumber(L, 2);
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager,0))){
+ SWIG_fail_ptr("new_DOMException",3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1,arg2,arg3);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_DOMException__SWIG_1(lua_State* L) {
+ int SWIG_arg = 0;
+ short arg1 ;
+ short arg2 ;
+ XERCES_CPP_NAMESPACE::DOMException *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::DOMException",2,2)
+ if(!lua_isnumber(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::DOMException",1,"short");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::DOMException",2,"short");
+ arg1 = (short)lua_tonumber(L, 1);
+ arg2 = (short)lua_tonumber(L, 2);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1,arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_DOMException__SWIG_2(lua_State* L) {
+ int SWIG_arg = 0;
+ short arg1 ;
+ XERCES_CPP_NAMESPACE::DOMException *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::DOMException",1,1)
+ if(!lua_isnumber(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::DOMException",1,"short");
+ arg1 = (short)lua_tonumber(L, 1);
+ result = (XERCES_CPP_NAMESPACE::DOMException *)new XERCES_CPP_NAMESPACE::DOMException(arg1);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_DOMException(lua_State* L) {
+ int argc;
+ int argv[4]={
+ 1,2,3,4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 1) {
+ int _v;
+ {
+ _v = lua_isnumber(L,argv[0]);
+ }
+ if (_v) {
+ return _wrap_new_DOMException__SWIG_2(L);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ _v = lua_isnumber(L,argv[0]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L,argv[1]);
+ }
+ if (_v) {
+ return _wrap_new_DOMException__SWIG_1(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ _v = lua_isnumber(L,argv[0]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L,argv[1]);
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[2])==0 || SWIG_ConvertPtr(L,argv[2], (void **) &ptr, SWIGTYPE_p_XERCES_CPP_NAMESPACE__MemoryManager, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_new_DOMException__SWIG_0(L);
+ }
+ }
+ }
+ }
+
+ SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_DOMException'\n"
+ " Possible C/C++ prototypes are:\n"
+ " XERCES_CPP_NAMESPACE::DOMException::DOMException(short,short,XERCES_CPP_NAMESPACE::MemoryManager *const)\n"
+ " XERCES_CPP_NAMESPACE::DOMException::DOMException(short,short)\n"
+ " XERCES_CPP_NAMESPACE::DOMException::DOMException(short)\n");
+ lua_error(L);return 0;
+}
+
+
+static int _wrap_DOMException_getMessage(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::getMessage",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::getMessage",1,"XERCES_CPP_NAMESPACE::DOMException const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,0))){
+ SWIG_fail_ptr("DOMException_getMessage",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMException const *)arg1)->getMessage();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMException_code_set(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ short arg2 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::code",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::code",1,"XERCES_CPP_NAMESPACE::DOMException *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::code",2,"short");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,0))){
+ SWIG_fail_ptr("DOMException_code_set",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException);
+ }
+
+ arg2 = (short)lua_tonumber(L, 2);
+ if (arg1) (arg1)->code = arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMException_code_get(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ short result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::code",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::code",1,"XERCES_CPP_NAMESPACE::DOMException *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,0))){
+ SWIG_fail_ptr("DOMException_code_get",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException);
+ }
+
+ result = (short) ((arg1)->code);
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMException_msg_set(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::msg",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::msg",1,"XERCES_CPP_NAMESPACE::DOMException *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,0))){
+ SWIG_fail_ptr("DOMException_msg_set",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ if (arg1) (arg1)->msg = (XMLCh const *)arg2;
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMException_msg_get(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMException::msg",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMException::msg",1,"XERCES_CPP_NAMESPACE::DOMException *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,0))){
+ SWIG_fail_ptr("DOMException_msg_get",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException);
+ }
+
+ result = (XMLCh *) ((arg1)->msg);
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMException(void *obj) {
+XERCES_CPP_NAMESPACE::DOMException *arg1 = (XERCES_CPP_NAMESPACE::DOMException *) obj;
+delete arg1;
+}
+static int _proxy__wrap_new_DOMException(lua_State *L) {
+ assert(lua_istable(L,1));
+ lua_pushcfunction(L,_wrap_new_DOMException);
+ assert(!lua_isnil(L,-1));
+ lua_replace(L,1); /* replace our table with real constructor */
+ lua_call(L,lua_gettop(L)-1,1);
+ return 1;
+}
+static swig_lua_attribute swig_DOMException_attributes[] = {
+ { "code", _wrap_DOMException_code_get, _wrap_DOMException_code_set },
+ { "msg", _wrap_DOMException_msg_get, _wrap_DOMException_msg_set },
+ {0,0,0}
+};
+static swig_lua_method swig_DOMException_methods[]= {
+ { "getMessage", _wrap_DOMException_getMessage},
+ {0,0}
+};
+static swig_lua_method swig_DOMException_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMException_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMException_Sf_SwigStatic_constants[]= {
+ {SWIG_LUA_CONSTTAB_INT("INDEX_SIZE_ERR", XERCES_CPP_NAMESPACE::DOMException::INDEX_SIZE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMSTRING_SIZE_ERR", XERCES_CPP_NAMESPACE::DOMException::DOMSTRING_SIZE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("HIERARCHY_REQUEST_ERR", XERCES_CPP_NAMESPACE::DOMException::HIERARCHY_REQUEST_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("WRONG_DOCUMENT_ERR", XERCES_CPP_NAMESPACE::DOMException::WRONG_DOCUMENT_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("INVALID_CHARACTER_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_CHARACTER_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("NO_DATA_ALLOWED_ERR", XERCES_CPP_NAMESPACE::DOMException::NO_DATA_ALLOWED_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("NO_MODIFICATION_ALLOWED_ERR", XERCES_CPP_NAMESPACE::DOMException::NO_MODIFICATION_ALLOWED_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("NOT_FOUND_ERR", XERCES_CPP_NAMESPACE::DOMException::NOT_FOUND_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("NOT_SUPPORTED_ERR", XERCES_CPP_NAMESPACE::DOMException::NOT_SUPPORTED_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("INUSE_ATTRIBUTE_ERR", XERCES_CPP_NAMESPACE::DOMException::INUSE_ATTRIBUTE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("INVALID_STATE_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_STATE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("SYNTAX_ERR", XERCES_CPP_NAMESPACE::DOMException::SYNTAX_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("INVALID_MODIFICATION_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_MODIFICATION_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("NAMESPACE_ERR", XERCES_CPP_NAMESPACE::DOMException::NAMESPACE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("INVALID_ACCESS_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_ACCESS_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("VALIDATION_ERR", XERCES_CPP_NAMESPACE::DOMException::VALIDATION_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("TYPE_MISMATCH_ERR", XERCES_CPP_NAMESPACE::DOMException::TYPE_MISMATCH_ERR)},
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMException_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMException_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMException_Sf_SwigStatic = {
+ "DOMException",
+ swig_DOMException_Sf_SwigStatic_methods,
+ swig_DOMException_Sf_SwigStatic_attributes,
+ swig_DOMException_Sf_SwigStatic_constants,
+ swig_DOMException_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMException_bases[] = {0};
+static const char *swig_DOMException_base_names[] = {0};
+static swig_lua_class _wrap_class_DOMException = { "DOMException", "DOMException", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMException,_proxy__wrap_new_DOMException, swig_delete_DOMException, swig_DOMException_methods, swig_DOMException_attributes, &swig_DOMException_Sf_SwigStatic, swig_DOMException_meta, swig_DOMException_bases, swig_DOMException_base_names };
+
+static int _wrap_DOMNode_getNodeName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getNodeName",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getNodeName",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getNodeName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeName();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getNodeValue(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getNodeValue",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getNodeValue",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getNodeValue",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeValue();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getNodeType(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode::NodeType result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getNodeType",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getNodeType",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getNodeType",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode::NodeType)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNodeType();
+ lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getParentNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getParentNode",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getParentNode",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getParentNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getParentNode();
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getChildNodes(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getChildNodes",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getChildNodes",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getChildNodes",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getChildNodes();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getFirstChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getFirstChild",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getFirstChild",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getFirstChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getFirstChild();
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getLastChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getLastChild",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getLastChild",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getLastChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getLastChild();
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getPreviousSibling(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getPreviousSibling",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getPreviousSibling",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getPreviousSibling",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getPreviousSibling();
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getNextSibling(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getNextSibling",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getNextSibling",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getNextSibling",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNextSibling();
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getAttributes(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getAttributes",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getAttributes",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getAttributes",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getAttributes();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getOwnerDocument(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMDocument *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getOwnerDocument",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getOwnerDocument",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getOwnerDocument",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMDocument *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getOwnerDocument();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocument,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_cloneNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool arg2 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::cloneNode",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::cloneNode",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+ if(!lua_isboolean(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::cloneNode",2,"bool");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_cloneNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ arg2 = (lua_toboolean(L, 2)!=0);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->cloneNode(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_insertBefore(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg3 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::insertBefore",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::insertBefore",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::insertBefore",2,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::insertBefore",3,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_insertBefore",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_insertBefore",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_insertBefore",3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->insertBefore(arg2,arg3);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_replaceChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg3 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::replaceChild",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::replaceChild",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::replaceChild",2,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::replaceChild",3,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_replaceChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_replaceChild",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_replaceChild",3,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->replaceChild(arg2,arg3);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_removeChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::removeChild",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::removeChild",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::removeChild",2,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_removeChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_removeChild",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeChild(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_appendChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::appendChild",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::appendChild",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::appendChild",2,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_appendChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_appendChild",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->appendChild(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_hasChildNodes(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::hasChildNodes",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::hasChildNodes",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_hasChildNodes",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->hasChildNodes();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_setNodeValue(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::setNodeValue",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::setNodeValue",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_setNodeValue",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->setNodeValue((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_normalize(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::normalize",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::normalize",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_normalize",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ (arg1)->normalize();
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_isSupported(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::isSupported",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::isSupported",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_isSupported",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isSupported((XMLCh const *)arg2,(XMLCh const *)arg3);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getNamespaceURI(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getNamespaceURI",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getNamespaceURI",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getNamespaceURI",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getNamespaceURI();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getLocalName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getLocalName",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getLocalName",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getLocalName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getLocalName();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_setPrefix(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::setPrefix",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::setPrefix",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_setPrefix",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->setPrefix((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_hasAttributes(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::hasAttributes",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::hasAttributes",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_hasAttributes",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->hasAttributes();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_isSameNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::isSameNode",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::isSameNode",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::isSameNode",2,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_isSameNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_isSameNode",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isSameNode((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_isEqualNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::isEqualNode",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::isEqualNode",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::isEqualNode",2,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_isEqualNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_isEqualNode",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isEqualNode((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_setUserData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *arg3 = (void *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMUserDataHandler *arg4 = (XERCES_CPP_NAMESPACE::DOMUserDataHandler *) 0 ;
+ void *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::setUserData",4,4)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::setUserData",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::setUserData",3,"void *");
+ if(!SWIG_isptrtype(L,4)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::setUserData",4,"XERCES_CPP_NAMESPACE::DOMUserDataHandler *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_setUserData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ arg3=(void *)SWIG_MustGetPtr(L,3,0,0,3,"DOMNode_setUserData");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,4,(void**)&arg4,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,0))){
+ SWIG_fail_ptr("DOMNode_setUserData",4,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler);
+ }
+
+ result = (void *)(arg1)->setUserData((XMLCh const *)arg2,arg3,arg4);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getUserData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ void *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getUserData",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getUserData",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getUserData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (void *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getUserData((XMLCh const *)arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getBaseURI(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getBaseURI",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getBaseURI",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getBaseURI",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getBaseURI();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_compareDocumentPosition(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ short result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::compareDocumentPosition",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::compareDocumentPosition",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::compareDocumentPosition",2,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_compareDocumentPosition",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_compareDocumentPosition",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (short)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->compareDocumentPosition((XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getTextContent(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getTextContent",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getTextContent",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getTextContent",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getTextContent();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_setTextContent(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::setTextContent",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::setTextContent",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_setTextContent",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->setTextContent((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_lookupPrefix(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::lookupPrefix",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::lookupPrefix",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_lookupPrefix",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->lookupPrefix((XMLCh const *)arg2);
+
+ result = XMLString2Lua(result);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_isDefaultNamespace(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::isDefaultNamespace",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::isDefaultNamespace",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_isDefaultNamespace",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->isDefaultNamespace((XMLCh const *)arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_lookupNamespaceURI(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::lookupNamespaceURI",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::lookupNamespaceURI",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_lookupNamespaceURI",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->lookupNamespaceURI((XMLCh const *)arg2);
+
+ result = XMLString2Lua(result);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_getFeature(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ void *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::getFeature",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::getFeature",1,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_getFeature",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (void *)((XERCES_CPP_NAMESPACE::DOMNode const *)arg1)->getFeature((XMLCh const *)arg2,(XMLCh const *)arg3);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode_release(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::release",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::release",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode_release",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ (arg1)->release();
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNode___eq(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNode::operator ==",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::operator ==",1,"XERCES_CPP_NAMESPACE::DOMNode *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNode::operator ==",2,"XERCES_CPP_NAMESPACE::DOMNode const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode___eq",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNode___eq",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (bool)XERCES_CPP_NAMESPACE_DOMNode_operator_Se__Se_(arg1,(XERCES_CPP_NAMESPACE::DOMNode const *)arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMNode(void *obj) {
+XERCES_CPP_NAMESPACE::DOMNode *arg1 = (XERCES_CPP_NAMESPACE::DOMNode *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMNode_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMNode_methods[]= {
+ { "getNodeName", _wrap_DOMNode_getNodeName},
+ { "getNodeValue", _wrap_DOMNode_getNodeValue},
+ { "getNodeType", _wrap_DOMNode_getNodeType},
+ { "getParentNode", _wrap_DOMNode_getParentNode},
+ { "getChildNodes", _wrap_DOMNode_getChildNodes},
+ { "getFirstChild", _wrap_DOMNode_getFirstChild},
+ { "getLastChild", _wrap_DOMNode_getLastChild},
+ { "getPreviousSibling", _wrap_DOMNode_getPreviousSibling},
+ { "getNextSibling", _wrap_DOMNode_getNextSibling},
+ { "getAttributes", _wrap_DOMNode_getAttributes},
+ { "getOwnerDocument", _wrap_DOMNode_getOwnerDocument},
+ { "cloneNode", _wrap_DOMNode_cloneNode},
+ { "insertBefore", _wrap_DOMNode_insertBefore},
+ { "replaceChild", _wrap_DOMNode_replaceChild},
+ { "removeChild", _wrap_DOMNode_removeChild},
+ { "appendChild", _wrap_DOMNode_appendChild},
+ { "hasChildNodes", _wrap_DOMNode_hasChildNodes},
+ { "setNodeValue", _wrap_DOMNode_setNodeValue},
+ { "normalize", _wrap_DOMNode_normalize},
+ { "isSupported", _wrap_DOMNode_isSupported},
+ { "getNamespaceURI", _wrap_DOMNode_getNamespaceURI},
+ { "getLocalName", _wrap_DOMNode_getLocalName},
+ { "setPrefix", _wrap_DOMNode_setPrefix},
+ { "hasAttributes", _wrap_DOMNode_hasAttributes},
+ { "isSameNode", _wrap_DOMNode_isSameNode},
+ { "isEqualNode", _wrap_DOMNode_isEqualNode},
+ { "setUserData", _wrap_DOMNode_setUserData},
+ { "getUserData", _wrap_DOMNode_getUserData},
+ { "getBaseURI", _wrap_DOMNode_getBaseURI},
+ { "compareDocumentPosition", _wrap_DOMNode_compareDocumentPosition},
+ { "getTextContent", _wrap_DOMNode_getTextContent},
+ { "setTextContent", _wrap_DOMNode_setTextContent},
+ { "lookupPrefix", _wrap_DOMNode_lookupPrefix},
+ { "isDefaultNamespace", _wrap_DOMNode_isDefaultNamespace},
+ { "lookupNamespaceURI", _wrap_DOMNode_lookupNamespaceURI},
+ { "getFeature", _wrap_DOMNode_getFeature},
+ { "release", _wrap_DOMNode_release},
+ { "__eq", _wrap_DOMNode___eq},
+ {0,0}
+};
+static swig_lua_method swig_DOMNode_meta[] = {
+ { "__eq", _wrap_DOMNode___eq},
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMNode_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMNode_Sf_SwigStatic_constants[]= {
+ {SWIG_LUA_CONSTTAB_INT("ELEMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::ELEMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("ATTRIBUTE_NODE", XERCES_CPP_NAMESPACE::DOMNode::ATTRIBUTE_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("TEXT_NODE", XERCES_CPP_NAMESPACE::DOMNode::TEXT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("CDATA_SECTION_NODE", XERCES_CPP_NAMESPACE::DOMNode::CDATA_SECTION_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("ENTITY_REFERENCE_NODE", XERCES_CPP_NAMESPACE::DOMNode::ENTITY_REFERENCE_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("ENTITY_NODE", XERCES_CPP_NAMESPACE::DOMNode::ENTITY_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("PROCESSING_INSTRUCTION_NODE", XERCES_CPP_NAMESPACE::DOMNode::PROCESSING_INSTRUCTION_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("COMMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::COMMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_TYPE_NODE", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_TYPE_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_FRAGMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_FRAGMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("NOTATION_NODE", XERCES_CPP_NAMESPACE::DOMNode::NOTATION_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_POSITION_DISCONNECTED", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_DISCONNECTED)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_POSITION_PRECEDING", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_PRECEDING)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_POSITION_FOLLOWING", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_FOLLOWING)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_POSITION_CONTAINS", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINS)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_POSITION_CONTAINED_BY", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINED_BY)},
+ {SWIG_LUA_CONSTTAB_INT("DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)},
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMNode_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMNode_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMNode_Sf_SwigStatic = {
+ "DOMNode",
+ swig_DOMNode_Sf_SwigStatic_methods,
+ swig_DOMNode_Sf_SwigStatic_attributes,
+ swig_DOMNode_Sf_SwigStatic_constants,
+ swig_DOMNode_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMNode_bases[] = {0};
+static const char *swig_DOMNode_base_names[] = {0};
+static swig_lua_class _wrap_class_DOMNode = { "DOMNode", "DOMNode", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0, swig_delete_DOMNode, swig_DOMNode_methods, swig_DOMNode_attributes, &swig_DOMNode_Sf_SwigStatic, swig_DOMNode_meta, swig_DOMNode_bases, swig_DOMNode_base_names };
+
+static int _wrap_DOMAttr_getName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::getName",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::getName",1,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_getName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getName();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMAttr_getSpecified(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::getSpecified",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::getSpecified",1,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_getSpecified",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getSpecified();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMAttr_getValue(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::getValue",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::getValue",1,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_getValue",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getValue();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMAttr_setValue(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::setValue",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::setValue",1,"XERCES_CPP_NAMESPACE::DOMAttr *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_setValue",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->setValue((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMAttr_getOwnerElement(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::getOwnerElement",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::getOwnerElement",1,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_getOwnerElement",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getOwnerElement();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMAttr_isId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::isId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::isId",1,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_isId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->isId();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMAttr_getSchemaTypeInfo(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMTypeInfo *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMAttr::getSchemaTypeInfo",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMAttr::getSchemaTypeInfo",1,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMAttr_getSchemaTypeInfo",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMTypeInfo *)((XERCES_CPP_NAMESPACE::DOMAttr const *)arg1)->getSchemaTypeInfo();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMAttr(void *obj) {
+XERCES_CPP_NAMESPACE::DOMAttr *arg1 = (XERCES_CPP_NAMESPACE::DOMAttr *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMAttr_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMAttr_methods[]= {
+ { "getName", _wrap_DOMAttr_getName},
+ { "getSpecified", _wrap_DOMAttr_getSpecified},
+ { "getValue", _wrap_DOMAttr_getValue},
+ { "setValue", _wrap_DOMAttr_setValue},
+ { "getOwnerElement", _wrap_DOMAttr_getOwnerElement},
+ { "isId", _wrap_DOMAttr_isId},
+ { "getSchemaTypeInfo", _wrap_DOMAttr_getSchemaTypeInfo},
+ {0,0}
+};
+static swig_lua_method swig_DOMAttr_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMAttr_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMAttr_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMAttr_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMAttr_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMAttr_Sf_SwigStatic = {
+ "DOMAttr",
+ swig_DOMAttr_Sf_SwigStatic_methods,
+ swig_DOMAttr_Sf_SwigStatic_attributes,
+ swig_DOMAttr_Sf_SwigStatic_constants,
+ swig_DOMAttr_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMAttr_bases[] = {0,0};
+static const char *swig_DOMAttr_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMAttr = { "DOMAttr", "DOMAttr", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0, swig_delete_DOMAttr, swig_DOMAttr_methods, swig_DOMAttr_attributes, &swig_DOMAttr_Sf_SwigStatic, swig_DOMAttr_meta, swig_DOMAttr_bases, swig_DOMAttr_base_names };
+
+static int _wrap_DOMElement_getTagName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getTagName",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getTagName",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getTagName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getTagName();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getAttribute(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getAttribute",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getAttribute",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getAttribute",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttribute((XMLCh const *)arg2);
+
+ result = XMLString2Lua(result);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getAttributeNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getAttributeNode",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getAttributeNode",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getAttributeNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNode((XMLCh const *)arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getElementsByTagName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getElementsByTagName",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getElementsByTagName",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getElementsByTagName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getElementsByTagName((XMLCh const *)arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList,0); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setAttribute(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setAttribute",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setAttribute",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setAttribute",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ (arg1)->setAttribute((XMLCh const *)arg2,(XMLCh const *)arg3);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setAttributeNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNode",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNode",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNode",2,"XERCES_CPP_NAMESPACE::DOMAttr *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setAttributeNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMElement_setAttributeNode",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->setAttributeNode(arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_removeAttributeNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::removeAttributeNode",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::removeAttributeNode",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::removeAttributeNode",2,"XERCES_CPP_NAMESPACE::DOMAttr *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_removeAttributeNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMElement_removeAttributeNode",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->removeAttributeNode(arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_removeAttribute(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::removeAttribute",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::removeAttribute",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_removeAttribute",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->removeAttribute((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getAttributeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getAttributeNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getAttributeNS",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getAttributeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+
+ result = XMLString2Lua(result);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setAttributeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XMLCh *arg4 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNS",4,4)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNS",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setAttributeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+
+ arg4 = Lua2XMLString(4);
+
+ (arg1)->setAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3,(XMLCh const *)arg4);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ delete[] arg4;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+
+ delete[] arg4;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_removeAttributeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::removeAttributeNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::removeAttributeNS",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_removeAttributeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ (arg1)->removeAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getAttributeNodeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getAttributeNodeNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getAttributeNodeNS",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getAttributeNodeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getAttributeNodeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0); SWIG_arg++;
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setAttributeNodeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNodeNS",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNodeNS",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setAttributeNodeNS",2,"XERCES_CPP_NAMESPACE::DOMAttr *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setAttributeNodeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMElement_setAttributeNodeNS",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMAttr *)(arg1)->setAttributeNodeNS(arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getElementsByTagNameNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNodeList *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getElementsByTagNameNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getElementsByTagNameNS",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getElementsByTagNameNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNodeList *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getElementsByTagNameNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList,0); SWIG_arg++;
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_hasAttribute(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::hasAttribute",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::hasAttribute",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_hasAttribute",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->hasAttribute((XMLCh const *)arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_hasAttributeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::hasAttributeNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::hasAttributeNS",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_hasAttributeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->hasAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setIdAttribute(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ bool arg3 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setIdAttribute",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttribute",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+ if(!lua_isboolean(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttribute",3,"bool");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setIdAttribute",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ arg3 = (lua_toboolean(L, 3)!=0);
+ (arg1)->setIdAttribute((XMLCh const *)arg2,arg3);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setIdAttributeNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ bool arg4 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNS",4,4)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNS",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+ if(!lua_isboolean(L,4)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNS",4,"bool");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setIdAttributeNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ arg4 = (lua_toboolean(L, 4)!=0);
+ (arg1)->setIdAttributeNS((XMLCh const *)arg2,(XMLCh const *)arg3,arg4);
+
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_setIdAttributeNode(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMAttr *arg2 = (XERCES_CPP_NAMESPACE::DOMAttr *) 0 ;
+ bool arg3 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNode",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNode",1,"XERCES_CPP_NAMESPACE::DOMElement *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNode",2,"XERCES_CPP_NAMESPACE::DOMAttr const *");
+ if(!lua_isboolean(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::setIdAttributeNode",3,"bool");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_setIdAttributeNode",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr,0))){
+ SWIG_fail_ptr("DOMElement_setIdAttributeNode",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMAttr);
+ }
+
+ arg3 = (lua_toboolean(L, 3)!=0);
+ (arg1)->setIdAttributeNode((XERCES_CPP_NAMESPACE::DOMAttr const *)arg2,arg3);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getSchemaTypeInfo(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMTypeInfo *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getSchemaTypeInfo",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getSchemaTypeInfo",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getSchemaTypeInfo",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMTypeInfo *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getSchemaTypeInfo();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMTypeInfo,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getFirstElementChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getFirstElementChild",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getFirstElementChild",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getFirstElementChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getFirstElementChild();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getLastElementChild(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getLastElementChild",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getLastElementChild",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getLastElementChild",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getLastElementChild();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getPreviousElementSibling(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getPreviousElementSibling",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getPreviousElementSibling",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getPreviousElementSibling",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getPreviousElementSibling();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getNextElementSibling(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMElement *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getNextElementSibling",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getNextElementSibling",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getNextElementSibling",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMElement *)((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getNextElementSibling();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMElement_getChildElementCount(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) 0 ;
+ XMLSize_t result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMElement::getChildElementCount",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMElement::getChildElementCount",1,"XERCES_CPP_NAMESPACE::DOMElement const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0))){
+ SWIG_fail_ptr("DOMElement_getChildElementCount",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement);
+ }
+
+ result = ((XERCES_CPP_NAMESPACE::DOMElement const *)arg1)->getChildElementCount();
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMElement(void *obj) {
+XERCES_CPP_NAMESPACE::DOMElement *arg1 = (XERCES_CPP_NAMESPACE::DOMElement *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMElement_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMElement_methods[]= {
+ { "getTagName", _wrap_DOMElement_getTagName},
+ { "getAttribute", _wrap_DOMElement_getAttribute},
+ { "getAttributeNode", _wrap_DOMElement_getAttributeNode},
+ { "getElementsByTagName", _wrap_DOMElement_getElementsByTagName},
+ { "setAttribute", _wrap_DOMElement_setAttribute},
+ { "setAttributeNode", _wrap_DOMElement_setAttributeNode},
+ { "removeAttributeNode", _wrap_DOMElement_removeAttributeNode},
+ { "removeAttribute", _wrap_DOMElement_removeAttribute},
+ { "getAttributeNS", _wrap_DOMElement_getAttributeNS},
+ { "setAttributeNS", _wrap_DOMElement_setAttributeNS},
+ { "removeAttributeNS", _wrap_DOMElement_removeAttributeNS},
+ { "getAttributeNodeNS", _wrap_DOMElement_getAttributeNodeNS},
+ { "setAttributeNodeNS", _wrap_DOMElement_setAttributeNodeNS},
+ { "getElementsByTagNameNS", _wrap_DOMElement_getElementsByTagNameNS},
+ { "hasAttribute", _wrap_DOMElement_hasAttribute},
+ { "hasAttributeNS", _wrap_DOMElement_hasAttributeNS},
+ { "setIdAttribute", _wrap_DOMElement_setIdAttribute},
+ { "setIdAttributeNS", _wrap_DOMElement_setIdAttributeNS},
+ { "setIdAttributeNode", _wrap_DOMElement_setIdAttributeNode},
+ { "getSchemaTypeInfo", _wrap_DOMElement_getSchemaTypeInfo},
+ { "getFirstElementChild", _wrap_DOMElement_getFirstElementChild},
+ { "getLastElementChild", _wrap_DOMElement_getLastElementChild},
+ { "getPreviousElementSibling", _wrap_DOMElement_getPreviousElementSibling},
+ { "getNextElementSibling", _wrap_DOMElement_getNextElementSibling},
+ { "getChildElementCount", _wrap_DOMElement_getChildElementCount},
+ {0,0}
+};
+static swig_lua_method swig_DOMElement_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMElement_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMElement_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMElement_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMElement_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMElement_Sf_SwigStatic = {
+ "DOMElement",
+ swig_DOMElement_Sf_SwigStatic_methods,
+ swig_DOMElement_Sf_SwigStatic_attributes,
+ swig_DOMElement_Sf_SwigStatic_constants,
+ swig_DOMElement_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMElement_bases[] = {0,0};
+static const char *swig_DOMElement_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMElement = { "DOMElement", "DOMElement", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement,0, swig_delete_DOMElement, swig_DOMElement_methods, swig_DOMElement_attributes, &swig_DOMElement_Sf_SwigStatic, swig_DOMElement_meta, swig_DOMElement_bases, swig_DOMElement_base_names };
+
+static int _wrap_DOMEntity_getPublicId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMEntity::getPublicId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMEntity::getPublicId",1,"XERCES_CPP_NAMESPACE::DOMEntity const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0))){
+ SWIG_fail_ptr("DOMEntity_getPublicId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getPublicId();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMEntity_getSystemId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMEntity::getSystemId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMEntity::getSystemId",1,"XERCES_CPP_NAMESPACE::DOMEntity const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0))){
+ SWIG_fail_ptr("DOMEntity_getSystemId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getSystemId();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMEntity_getNotationName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMEntity::getNotationName",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMEntity::getNotationName",1,"XERCES_CPP_NAMESPACE::DOMEntity const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0))){
+ SWIG_fail_ptr("DOMEntity_getNotationName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getNotationName();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMEntity_getInputEncoding(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMEntity::getInputEncoding",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMEntity::getInputEncoding",1,"XERCES_CPP_NAMESPACE::DOMEntity const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0))){
+ SWIG_fail_ptr("DOMEntity_getInputEncoding",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getInputEncoding();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMEntity_getXmlEncoding(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMEntity::getXmlEncoding",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMEntity::getXmlEncoding",1,"XERCES_CPP_NAMESPACE::DOMEntity const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0))){
+ SWIG_fail_ptr("DOMEntity_getXmlEncoding",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getXmlEncoding();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMEntity_getXmlVersion(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMEntity::getXmlVersion",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMEntity::getXmlVersion",1,"XERCES_CPP_NAMESPACE::DOMEntity const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0))){
+ SWIG_fail_ptr("DOMEntity_getXmlVersion",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMEntity const *)arg1)->getXmlVersion();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMEntity(void *obj) {
+XERCES_CPP_NAMESPACE::DOMEntity *arg1 = (XERCES_CPP_NAMESPACE::DOMEntity *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMEntity_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMEntity_methods[]= {
+ { "getPublicId", _wrap_DOMEntity_getPublicId},
+ { "getSystemId", _wrap_DOMEntity_getSystemId},
+ { "getNotationName", _wrap_DOMEntity_getNotationName},
+ { "getInputEncoding", _wrap_DOMEntity_getInputEncoding},
+ { "getXmlEncoding", _wrap_DOMEntity_getXmlEncoding},
+ { "getXmlVersion", _wrap_DOMEntity_getXmlVersion},
+ {0,0}
+};
+static swig_lua_method swig_DOMEntity_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMEntity_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMEntity_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMEntity_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMEntity_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMEntity_Sf_SwigStatic = {
+ "DOMEntity",
+ swig_DOMEntity_Sf_SwigStatic_methods,
+ swig_DOMEntity_Sf_SwigStatic_attributes,
+ swig_DOMEntity_Sf_SwigStatic_constants,
+ swig_DOMEntity_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMEntity_bases[] = {0,0};
+static const char *swig_DOMEntity_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMEntity = { "DOMEntity", "DOMEntity", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntity,0, swig_delete_DOMEntity, swig_DOMEntity_methods, swig_DOMEntity_attributes, &swig_DOMEntity_Sf_SwigStatic, swig_DOMEntity_meta, swig_DOMEntity_bases, swig_DOMEntity_base_names };
+
+static int _wrap_DOMDocumentType_getName(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMDocumentType::getName",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMDocumentType::getName",1,"XERCES_CPP_NAMESPACE::DOMDocumentType const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0))){
+ SWIG_fail_ptr("DOMDocumentType_getName",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getName();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMDocumentType_getEntities(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMDocumentType::getEntities",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMDocumentType::getEntities",1,"XERCES_CPP_NAMESPACE::DOMDocumentType const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0))){
+ SWIG_fail_ptr("DOMDocumentType_getEntities",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getEntities();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMDocumentType_getNotations(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMDocumentType::getNotations",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMDocumentType::getNotations",1,"XERCES_CPP_NAMESPACE::DOMDocumentType const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0))){
+ SWIG_fail_ptr("DOMDocumentType_getNotations",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getNotations();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMDocumentType_getPublicId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMDocumentType::getPublicId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMDocumentType::getPublicId",1,"XERCES_CPP_NAMESPACE::DOMDocumentType const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0))){
+ SWIG_fail_ptr("DOMDocumentType_getPublicId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getPublicId();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMDocumentType_getSystemId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMDocumentType::getSystemId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMDocumentType::getSystemId",1,"XERCES_CPP_NAMESPACE::DOMDocumentType const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0))){
+ SWIG_fail_ptr("DOMDocumentType_getSystemId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getSystemId();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMDocumentType_getInternalSubset(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMDocumentType::getInternalSubset",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMDocumentType::getInternalSubset",1,"XERCES_CPP_NAMESPACE::DOMDocumentType const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0))){
+ SWIG_fail_ptr("DOMDocumentType_getInternalSubset",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMDocumentType const *)arg1)->getInternalSubset();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMDocumentType(void *obj) {
+XERCES_CPP_NAMESPACE::DOMDocumentType *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentType *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMDocumentType_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMDocumentType_methods[]= {
+ { "getName", _wrap_DOMDocumentType_getName},
+ { "getEntities", _wrap_DOMDocumentType_getEntities},
+ { "getNotations", _wrap_DOMDocumentType_getNotations},
+ { "getPublicId", _wrap_DOMDocumentType_getPublicId},
+ { "getSystemId", _wrap_DOMDocumentType_getSystemId},
+ { "getInternalSubset", _wrap_DOMDocumentType_getInternalSubset},
+ {0,0}
+};
+static swig_lua_method swig_DOMDocumentType_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMDocumentType_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMDocumentType_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMDocumentType_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMDocumentType_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMDocumentType_Sf_SwigStatic = {
+ "DOMDocumentType",
+ swig_DOMDocumentType_Sf_SwigStatic_methods,
+ swig_DOMDocumentType_Sf_SwigStatic_attributes,
+ swig_DOMDocumentType_Sf_SwigStatic_constants,
+ swig_DOMDocumentType_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMDocumentType_bases[] = {0,0};
+static const char *swig_DOMDocumentType_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMDocumentType = { "DOMDocumentType", "DOMDocumentType", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentType,0, swig_delete_DOMDocumentType, swig_DOMDocumentType_methods, swig_DOMDocumentType_attributes, &swig_DOMDocumentType_Sf_SwigStatic, swig_DOMDocumentType_meta, swig_DOMDocumentType_bases, swig_DOMDocumentType_base_names };
+
+static int _wrap_DOMCharacterData_getData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::getData",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::getData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_getData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->getData();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_getLength(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::getLength",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::getLength",1,"XERCES_CPP_NAMESPACE::DOMCharacterData const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_getLength",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+ result = ((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->getLength();
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_substringData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::substringData",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::substringData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData const *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::substringData",2,"XMLSize_t");
+ if(!lua_isnumber(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::substringData",3,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_substringData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+ SWIG_contract_assert((lua_tonumber(L,3)>=0),"number must not be negative")
+ arg3 = (XMLSize_t)lua_tonumber(L, 3);
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMCharacterData const *)arg1)->substringData(arg2,arg3);
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_appendData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::appendData",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::appendData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_appendData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->appendData((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_insertData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::insertData",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::insertData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::insertData",2,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_insertData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+
+ arg3 = Lua2XMLString(3);
+
+ (arg1)->insertData(arg2,(XMLCh const *)arg3);
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_deleteData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::deleteData",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::deleteData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::deleteData",2,"XMLSize_t");
+ if(!lua_isnumber(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::deleteData",3,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_deleteData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+ SWIG_contract_assert((lua_tonumber(L,3)>=0),"number must not be negative")
+ arg3 = (XMLSize_t)lua_tonumber(L, 3);
+ (arg1)->deleteData(arg2,arg3);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_replaceData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLSize_t arg2 ;
+ XMLSize_t arg3 ;
+ XMLCh *arg4 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::replaceData",4,4)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::replaceData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::replaceData",2,"XMLSize_t");
+ if(!lua_isnumber(L,3)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::replaceData",3,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_replaceData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+ SWIG_contract_assert((lua_tonumber(L,3)>=0),"number must not be negative")
+ arg3 = (XMLSize_t)lua_tonumber(L, 3);
+
+ arg4 = Lua2XMLString(4);
+
+ (arg1)->replaceData(arg2,arg3,(XMLCh const *)arg4);
+
+
+ delete[] arg4;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg4;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMCharacterData_setData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMCharacterData::setData",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMCharacterData::setData",1,"XERCES_CPP_NAMESPACE::DOMCharacterData *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0))){
+ SWIG_fail_ptr("DOMCharacterData_setData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->setData((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMCharacterData(void *obj) {
+XERCES_CPP_NAMESPACE::DOMCharacterData *arg1 = (XERCES_CPP_NAMESPACE::DOMCharacterData *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMCharacterData_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMCharacterData_methods[]= {
+ { "getData", _wrap_DOMCharacterData_getData},
+ { "getLength", _wrap_DOMCharacterData_getLength},
+ { "substringData", _wrap_DOMCharacterData_substringData},
+ { "appendData", _wrap_DOMCharacterData_appendData},
+ { "insertData", _wrap_DOMCharacterData_insertData},
+ { "deleteData", _wrap_DOMCharacterData_deleteData},
+ { "replaceData", _wrap_DOMCharacterData_replaceData},
+ { "setData", _wrap_DOMCharacterData_setData},
+ {0,0}
+};
+static swig_lua_method swig_DOMCharacterData_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMCharacterData_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMCharacterData_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMCharacterData_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMCharacterData_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMCharacterData_Sf_SwigStatic = {
+ "DOMCharacterData",
+ swig_DOMCharacterData_Sf_SwigStatic_methods,
+ swig_DOMCharacterData_Sf_SwigStatic_attributes,
+ swig_DOMCharacterData_Sf_SwigStatic_constants,
+ swig_DOMCharacterData_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMCharacterData_bases[] = {0,0};
+static const char *swig_DOMCharacterData_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMCharacterData = { "DOMCharacterData", "DOMCharacterData", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCharacterData,0, swig_delete_DOMCharacterData, swig_DOMCharacterData_methods, swig_DOMCharacterData_attributes, &swig_DOMCharacterData_Sf_SwigStatic, swig_DOMCharacterData_meta, swig_DOMCharacterData_bases, swig_DOMCharacterData_base_names };
+
+static void swig_delete_DOMComment(void *obj) {
+XERCES_CPP_NAMESPACE::DOMComment *arg1 = (XERCES_CPP_NAMESPACE::DOMComment *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMComment_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMComment_methods[]= {
+ {0,0}
+};
+static swig_lua_method swig_DOMComment_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMComment_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMComment_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMComment_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMComment_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMComment_Sf_SwigStatic = {
+ "DOMComment",
+ swig_DOMComment_Sf_SwigStatic_methods,
+ swig_DOMComment_Sf_SwigStatic_attributes,
+ swig_DOMComment_Sf_SwigStatic_constants,
+ swig_DOMComment_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMComment_bases[] = {0,0};
+static const char *swig_DOMComment_base_names[] = {"XERCES_CPP_NAMESPACE::DOMCharacterData *",0};
+static swig_lua_class _wrap_class_DOMComment = { "DOMComment", "DOMComment", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment,0, swig_delete_DOMComment, swig_DOMComment_methods, swig_DOMComment_attributes, &swig_DOMComment_Sf_SwigStatic, swig_DOMComment_meta, swig_DOMComment_bases, swig_DOMComment_base_names };
+
+static int _wrap_DOMText_splitText(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLSize_t arg2 ;
+ XERCES_CPP_NAMESPACE::DOMText *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMText::splitText",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMText::splitText",1,"XERCES_CPP_NAMESPACE::DOMText *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMText::splitText",2,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0))){
+ SWIG_fail_ptr("DOMText_splitText",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+ result = (XERCES_CPP_NAMESPACE::DOMText *)(arg1)->splitText(arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMText_getIsElementContentWhitespace(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMText::getIsElementContentWhitespace",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMText::getIsElementContentWhitespace",1,"XERCES_CPP_NAMESPACE::DOMText const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0))){
+ SWIG_fail_ptr("DOMText_getIsElementContentWhitespace",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->getIsElementContentWhitespace();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMText_getWholeText(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMText::getWholeText",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMText::getWholeText",1,"XERCES_CPP_NAMESPACE::DOMText const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0))){
+ SWIG_fail_ptr("DOMText_getWholeText",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->getWholeText();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMText_replaceWholeText(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMText *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMText::replaceWholeText",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMText::replaceWholeText",1,"XERCES_CPP_NAMESPACE::DOMText *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0))){
+ SWIG_fail_ptr("DOMText_replaceWholeText",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XERCES_CPP_NAMESPACE::DOMText *)(arg1)->replaceWholeText((XMLCh const *)arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0); SWIG_arg++;
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMText_isIgnorableWhitespace(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) 0 ;
+ bool result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMText::isIgnorableWhitespace",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMText::isIgnorableWhitespace",1,"XERCES_CPP_NAMESPACE::DOMText const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0))){
+ SWIG_fail_ptr("DOMText_isIgnorableWhitespace",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText);
+ }
+
+ result = (bool)((XERCES_CPP_NAMESPACE::DOMText const *)arg1)->isIgnorableWhitespace();
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMText(void *obj) {
+XERCES_CPP_NAMESPACE::DOMText *arg1 = (XERCES_CPP_NAMESPACE::DOMText *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMText_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMText_methods[]= {
+ { "splitText", _wrap_DOMText_splitText},
+ { "getIsElementContentWhitespace", _wrap_DOMText_getIsElementContentWhitespace},
+ { "getWholeText", _wrap_DOMText_getWholeText},
+ { "replaceWholeText", _wrap_DOMText_replaceWholeText},
+ { "isIgnorableWhitespace", _wrap_DOMText_isIgnorableWhitespace},
+ {0,0}
+};
+static swig_lua_method swig_DOMText_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMText_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMText_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMText_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMText_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMText_Sf_SwigStatic = {
+ "DOMText",
+ swig_DOMText_Sf_SwigStatic_methods,
+ swig_DOMText_Sf_SwigStatic_attributes,
+ swig_DOMText_Sf_SwigStatic_constants,
+ swig_DOMText_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMText_bases[] = {0,0};
+static const char *swig_DOMText_base_names[] = {"XERCES_CPP_NAMESPACE::DOMCharacterData *",0};
+static swig_lua_class _wrap_class_DOMText = { "DOMText", "DOMText", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMText,0, swig_delete_DOMText, swig_DOMText_methods, swig_DOMText_attributes, &swig_DOMText_Sf_SwigStatic, swig_DOMText_meta, swig_DOMText_bases, swig_DOMText_base_names };
+
+static void swig_delete_DOMCDATASection(void *obj) {
+XERCES_CPP_NAMESPACE::DOMCDATASection *arg1 = (XERCES_CPP_NAMESPACE::DOMCDATASection *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMCDATASection_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMCDATASection_methods[]= {
+ {0,0}
+};
+static swig_lua_method swig_DOMCDATASection_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMCDATASection_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMCDATASection_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMCDATASection_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMCDATASection_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMCDATASection_Sf_SwigStatic = {
+ "DOMCDATASection",
+ swig_DOMCDATASection_Sf_SwigStatic_methods,
+ swig_DOMCDATASection_Sf_SwigStatic_attributes,
+ swig_DOMCDATASection_Sf_SwigStatic_constants,
+ swig_DOMCDATASection_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMCDATASection_bases[] = {0,0};
+static const char *swig_DOMCDATASection_base_names[] = {"XERCES_CPP_NAMESPACE::DOMText *",0};
+static swig_lua_class _wrap_class_DOMCDATASection = { "DOMCDATASection", "DOMCDATASection", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMCDATASection,0, swig_delete_DOMCDATASection, swig_DOMCDATASection_methods, swig_DOMCDATASection_attributes, &swig_DOMCDATASection_Sf_SwigStatic, swig_DOMCDATASection_meta, swig_DOMCDATASection_bases, swig_DOMCDATASection_base_names };
+
+static int _wrap_DOMNodeList_item(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) 0 ;
+ XMLSize_t arg2 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNodeList::item",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNodeList::item",1,"XERCES_CPP_NAMESPACE::DOMNodeList const *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNodeList::item",2,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList,0))){
+ SWIG_fail_ptr("DOMNodeList_item",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNodeList const *)arg1)->item(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNodeList_getLength(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) 0 ;
+ XMLSize_t result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNodeList::getLength",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNodeList::getLength",1,"XERCES_CPP_NAMESPACE::DOMNodeList const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList,0))){
+ SWIG_fail_ptr("DOMNodeList_getLength",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList);
+ }
+
+ result = ((XERCES_CPP_NAMESPACE::DOMNodeList const *)arg1)->getLength();
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMNodeList(void *obj) {
+XERCES_CPP_NAMESPACE::DOMNodeList *arg1 = (XERCES_CPP_NAMESPACE::DOMNodeList *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMNodeList_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMNodeList_methods[]= {
+ { "item", _wrap_DOMNodeList_item},
+ { "getLength", _wrap_DOMNodeList_getLength},
+ {0,0}
+};
+static swig_lua_method swig_DOMNodeList_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMNodeList_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMNodeList_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMNodeList_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMNodeList_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMNodeList_Sf_SwigStatic = {
+ "DOMNodeList",
+ swig_DOMNodeList_Sf_SwigStatic_methods,
+ swig_DOMNodeList_Sf_SwigStatic_attributes,
+ swig_DOMNodeList_Sf_SwigStatic_constants,
+ swig_DOMNodeList_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMNodeList_bases[] = {0};
+static const char *swig_DOMNodeList_base_names[] = {0};
+static swig_lua_class _wrap_class_DOMNodeList = { "DOMNodeList", "DOMNodeList", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNodeList,0, swig_delete_DOMNodeList, swig_DOMNodeList_methods, swig_DOMNodeList_attributes, &swig_DOMNodeList_Sf_SwigStatic, swig_DOMNodeList_meta, swig_DOMNodeList_bases, swig_DOMNodeList_base_names };
+
+static int _wrap_DOMNamedNodeMap_setNamedItem(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::setNamedItem",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::setNamedItem",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::setNamedItem",2,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_setNamedItem",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_setNamedItem",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->setNamedItem(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_item(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLSize_t arg2 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::item",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::item",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::item",2,"XMLSize_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_item",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+ SWIG_contract_assert((lua_tonumber(L,2)>=0),"number must not be negative")
+ arg2 = (XMLSize_t)lua_tonumber(L, 2);
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->item(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_getNamedItem(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::getNamedItem",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::getNamedItem",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_getNamedItem",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getNamedItem((XMLCh const *)arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_getLength(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLSize_t result;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::getLength",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::getLength",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_getLength",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+ result = ((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getLength();
+ lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_removeNamedItem(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::removeNamedItem",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::removeNamedItem",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_removeNamedItem",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeNamedItem((XMLCh const *)arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_getNamedItemNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::getNamedItemNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::getNamedItemNS",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_getNamedItemNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)((XERCES_CPP_NAMESPACE::DOMNamedNodeMap const *)arg1)->getNamedItemNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_setNamedItemNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *arg2 = (XERCES_CPP_NAMESPACE::DOMNode *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::setNamedItemNS",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::setNamedItemNS",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::setNamedItemNS",2,"XERCES_CPP_NAMESPACE::DOMNode *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_setNamedItemNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_setNamedItemNS",2,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode);
+ }
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->setNamedItemNS(arg2);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNamedNodeMap_removeNamedItemNS(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+ XMLCh *arg3 = (XMLCh *) 0 ;
+ XERCES_CPP_NAMESPACE::DOMNode *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::removeNamedItemNS",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNamedNodeMap::removeNamedItemNS",1,"XERCES_CPP_NAMESPACE::DOMNamedNodeMap *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0))){
+ SWIG_fail_ptr("DOMNamedNodeMap_removeNamedItemNS",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+
+ arg3 = Lua2XMLString(3);
+
+ result = (XERCES_CPP_NAMESPACE::DOMNode *)(arg1)->removeNamedItemNS((XMLCh const *)arg2,(XMLCh const *)arg3);
+ {
+ swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, (void **) &result);
+ SWIG_NewPointerObj(L,(void*)result,ty,0); SWIG_arg++;
+ }
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+
+ delete[] arg3;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMNamedNodeMap(void *obj) {
+XERCES_CPP_NAMESPACE::DOMNamedNodeMap *arg1 = (XERCES_CPP_NAMESPACE::DOMNamedNodeMap *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMNamedNodeMap_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMNamedNodeMap_methods[]= {
+ { "setNamedItem", _wrap_DOMNamedNodeMap_setNamedItem},
+ { "item", _wrap_DOMNamedNodeMap_item},
+ { "getNamedItem", _wrap_DOMNamedNodeMap_getNamedItem},
+ { "getLength", _wrap_DOMNamedNodeMap_getLength},
+ { "removeNamedItem", _wrap_DOMNamedNodeMap_removeNamedItem},
+ { "getNamedItemNS", _wrap_DOMNamedNodeMap_getNamedItemNS},
+ { "setNamedItemNS", _wrap_DOMNamedNodeMap_setNamedItemNS},
+ { "removeNamedItemNS", _wrap_DOMNamedNodeMap_removeNamedItemNS},
+ {0,0}
+};
+static swig_lua_method swig_DOMNamedNodeMap_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMNamedNodeMap_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMNamedNodeMap_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMNamedNodeMap_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMNamedNodeMap_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMNamedNodeMap_SwigStatic = {
+ "DOMNamedNodeMap",
+ swig_DOMNamedNodeMap_SwigStatic_methods,
+ swig_DOMNamedNodeMap_SwigStatic_attributes,
+ swig_DOMNamedNodeMap_SwigStatic_constants,
+ swig_DOMNamedNodeMap_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMNamedNodeMap_bases[] = {0};
+static const char *swig_DOMNamedNodeMap_base_names[] = {0};
+static swig_lua_class _wrap_class_DOMNamedNodeMap = { "DOMNamedNodeMap", "DOMNamedNodeMap", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,0, swig_delete_DOMNamedNodeMap, swig_DOMNamedNodeMap_methods, swig_DOMNamedNodeMap_attributes, &swig_DOMNamedNodeMap_SwigStatic, swig_DOMNamedNodeMap_meta, swig_DOMNamedNodeMap_bases, swig_DOMNamedNodeMap_base_names };
+
+static void swig_delete_DOMDocumentFragment(void *obj) {
+XERCES_CPP_NAMESPACE::DOMDocumentFragment *arg1 = (XERCES_CPP_NAMESPACE::DOMDocumentFragment *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMDocumentFragment_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMDocumentFragment_methods[]= {
+ {0,0}
+};
+static swig_lua_method swig_DOMDocumentFragment_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMDocumentFragment_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMDocumentFragment_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMDocumentFragment_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMDocumentFragment_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMDocumentFragment_Sf_SwigStatic = {
+ "DOMDocumentFragment",
+ swig_DOMDocumentFragment_Sf_SwigStatic_methods,
+ swig_DOMDocumentFragment_Sf_SwigStatic_attributes,
+ swig_DOMDocumentFragment_Sf_SwigStatic_constants,
+ swig_DOMDocumentFragment_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMDocumentFragment_bases[] = {0,0};
+static const char *swig_DOMDocumentFragment_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMDocumentFragment = { "DOMDocumentFragment", "DOMDocumentFragment", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,0, swig_delete_DOMDocumentFragment, swig_DOMDocumentFragment_methods, swig_DOMDocumentFragment_attributes, &swig_DOMDocumentFragment_Sf_SwigStatic, swig_DOMDocumentFragment_meta, swig_DOMDocumentFragment_bases, swig_DOMDocumentFragment_base_names };
+
+static void swig_delete_DOMEntityReference(void *obj) {
+XERCES_CPP_NAMESPACE::DOMEntityReference *arg1 = (XERCES_CPP_NAMESPACE::DOMEntityReference *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMEntityReference_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMEntityReference_methods[]= {
+ {0,0}
+};
+static swig_lua_method swig_DOMEntityReference_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMEntityReference_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMEntityReference_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMEntityReference_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMEntityReference_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMEntityReference_Sf_SwigStatic = {
+ "DOMEntityReference",
+ swig_DOMEntityReference_Sf_SwigStatic_methods,
+ swig_DOMEntityReference_Sf_SwigStatic_attributes,
+ swig_DOMEntityReference_Sf_SwigStatic_constants,
+ swig_DOMEntityReference_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMEntityReference_bases[] = {0,0};
+static const char *swig_DOMEntityReference_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMEntityReference = { "DOMEntityReference", "DOMEntityReference", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMEntityReference,0, swig_delete_DOMEntityReference, swig_DOMEntityReference_methods, swig_DOMEntityReference_attributes, &swig_DOMEntityReference_Sf_SwigStatic, swig_DOMEntityReference_meta, swig_DOMEntityReference_bases, swig_DOMEntityReference_base_names };
+
+static int _wrap_DOMNotation_getPublicId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNotation::getPublicId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNotation::getPublicId",1,"XERCES_CPP_NAMESPACE::DOMNotation const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation,0))){
+ SWIG_fail_ptr("DOMNotation_getPublicId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNotation const *)arg1)->getPublicId();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMNotation_getSystemId(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMNotation::getSystemId",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMNotation::getSystemId",1,"XERCES_CPP_NAMESPACE::DOMNotation const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation,0))){
+ SWIG_fail_ptr("DOMNotation_getSystemId",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMNotation const *)arg1)->getSystemId();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMNotation(void *obj) {
+XERCES_CPP_NAMESPACE::DOMNotation *arg1 = (XERCES_CPP_NAMESPACE::DOMNotation *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMNotation_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMNotation_methods[]= {
+ { "getPublicId", _wrap_DOMNotation_getPublicId},
+ { "getSystemId", _wrap_DOMNotation_getSystemId},
+ {0,0}
+};
+static swig_lua_method swig_DOMNotation_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMNotation_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMNotation_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMNotation_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMNotation_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMNotation_Sf_SwigStatic = {
+ "DOMNotation",
+ swig_DOMNotation_Sf_SwigStatic_methods,
+ swig_DOMNotation_Sf_SwigStatic_attributes,
+ swig_DOMNotation_Sf_SwigStatic_constants,
+ swig_DOMNotation_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMNotation_bases[] = {0,0};
+static const char *swig_DOMNotation_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMNotation = { "DOMNotation", "DOMNotation", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNotation,0, swig_delete_DOMNotation, swig_DOMNotation_methods, swig_DOMNotation_attributes, &swig_DOMNotation_Sf_SwigStatic, swig_DOMNotation_meta, swig_DOMNotation_bases, swig_DOMNotation_base_names };
+
+static int _wrap_DOMProcessingInstruction_getTarget(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMProcessingInstruction::getTarget",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMProcessingInstruction::getTarget",1,"XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,0))){
+ SWIG_fail_ptr("DOMProcessingInstruction_getTarget",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *)arg1)->getTarget();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMProcessingInstruction_getData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ XMLCh *result = 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMProcessingInstruction::getData",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMProcessingInstruction::getData",1,"XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,0))){
+ SWIG_fail_ptr("DOMProcessingInstruction_getData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction);
+ }
+
+ result = (XMLCh *)((XERCES_CPP_NAMESPACE::DOMProcessingInstruction const *)arg1)->getData();
+
+ result = XMLString2Lua(result);
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_DOMProcessingInstruction_setData(lua_State* L) {
+ int SWIG_arg = 0;
+ XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) 0 ;
+ XMLCh *arg2 = (XMLCh *) 0 ;
+
+ SWIG_check_num_args("XERCES_CPP_NAMESPACE::DOMProcessingInstruction::setData",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("XERCES_CPP_NAMESPACE::DOMProcessingInstruction::setData",1,"XERCES_CPP_NAMESPACE::DOMProcessingInstruction *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,0))){
+ SWIG_fail_ptr("DOMProcessingInstruction_setData",1,SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction);
+ }
+
+
+ arg2 = Lua2XMLString(2);
+
+ (arg1)->setData((XMLCh const *)arg2);
+
+
+ delete[] arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+
+ delete[] arg2;
+
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_DOMProcessingInstruction(void *obj) {
+XERCES_CPP_NAMESPACE::DOMProcessingInstruction *arg1 = (XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) obj;
+delete arg1;
+}
+static swig_lua_attribute swig_DOMProcessingInstruction_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_DOMProcessingInstruction_methods[]= {
+ { "getTarget", _wrap_DOMProcessingInstruction_getTarget},
+ { "getData", _wrap_DOMProcessingInstruction_getData},
+ { "setData", _wrap_DOMProcessingInstruction_setData},
+ {0,0}
+};
+static swig_lua_method swig_DOMProcessingInstruction_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_DOMProcessingInstruction_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_DOMProcessingInstruction_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_DOMProcessingInstruction_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_DOMProcessingInstruction_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_DOMProcessingInstruction_Sf_SwigStatic = {
+ "DOMProcessingInstruction",
+ swig_DOMProcessingInstruction_Sf_SwigStatic_methods,
+ swig_DOMProcessingInstruction_Sf_SwigStatic_attributes,
+ swig_DOMProcessingInstruction_Sf_SwigStatic_constants,
+ swig_DOMProcessingInstruction_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_DOMProcessingInstruction_bases[] = {0,0};
+static const char *swig_DOMProcessingInstruction_base_names[] = {"XERCES_CPP_NAMESPACE::DOMNode *",0};
+static swig_lua_class _wrap_class_DOMProcessingInstruction = { "DOMProcessingInstruction", "DOMProcessingInstruction", &SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,0, swig_delete_DOMProcessingInstruction, swig_DOMProcessingInstruction_methods, swig_DOMProcessingInstruction_attributes, &swig_DOMProcessingInstruction_Sf_SwigStatic, swig_DOMProcessingInstruction_meta, swig_DOMProcessingInstruction_bases, swig_DOMProcessingInstruction_base_names };
+
+static int _wrap_new_Event__SWIG_0(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *result = 0 ;
+
+ SWIG_check_num_args("uscxml::Event::Event",0,0)
+ result = (uscxml::Event *)new uscxml::Event();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_uscxml__Event,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_Event__SWIG_1(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = 0 ;
+ uscxml::Event::Type arg2 ;
+ std::string temp1 ;
+ uscxml::Event *result = 0 ;
+
+ SWIG_check_num_args("uscxml::Event::Event",2,2)
+ if(!lua_isstring(L,1)) SWIG_fail_arg("uscxml::Event::Event",1,"std::string const &");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("uscxml::Event::Event",2,"uscxml::Event::Type");
+ temp1.assign(lua_tostring(L,1),lua_rawlen(L,1)); arg1=&temp1;
+ arg2 = (uscxml::Event::Type)(int)lua_tonumber(L, 2);
+ result = (uscxml::Event *)new uscxml::Event((std::string const &)*arg1,arg2);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_uscxml__Event,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_Event__SWIG_2(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = 0 ;
+ std::string temp1 ;
+ uscxml::Event *result = 0 ;
+
+ SWIG_check_num_args("uscxml::Event::Event",1,1)
+ if(!lua_isstring(L,1)) SWIG_fail_arg("uscxml::Event::Event",1,"std::string const &");
+ temp1.assign(lua_tostring(L,1),lua_rawlen(L,1)); arg1=&temp1;
+ result = (uscxml::Event *)new uscxml::Event((std::string const &)*arg1);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_uscxml__Event,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_Event(lua_State* L) {
+ int argc;
+ int argv[3]={
+ 1,2,3
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 0) {
+ return _wrap_new_Event__SWIG_0(L);
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ _v = lua_isstring(L,argv[0]);
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_2(L);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ _v = lua_isstring(L,argv[0]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L,argv[1]);
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_1(L);
+ }
+ }
+ }
+
+ SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_Event'\n"
+ " Possible C/C++ prototypes are:\n"
+ " uscxml::Event::Event()\n"
+ " uscxml::Event::Event(std::string const &,uscxml::Event::Type)\n"
+ " uscxml::Event::Event(std::string const &)\n");
+ lua_error(L);return 0;
+}
+
+
+static int _wrap_Event___lt(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event *arg2 = 0 ;
+ bool result;
+
+ SWIG_check_num_args("uscxml::Event::operator <",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::operator <",1,"uscxml::Event const *");
+ if(!lua_isuserdata(L,2)) SWIG_fail_arg("uscxml::Event::operator <",2,"uscxml::Event const &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event___lt",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event___lt",2,SWIGTYPE_p_uscxml__Event);
+ }
+
+ result = (bool)((uscxml::Event const *)arg1)->operator <((uscxml::Event const &)*arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event___eq(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event *arg2 = 0 ;
+ bool result;
+
+ SWIG_check_num_args("uscxml::Event::operator ==",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::operator ==",1,"uscxml::Event const *");
+ if(!lua_isuserdata(L,2)) SWIG_fail_arg("uscxml::Event::operator ==",2,"uscxml::Event const &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event___eq",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event___eq",2,SWIGTYPE_p_uscxml__Event);
+ }
+
+ result = (bool)((uscxml::Event const *)arg1)->operator ==((uscxml::Event const &)*arg2);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_getParam__SWIG_0(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ Data *arg3 = 0 ;
+ std::string temp2 ;
+ bool result;
+
+ SWIG_check_num_args("uscxml::Event::getParam",3,3)
+ if(!lua_isuserdata(L,1)) SWIG_fail_arg("uscxml::Event::getParam",1,"uscxml::Event::params_t const &");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("uscxml::Event::getParam",2,"std::string const &");
+ if(!lua_isuserdata(L,3)) SWIG_fail_arg("uscxml::Event::getParam",3,"Data &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__multimapT_std__string_Data_t,0))){
+ SWIG_fail_ptr("Event_getParam",1,SWIGTYPE_p_std__multimapT_std__string_Data_t);
+ }
+
+ temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_Data,0))){
+ SWIG_fail_ptr("Event_getParam",3,SWIGTYPE_p_Data);
+ }
+
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_getParam__SWIG_1(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ std::list< Data > *arg3 = 0 ;
+ std::string temp2 ;
+ bool result;
+
+ SWIG_check_num_args("uscxml::Event::getParam",3,3)
+ if(!lua_isuserdata(L,1)) SWIG_fail_arg("uscxml::Event::getParam",1,"uscxml::Event::params_t const &");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("uscxml::Event::getParam",2,"std::string const &");
+ if(!lua_isuserdata(L,3)) SWIG_fail_arg("uscxml::Event::getParam",3,"std::list< Data > &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__multimapT_std__string_Data_t,0))){
+ SWIG_fail_ptr("Event_getParam",1,SWIGTYPE_p_std__multimapT_std__string_Data_t);
+ }
+
+ temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_std__listT_Data_t,0))){
+ SWIG_fail_ptr("Event_getParam",3,SWIGTYPE_p_std__listT_Data_t);
+ }
+
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_getParam__SWIG_3(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event::params_t *arg1 = 0 ;
+ std::string *arg2 = 0 ;
+ bool *arg3 = 0 ;
+ std::string temp2 ;
+ bool result;
+
+ SWIG_check_num_args("uscxml::Event::getParam",3,3)
+ if(!lua_isuserdata(L,1)) SWIG_fail_arg("uscxml::Event::getParam",1,"uscxml::Event::params_t const &");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("uscxml::Event::getParam",2,"std::string const &");
+ if(!lua_isuserdata(L,3)) SWIG_fail_arg("uscxml::Event::getParam",3,"bool &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__multimapT_std__string_Data_t,0))){
+ SWIG_fail_ptr("Event_getParam",1,SWIGTYPE_p_std__multimapT_std__string_Data_t);
+ }
+
+ temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_bool,0))){
+ SWIG_fail_ptr("Event_getParam",3,SWIGTYPE_p_bool);
+ }
+
+ result = (bool)uscxml::Event::getParam((std::multimap< std::string,Data > const &)*arg1,(std::string const &)*arg2,*arg3);
+ lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_getParam(lua_State* L) {
+ int argc;
+ int argv[4]={
+ 1,2,3,4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (lua_isuserdata(L,argv[2])==0 || SWIG_ConvertPtr(L,argv[2], (void **) &ptr, SWIGTYPE_p_Data, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_Event_getParam__SWIG_0(L);
+ }
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (lua_isuserdata(L,argv[2])==0 || SWIG_ConvertPtr(L,argv[2], (void **) &ptr, SWIGTYPE_p_std__listT_Data_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_Event_getParam__SWIG_1(L);
+ }
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_std__multimapT_std__string_Data_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (lua_isuserdata(L,argv[2])==0 || SWIG_ConvertPtr(L,argv[2], (void **) &ptr, SWIGTYPE_p_bool, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_Event_getParam__SWIG_3(L);
+ }
+ }
+ }
+ }
+
+ SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Event_getParam'\n"
+ " Possible C/C++ prototypes are:\n"
+ " uscxml::Event::getParam(uscxml::Event::params_t const &,std::string const &,Data &)\n"
+ " uscxml::Event::getParam(uscxml::Event::params_t const &,std::string const &,std::list< Data > &)\n"
+ " uscxml::Event::getParam(uscxml::Event::params_t const &,std::string const &,bool &)\n");
+ lua_error(L);return 0;
+}
+
+
+static int _wrap_Event_raw_set(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *arg2 = 0 ;
+ std::string temp2 ;
+
+ SWIG_check_num_args("uscxml::Event::raw",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::raw",1,"uscxml::Event *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("uscxml::Event::raw",2,"std::string const &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event_raw_set",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+ temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
+ if (arg1) (arg1)->raw = *arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_raw_get(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *result = 0 ;
+
+ SWIG_check_num_args("uscxml::Event::raw",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::raw",1,"uscxml::Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event_raw_get",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+ result = (std::string *) & ((arg1)->raw);
+ lua_pushlstring(L,result->data(),result->size()); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_name_set(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *arg2 = 0 ;
+ std::string temp2 ;
+
+ SWIG_check_num_args("uscxml::Event::name",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::name",1,"uscxml::Event *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("uscxml::Event::name",2,"std::string const &");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event_name_set",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+ temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
+ if (arg1) (arg1)->name = *arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_name_get(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ std::string *result = 0 ;
+
+ SWIG_check_num_args("uscxml::Event::name",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::name",1,"uscxml::Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event_name_get",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+ result = (std::string *) & ((arg1)->name);
+ lua_pushlstring(L,result->data(),result->size()); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_eventType_set(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event::Type arg2 ;
+
+ SWIG_check_num_args("uscxml::Event::eventType",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::eventType",1,"uscxml::Event *");
+ if(!lua_isnumber(L,2)) SWIG_fail_arg("uscxml::Event::eventType",2,"uscxml::Event::Type");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event_eventType_set",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+ arg2 = (uscxml::Event::Type)(int)lua_tonumber(L, 2);
+ if (arg1) (arg1)->eventType = arg2;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Event_eventType_get(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::Event *arg1 = (uscxml::Event *) 0 ;
+ uscxml::Event::Type result;
+
+ SWIG_check_num_args("uscxml::Event::eventType",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uscxml::Event::eventType",1,"uscxml::Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_uscxml__Event,0))){
+ SWIG_fail_ptr("Event_eventType_get",1,SWIGTYPE_p_uscxml__Event);
+ }
+
+ result = (uscxml::Event::Type) ((arg1)->eventType);
+ lua_pushnumber(L, (lua_Number)(int)(result)); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_Event(void *obj) {
+uscxml::Event *arg1 = (uscxml::Event *) obj;
+delete arg1;
+}
+static int _proxy__wrap_new_Event(lua_State *L) {
+ assert(lua_istable(L,1));
+ lua_pushcfunction(L,_wrap_new_Event);
+ assert(!lua_isnil(L,-1));
+ lua_replace(L,1); /* replace our table with real constructor */
+ lua_call(L,lua_gettop(L)-1,1);
+ return 1;
+}
+static swig_lua_attribute swig_Event_attributes[] = {
+ { "raw", _wrap_Event_raw_get, _wrap_Event_raw_set },
+ { "name", _wrap_Event_name_get, _wrap_Event_name_set },
+ { "eventType", _wrap_Event_eventType_get, _wrap_Event_eventType_set },
+ {0,0,0}
+};
+static swig_lua_method swig_Event_methods[]= {
+ { "__lt", _wrap_Event___lt},
+ { "__eq", _wrap_Event___eq},
+ {0,0}
+};
+static swig_lua_method swig_Event_meta[] = {
+ { "__lt", _wrap_Event___lt},
+ { "__eq", _wrap_Event___eq},
+ {0,0}
+};
+
+static swig_lua_attribute swig_Event_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_Event_Sf_SwigStatic_constants[]= {
+ {SWIG_LUA_CONSTTAB_INT("INTERNAL", uscxml::Event::INTERNAL)},
+ {SWIG_LUA_CONSTTAB_INT("EXTERNAL", uscxml::Event::EXTERNAL)},
+ {SWIG_LUA_CONSTTAB_INT("PLATFORM", uscxml::Event::PLATFORM)},
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_Event_Sf_SwigStatic_methods[]= {
+ { "getParam", _wrap_Event_getParam},
+ {0,0}
+};
+static swig_lua_class* swig_Event_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_Event_Sf_SwigStatic = {
+ "Event",
+ swig_Event_Sf_SwigStatic_methods,
+ swig_Event_Sf_SwigStatic_attributes,
+ swig_Event_Sf_SwigStatic_constants,
+ swig_Event_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_Event_bases[] = {0};
+static const char *swig_Event_base_names[] = {0};
+static swig_lua_class _wrap_class_Event = { "Event", "Event", &SWIGTYPE_p_uscxml__Event,_proxy__wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, &swig_Event_Sf_SwigStatic, swig_Event_meta, swig_Event_bases, swig_Event_base_names };
+
+static int _wrap_new_ErrorEvent__SWIG_0(lua_State* L) {
+ int SWIG_arg = 0;
+ uscxml::ErrorEvent *result = 0 ;
+
+ SWIG_check_num_args("uscxml::ErrorEvent::ErrorEvent",0,0)
+ result = (uscxml::ErrorEvent *)new uscxml::ErrorEvent();
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_uscxml__ErrorEvent,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_ErrorEvent__SWIG_1(lua_State* L) {
+ int SWIG_arg = 0;
+ std::string *arg1 = 0 ;
+ std::string temp1 ;
+ uscxml::ErrorEvent *result = 0 ;
+
+ SWIG_check_num_args("uscxml::ErrorEvent::ErrorEvent",1,1)
+ if(!lua_isstring(L,1)) SWIG_fail_arg("uscxml::ErrorEvent::ErrorEvent",1,"std::string const &");
+ temp1.assign(lua_tostring(L,1),lua_rawlen(L,1)); arg1=&temp1;
+ result = (uscxml::ErrorEvent *)new uscxml::ErrorEvent((std::string const &)*arg1);
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_uscxml__ErrorEvent,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_ErrorEvent(lua_State* L) {
+ int argc;
+ int argv[2]={
+ 1,2
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 0) {
+ return _wrap_new_ErrorEvent__SWIG_0(L);
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ _v = lua_isstring(L,argv[0]);
+ }
+ if (_v) {
+ return _wrap_new_ErrorEvent__SWIG_1(L);
+ }
+ }
+
+ SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_ErrorEvent'\n"
+ " Possible C/C++ prototypes are:\n"
+ " uscxml::ErrorEvent::ErrorEvent()\n"
+ " uscxml::ErrorEvent::ErrorEvent(std::string const &)\n");
+ lua_error(L);return 0;
+}
+
+
+static void swig_delete_ErrorEvent(void *obj) {
+uscxml::ErrorEvent *arg1 = (uscxml::ErrorEvent *) obj;
+delete arg1;
+}
+static int _proxy__wrap_new_ErrorEvent(lua_State *L) {
+ assert(lua_istable(L,1));
+ lua_pushcfunction(L,_wrap_new_ErrorEvent);
+ assert(!lua_isnil(L,-1));
+ lua_replace(L,1); /* replace our table with real constructor */
+ lua_call(L,lua_gettop(L)-1,1);
+ return 1;
+}
+static swig_lua_attribute swig_ErrorEvent_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_method swig_ErrorEvent_methods[]= {
+ {0,0}
+};
+static swig_lua_method swig_ErrorEvent_meta[] = {
+ {0,0}
+};
+
+static swig_lua_attribute swig_ErrorEvent_Sf_SwigStatic_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_const_info swig_ErrorEvent_Sf_SwigStatic_constants[]= {
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_ErrorEvent_Sf_SwigStatic_methods[]= {
+ {0,0}
+};
+static swig_lua_class* swig_ErrorEvent_Sf_SwigStatic_classes[]= {
+ 0
+};
+
+static swig_lua_namespace swig_ErrorEvent_Sf_SwigStatic = {
+ "ErrorEvent",
+ swig_ErrorEvent_Sf_SwigStatic_methods,
+ swig_ErrorEvent_Sf_SwigStatic_attributes,
+ swig_ErrorEvent_Sf_SwigStatic_constants,
+ swig_ErrorEvent_Sf_SwigStatic_classes,
+ 0
+};
+static swig_lua_class *swig_ErrorEvent_bases[] = {0,0};
+static const char *swig_ErrorEvent_base_names[] = {"uscxml::Event *",0};
+static swig_lua_class _wrap_class_ErrorEvent = { "ErrorEvent", "ErrorEvent", &SWIGTYPE_p_uscxml__ErrorEvent,_proxy__wrap_new_ErrorEvent, swig_delete_ErrorEvent, swig_ErrorEvent_methods, swig_ErrorEvent_attributes, &swig_ErrorEvent_Sf_SwigStatic, swig_ErrorEvent_meta, swig_ErrorEvent_bases, swig_ErrorEvent_base_names };
+
+static swig_lua_attribute swig_SwigModule_attributes[] = {
+ { "DEBUG_UTF8_OUT", _wrap_DEBUG_UTF8_OUT_get, _wrap_DEBUG_UTF8_OUT_set },
+ { "DEBUG_UTF8_IN", _wrap_DEBUG_UTF8_IN_get, _wrap_DEBUG_UTF8_IN_set },
+ {0,0,0}
+};
+static swig_lua_const_info swig_SwigModule_constants[]= {
+ {SWIG_LUA_CONSTTAB_INT("XERCES_HAS_CPP_NAMESPACE", 1)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_INDEX_SIZE_ERR", XERCES_CPP_NAMESPACE::DOMException::INDEX_SIZE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_DOMSTRING_SIZE_ERR", XERCES_CPP_NAMESPACE::DOMException::DOMSTRING_SIZE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_HIERARCHY_REQUEST_ERR", XERCES_CPP_NAMESPACE::DOMException::HIERARCHY_REQUEST_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_WRONG_DOCUMENT_ERR", XERCES_CPP_NAMESPACE::DOMException::WRONG_DOCUMENT_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_INVALID_CHARACTER_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_CHARACTER_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_NO_DATA_ALLOWED_ERR", XERCES_CPP_NAMESPACE::DOMException::NO_DATA_ALLOWED_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_NO_MODIFICATION_ALLOWED_ERR", XERCES_CPP_NAMESPACE::DOMException::NO_MODIFICATION_ALLOWED_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_NOT_FOUND_ERR", XERCES_CPP_NAMESPACE::DOMException::NOT_FOUND_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_NOT_SUPPORTED_ERR", XERCES_CPP_NAMESPACE::DOMException::NOT_SUPPORTED_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_INUSE_ATTRIBUTE_ERR", XERCES_CPP_NAMESPACE::DOMException::INUSE_ATTRIBUTE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_INVALID_STATE_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_STATE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_SYNTAX_ERR", XERCES_CPP_NAMESPACE::DOMException::SYNTAX_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_INVALID_MODIFICATION_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_MODIFICATION_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_NAMESPACE_ERR", XERCES_CPP_NAMESPACE::DOMException::NAMESPACE_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_INVALID_ACCESS_ERR", XERCES_CPP_NAMESPACE::DOMException::INVALID_ACCESS_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_VALIDATION_ERR", XERCES_CPP_NAMESPACE::DOMException::VALIDATION_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMException_TYPE_MISMATCH_ERR", XERCES_CPP_NAMESPACE::DOMException::TYPE_MISMATCH_ERR)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_ELEMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::ELEMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_ATTRIBUTE_NODE", XERCES_CPP_NAMESPACE::DOMNode::ATTRIBUTE_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_TEXT_NODE", XERCES_CPP_NAMESPACE::DOMNode::TEXT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_CDATA_SECTION_NODE", XERCES_CPP_NAMESPACE::DOMNode::CDATA_SECTION_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_ENTITY_REFERENCE_NODE", XERCES_CPP_NAMESPACE::DOMNode::ENTITY_REFERENCE_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_ENTITY_NODE", XERCES_CPP_NAMESPACE::DOMNode::ENTITY_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_PROCESSING_INSTRUCTION_NODE", XERCES_CPP_NAMESPACE::DOMNode::PROCESSING_INSTRUCTION_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_COMMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::COMMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_TYPE_NODE", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_TYPE_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_FRAGMENT_NODE", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_FRAGMENT_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_NOTATION_NODE", XERCES_CPP_NAMESPACE::DOMNode::NOTATION_NODE)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_POSITION_DISCONNECTED", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_DISCONNECTED)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_POSITION_PRECEDING", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_PRECEDING)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_POSITION_FOLLOWING", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_FOLLOWING)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_POSITION_CONTAINS", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINS)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_POSITION_CONTAINED_BY", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_CONTAINED_BY)},
+ {SWIG_LUA_CONSTTAB_INT("DOMNode_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)},
+ {SWIG_LUA_CONSTTAB_INT("Event_INTERNAL", uscxml::Event::INTERNAL)},
+ {SWIG_LUA_CONSTTAB_INT("Event_EXTERNAL", uscxml::Event::EXTERNAL)},
+ {SWIG_LUA_CONSTTAB_INT("Event_PLATFORM", uscxml::Event::PLATFORM)},
+ {0,0,0,0,0,0}
+};
+static swig_lua_method swig_SwigModule_methods[]= {
+ { "Event_getParam", _wrap_Event_getParam},
+ {0,0}
+};
+static swig_lua_class* swig_SwigModule_classes[]= {
+&_wrap_class_string,
+&_wrap_class_DOMException,
+&_wrap_class_DOMNode,
+&_wrap_class_DOMAttr,
+&_wrap_class_DOMElement,
+&_wrap_class_DOMEntity,
+&_wrap_class_DOMDocumentType,
+&_wrap_class_DOMCharacterData,
+&_wrap_class_DOMComment,
+&_wrap_class_DOMText,
+&_wrap_class_DOMCDATASection,
+&_wrap_class_DOMNodeList,
+&_wrap_class_DOMNamedNodeMap,
+&_wrap_class_DOMDocumentFragment,
+&_wrap_class_DOMEntityReference,
+&_wrap_class_DOMNotation,
+&_wrap_class_DOMProcessingInstruction,
+&_wrap_class_Event,
+&_wrap_class_ErrorEvent,
+ 0
+};
+static swig_lua_namespace* swig_SwigModule_namespaces[] = {
+ 0
+};
+
+static swig_lua_namespace swig_SwigModule = {
+ "LuaDOM",
+ swig_SwigModule_methods,
+ swig_SwigModule_attributes,
+ swig_SwigModule_constants,
+ swig_SwigModule_classes,
+ swig_SwigModule_namespaces
+};
+#ifdef __cplusplus
+}
+#endif
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMText(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMText *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMComment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMCharacterData *) (XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMElementTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMElement *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMDocumentFragmentTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMDocumentFragment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMAttrTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMAttr *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMDocumentTypeTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMDocumentType *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCharacterDataTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMCharacterData *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMText *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *) ((XERCES_CPP_NAMESPACE::DOMComment *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMProcessingInstructionTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMProcessingInstruction *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMEntityTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMEntity *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMEntityReferenceTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMEntityReference *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) (XERCES_CPP_NAMESPACE::DOMCharacterData *)(XERCES_CPP_NAMESPACE::DOMText *) ((XERCES_CPP_NAMESPACE::DOMCDATASection *) x));
+}
+static void *_p_XERCES_CPP_NAMESPACE__DOMNotationTo_p_XERCES_CPP_NAMESPACE__DOMNode(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((XERCES_CPP_NAMESPACE::DOMNode *) ((XERCES_CPP_NAMESPACE::DOMNotation *) x));
+}
+static void *_p_uscxml__ErrorEventTo_p_uscxml__Event(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+ return (void *)((uscxml::Event *) ((uscxml::ErrorEvent *) x));
+}
+static swig_type_info _swigt__p_Data = {"_p_Data", "Data *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMAttr = {"_p_XERCES_CPP_NAMESPACE__DOMAttr", "XERCES_CPP_NAMESPACE::DOMAttr *", 0, 0, (void*)&_wrap_class_DOMAttr, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection = {"_p_XERCES_CPP_NAMESPACE__DOMCDATASection", "XERCES_CPP_NAMESPACE::DOMCDATASection *", 0, 0, (void*)&_wrap_class_DOMCDATASection, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData = {"_p_XERCES_CPP_NAMESPACE__DOMCharacterData", "XERCES_CPP_NAMESPACE::DOMCharacterData *", 0, 0, (void*)&_wrap_class_DOMCharacterData, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMComment = {"_p_XERCES_CPP_NAMESPACE__DOMComment", "XERCES_CPP_NAMESPACE::DOMComment *", 0, 0, (void*)&_wrap_class_DOMComment, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocument = {"_p_XERCES_CPP_NAMESPACE__DOMDocument", "XERCES_CPP_NAMESPACE::DOMDocument *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment = {"_p_XERCES_CPP_NAMESPACE__DOMDocumentFragment", "XERCES_CPP_NAMESPACE::DOMDocumentFragment *", 0, 0, (void*)&_wrap_class_DOMDocumentFragment, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType = {"_p_XERCES_CPP_NAMESPACE__DOMDocumentType", "XERCES_CPP_NAMESPACE::DOMDocumentType *", 0, 0, (void*)&_wrap_class_DOMDocumentType, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMElement = {"_p_XERCES_CPP_NAMESPACE__DOMElement", "XERCES_CPP_NAMESPACE::DOMElement *", 0, 0, (void*)&_wrap_class_DOMElement, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMEntity = {"_p_XERCES_CPP_NAMESPACE__DOMEntity", "XERCES_CPP_NAMESPACE::DOMEntity *", 0, 0, (void*)&_wrap_class_DOMEntity, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference = {"_p_XERCES_CPP_NAMESPACE__DOMEntityReference", "XERCES_CPP_NAMESPACE::DOMEntityReference *", 0, 0, (void*)&_wrap_class_DOMEntityReference, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMException = {"_p_XERCES_CPP_NAMESPACE__DOMException", "XERCES_CPP_NAMESPACE::DOMException *", 0, 0, (void*)&_wrap_class_DOMException, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap = {"_p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap", "XERCES_CPP_NAMESPACE::DOMNamedNodeMap *", 0, 0, (void*)&_wrap_class_DOMNamedNodeMap, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNode = {"_p_XERCES_CPP_NAMESPACE__DOMNode", "XERCES_CPP_NAMESPACE::DOMNode *", 0, 0, (void*)&_wrap_class_DOMNode, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList = {"_p_XERCES_CPP_NAMESPACE__DOMNodeList", "XERCES_CPP_NAMESPACE::DOMNodeList *", 0, 0, (void*)&_wrap_class_DOMNodeList, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMNotation = {"_p_XERCES_CPP_NAMESPACE__DOMNotation", "XERCES_CPP_NAMESPACE::DOMNotation *", 0, 0, (void*)&_wrap_class_DOMNotation, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction = {"_p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction", "XERCES_CPP_NAMESPACE::DOMProcessingInstruction *", 0, 0, (void*)&_wrap_class_DOMProcessingInstruction, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMText = {"_p_XERCES_CPP_NAMESPACE__DOMText", "XERCES_CPP_NAMESPACE::DOMText *", 0, 0, (void*)&_wrap_class_DOMText, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo = {"_p_XERCES_CPP_NAMESPACE__DOMTypeInfo", "XERCES_CPP_NAMESPACE::DOMTypeInfo *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler = {"_p_XERCES_CPP_NAMESPACE__DOMUserDataHandler", "XERCES_CPP_NAMESPACE::DOMUserDataHandler *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XERCES_CPP_NAMESPACE__MemoryManager = {"_p_XERCES_CPP_NAMESPACE__MemoryManager", "XERCES_CPP_NAMESPACE::MemoryManager *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_bool = {"_p_bool", "bool *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int16_t = {"_p_int16_t", "XMLInt16 *|int16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int32_t = {"_p_int32_t", "int32_t *|XMLInt32 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int64_t = {"_p_int64_t", "int64_t *|XMLInt64 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_namelist_t = {"_p_namelist_t", "namelist_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_params_t = {"_p_params_t", "params_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *|XMLSize_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ssize_t = {"_p_ssize_t", "ssize_t *|XMLSSize_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__listT_Data_t = {"_p_std__listT_Data_t", "std::list< Data > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__multimapT_std__string_Data_t = {"_p_std__multimapT_std__string_Data_t", "uscxml::Event::params_t *|std::multimap< std::string,Data > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)&_wrap_class_string, 0};
+static swig_type_info _swigt__p_uint16_t = {"_p_uint16_t", "XMLUInt16 *|UTF16Ch *|XMLCh *|uint16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *|XMLUInt32 *|UCS4Ch *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint64_t = {"_p_uint64_t", "uint64_t *|XMLUInt64 *|XMLFilePos *|XMLFileLoc *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|XMLByte *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uscxml__ErrorEvent = {"_p_uscxml__ErrorEvent", "uscxml::ErrorEvent *", 0, 0, (void*)&_wrap_class_ErrorEvent, 0};
+static swig_type_info _swigt__p_uscxml__Event = {"_p_uscxml__Event", "uscxml::Event *", 0, 0, (void*)&_wrap_class_Event, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_Data,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMComment,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocument,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMElement,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMException,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNode,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMText,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo,
+ &_swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,
+ &_swigt__p_XERCES_CPP_NAMESPACE__MemoryManager,
+ &_swigt__p_bool,
+ &_swigt__p_int16_t,
+ &_swigt__p_int32_t,
+ &_swigt__p_int64_t,
+ &_swigt__p_namelist_t,
+ &_swigt__p_params_t,
+ &_swigt__p_size_t,
+ &_swigt__p_ssize_t,
+ &_swigt__p_std__listT_Data_t,
+ &_swigt__p_std__multimapT_std__string_Data_t,
+ &_swigt__p_std__string,
+ &_swigt__p_uint16_t,
+ &_swigt__p_uint32_t,
+ &_swigt__p_uint64_t,
+ &_swigt__p_unsigned_char,
+ &_swigt__p_uscxml__ErrorEvent,
+ &_swigt__p_uscxml__Event,
+ &_swigt__p_void,
+};
+
+static swig_cast_info _swigc__p_Data[] = { {&_swigt__p_Data, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMAttr[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMCDATASection[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMCharacterData[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, _p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, _p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMCharacterData, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMComment[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocument[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocument, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentType[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMElement[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMElement, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMEntity[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMEntityReference[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMException[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMException, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNode[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMElement, _p_XERCES_CPP_NAMESPACE__DOMElementTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment, _p_XERCES_CPP_NAMESPACE__DOMDocumentFragmentTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMAttr, _p_XERCES_CPP_NAMESPACE__DOMAttrTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMDocumentType, _p_XERCES_CPP_NAMESPACE__DOMDocumentTypeTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCharacterData, _p_XERCES_CPP_NAMESPACE__DOMCharacterDataTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, _p_XERCES_CPP_NAMESPACE__DOMTextTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMComment, _p_XERCES_CPP_NAMESPACE__DOMCommentTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, _p_XERCES_CPP_NAMESPACE__DOMProcessingInstructionTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntity, _p_XERCES_CPP_NAMESPACE__DOMEntityTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMEntityReference, _p_XERCES_CPP_NAMESPACE__DOMEntityReferenceTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation, _p_XERCES_CPP_NAMESPACE__DOMNotationTo_p_XERCES_CPP_NAMESPACE__DOMNode, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNodeList[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNodeList, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMNotation[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMNotation, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMText[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMText, 0, 0, 0}, {&_swigt__p_XERCES_CPP_NAMESPACE__DOMCDATASection, _p_XERCES_CPP_NAMESPACE__DOMCDATASectionTo_p_XERCES_CPP_NAMESPACE__DOMText, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMTypeInfo[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMTypeInfo, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XERCES_CPP_NAMESPACE__MemoryManager[] = { {&_swigt__p_XERCES_CPP_NAMESPACE__MemoryManager, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_bool[] = { {&_swigt__p_bool, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int16_t[] = { {&_swigt__p_int16_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int32_t[] = { {&_swigt__p_int32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int64_t[] = { {&_swigt__p_int64_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_namelist_t[] = { {&_swigt__p_namelist_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_params_t[] = { {&_swigt__p_params_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_size_t[] = { {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ssize_t[] = { {&_swigt__p_ssize_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__listT_Data_t[] = { {&_swigt__p_std__listT_Data_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__multimapT_std__string_Data_t[] = { {&_swigt__p_std__multimapT_std__string_Data_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint16_t[] = { {&_swigt__p_uint16_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint64_t[] = { {&_swigt__p_uint64_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uscxml__ErrorEvent[] = { {&_swigt__p_uscxml__ErrorEvent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uscxml__Event[] = { {&_swigt__p_uscxml__Event, 0, 0, 0}, {&_swigt__p_uscxml__ErrorEvent, _p_uscxml__ErrorEventTo_p_uscxml__Event, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_Data,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMAttr,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMCDATASection,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMCharacterData,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMComment,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocument,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentFragment,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMDocumentType,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMElement,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMEntity,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMEntityReference,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMException,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNamedNodeMap,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNode,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNodeList,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMNotation,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMProcessingInstruction,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMText,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMTypeInfo,
+ _swigc__p_XERCES_CPP_NAMESPACE__DOMUserDataHandler,
+ _swigc__p_XERCES_CPP_NAMESPACE__MemoryManager,
+ _swigc__p_bool,
+ _swigc__p_int16_t,
+ _swigc__p_int32_t,
+ _swigc__p_int64_t,
+ _swigc__p_namelist_t,
+ _swigc__p_params_t,
+ _swigc__p_size_t,
+ _swigc__p_ssize_t,
+ _swigc__p_std__listT_Data_t,
+ _swigc__p_std__multimapT_std__string_Data_t,
+ _swigc__p_std__string,
+ _swigc__p_uint16_t,
+ _swigc__p_uint32_t,
+ _swigc__p_uint64_t,
+ _swigc__p_unsigned_char,
+ _swigc__p_uscxml__ErrorEvent,
+ _swigc__p_uscxml__Event,
+ _swigc__p_void,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned statically to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ * 1) If the cast->type has already been loaded AND the type we are adding
+ * casting info to has not been loaded (it is in this module), THEN we
+ * replace the cast->type pointer with the type pointer that has already
+ * been loaded.
+ * 2) If BOTH types (the one we are adding casting info to, and the
+ * cast->type) are loaded, THEN the cast info has already been loaded by
+ * the previous module so we just ignore it.
+ * 3) Finally, if cast->type has not already been loaded, then we add that
+ * swig_cast_info to the linked list (because the cast->type) pointer will
+ * be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int init;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
+
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ /* Our module is already in the list, so there's nothing more to do. */
+ return;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* otherwise we must add our module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
+
+ /* When multiple interpreters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
+ /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+
+ /* Don't need to add information already in the list */
+ ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+ if (!ocast) ret = 0;
+ }
+ }
+
+ if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n",j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types. It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run) return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* c-mode */
+#endif
+}
+#endif
+
+
+
+/* Forward declaration of where the user's %init{} gets inserted */
+void SWIG_init_user(lua_State* L );
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* this is the initialization function
+ added at the very end of the code
+ the function is always called SWIG_init, but an earlier #define will rename it
+*/
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+LUALIB_API int SWIG_init(lua_State* L)
+#else
+SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
+#endif
+{
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
+ int i;
+ int globalRegister = 0;
+ /* start with global table */
+ lua_pushglobaltable (L);
+ /* SWIG's internal initialisation */
+ SWIG_InitializeModule((void*)L);
+ SWIG_PropagateClientData();
+#endif
+
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
+ /* add a global fn */
+ SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
+ SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_class_equal);
+#endif
+
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
+ /* set up base class pointers (the hierarchy) */
+ for (i = 0; swig_types[i]; i++){
+ if (swig_types[i]->clientdata){
+ SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
+ }
+ }
+#ifdef SWIG_LUA_MODULE_GLOBAL
+ globalRegister = 1;
+#endif
+
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+ SWIG_Lua_namespace_register(L,&swig_SwigModule, globalRegister);
+#endif
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+ for (i = 0; swig_types[i]; i++){
+ if (swig_types[i]->clientdata){
+ SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
+ }
+ }
+#endif
+
+#if defined(SWIG_LUA_ELUA_EMULATE)
+ lua_newtable(L);
+ SWIG_Lua_elua_emulate_register(L,swig_SwigModule.ns_methods);
+ SWIG_Lua_elua_emulate_register_clear(L);
+ if(globalRegister) {
+ lua_pushstring(L,swig_SwigModule.name);
+ lua_pushvalue(L,-2);
+ lua_rawset(L,-4);
+ }
+#endif
+
+#endif
+
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
+ /* invoke user-specific initialization */
+ SWIG_init_user(L);
+ /* end module */
+ /* Note: We do not clean up the stack here (Lua will do this for us). At this
+ point, we have the globals table and out module table on the stack. Returning
+ one value makes the module table the result of the require command. */
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+const char* SWIG_LUACODE=
+ "";
+
+void SWIG_init_user(lua_State* L)
+{
+ SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode->dcast = (swig_dycast_func) DOMNode_dynamic_cast;
+
+ /* exec Lua code if applicable */
+ SWIG_Lua_dostring(L,SWIG_LUACODE);
+}
+
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
index f6cb570..6fc5ac4 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
@@ -17,10 +17,10 @@
* @endcond
*/
-#include <boost/algorithm/string.hpp>
-
#include "uscxml/Common.h"
+#include "uscxml/util/URL.h"
#include "uscxml/util/String.h"
+
#include "LuaDataModel.h"
// disable forcing to bool performance warning
@@ -29,31 +29,71 @@
#include "LuaBridge.h"
#pragma warning(pop)
-#include "uscxml/dom/DOMUtils.h"
-
-#include "uscxml/Message.h"
-#include <glog/logging.h>
+#include "uscxml/messages/Event.h"
+#include "uscxml/util/DOM.h"
+#include <easylogging++.h>
+#include <boost/algorithm/string.hpp>
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
+//#include "LuaDOM.cpp.inc"
namespace uscxml {
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new LuaDataModelProvider() );
- return true;
-}
-#endif
-
-static int luaInspect(lua_State * l) {
- return 0;
-}
+//static int luaInspect(lua_State * l) {
+// return 0;
+//}
bool _luaHasXMLParser = false;
+static int luaEval(lua_State* luaState, const std::string& expr) {
+ int preStack = lua_gettop(luaState);
+ int error = luaL_loadstring(luaState, expr.c_str()) || lua_pcall(luaState, 0, LUA_MULTRET, 0);
+ if (error) {
+ std::string errMsg = lua_tostring(luaState, -1);
+ lua_pop(luaState, 1); /* pop error message from the stack */
+ ERROR_EXECUTION_THROW(errMsg);
+ }
+ int postStack = lua_gettop(luaState);
+ return postStack - preStack;
+}
+
+static Data getLuaAsData(lua_State* _luaState, const luabridge::LuaRef& lua) {
+ Data data;
+ if (lua.isFunction()) {
+ // TODO: this might lead to a stack-overflow
+ luabridge::LuaRef luaEvald = lua();
+ return getLuaAsData(_luaState, luaEvald);
+ } else if(lua.isLightUserdata() || lua.isUserdata()) {
+ // not sure what to do
+ } else if(lua.isThread()) {
+ // not sure what to do
+ } else if(lua.isNil()) {
+ data.atom = "nil";
+ data.type = Data::INTERPRETED;
+ } else if(lua.isNumber()) {
+ data.atom = toStr(lua.cast<int>());
+ data.type = Data::INTERPRETED;
+ } else if(lua.isString()) {
+ data.atom = lua.tostring();
+ data.type = Data::VERBATIM;
+ } else if(lua.isTable()) {
+ bool isArray = false;
+ bool isMap = false;
+ for (luabridge::Iterator iter (lua); !iter.isNil(); ++iter) {
+ luabridge::LuaRef luaKey = iter.key();
+ luabridge::LuaRef luaVal = *iter;
+ if (luaKey.isString()) {
+ assert(!isArray);
+ isMap = true;
+ data.compound[luaKey.tostring()] = getLuaAsData(_luaState, luaVal);
+ } else {
+ assert(!isMap);
+ isArray = true;
+ data.array.push_back(getLuaAsData(_luaState, luaVal));
+ }
+ }
+ }
+ return data;
+}
static luabridge::LuaRef getDataAsLua(lua_State* _luaState, const Data& data) {
luabridge::LuaRef luaData (_luaState);
@@ -80,24 +120,24 @@ static luabridge::LuaRef getDataAsLua(lua_State* _luaState, const Data& data) {
luaData[compoundIter->first] = getDataAsLua(_luaState, compoundIter->second);
compoundIter++;
}
- luaData["inspect"] = luaInspect;
+// luaData["inspect"] = luaInspect;
return luaData;
}
if (data.array.size() > 0) {
luaData = luabridge::newTable(_luaState);
std::list<Data>::const_iterator arrayIter = data.array.begin();
- uint32_t index = 0;
+// uint32_t index = 0;
while(arrayIter != data.array.end()) {
- luaData[index++] = getDataAsLua(_luaState, *arrayIter);
+// luaData[index++] = getDataAsLua(_luaState, *arrayIter);
+ luaData.append(getDataAsLua(_luaState, *arrayIter));
arrayIter++;
}
- luaData["inspect"] = luaInspect;
+// luaData["inspect"] = luaInspect;
return luaData;
}
if (data.atom.size() > 0) {
switch (data.type) {
case Data::VERBATIM: {
-// luaData = "\"" + data.atom + "\"";
luaData = data.atom;
break;
}
@@ -109,29 +149,34 @@ static luabridge::LuaRef getDataAsLua(lua_State* _luaState, const Data& data) {
luaData = strTo<long>(data.atom);
}
} else {
- luaData = data.atom;
+ int retVals = luaEval(_luaState, "return(" + data.atom + ");");
+ if (retVals == 1) {
+ luaData = luabridge::LuaRef::fromStack(_luaState, -1);
+ }
+ lua_pop(_luaState, retVals);
}
}
}
return luaData;
}
- return luaData;
+ // hopefully this is nil
+ return luabridge::LuaRef(_luaState);
}
LuaDataModel::LuaDataModel() {
_luaState = NULL;
}
-static int luaInFunction(lua_State * l) {
- luabridge::LuaRef ref = luabridge::getGlobal(l, "__interpreter");
- InterpreterInfo* interpreter = ref.cast<InterpreterInfo*>();
+int LuaDataModel::luaInFunction(lua_State * l) {
+ luabridge::LuaRef ref = luabridge::getGlobal(l, "__datamodel");
+ LuaDataModel* dm = ref.cast<LuaDataModel*>();
int stackSize = lua_gettop(l);
for (size_t i = 0; i < stackSize; i++) {
if (!lua_isstring(l, -1 - i))
continue;
std::string stateName = lua_tostring(l, -1 - i);
- if (interpreter->isInState(stateName))
+ if (dm->_callbacks->isInState(stateName))
continue;
lua_pushboolean(l, 0);
return 1;
@@ -140,9 +185,9 @@ static int luaInFunction(lua_State * l) {
return 1;
}
-boost::shared_ptr<DataModelImpl> LuaDataModel::create(InterpreterInfo* interpreter) {
- boost::shared_ptr<LuaDataModel> dm = boost::shared_ptr<LuaDataModel>(new LuaDataModel());
- dm->_interpreter = interpreter;
+std::shared_ptr<DataModelImpl> LuaDataModel::create(DataModelCallbacks* callbacks) {
+ std::shared_ptr<LuaDataModel> dm(new LuaDataModel());
+ dm->_callbacks = callbacks;
dm->_luaState = luaL_newstate();
luaL_openlibs(dm->_luaState);
@@ -161,23 +206,33 @@ boost::shared_ptr<DataModelImpl> LuaDataModel::create(InterpreterInfo* interpret
LOG(INFO) << e.what();
}
- luabridge::getGlobalNamespace(dm->_luaState).beginClass<InterpreterInfo>("Interpreter").endClass();
- luabridge::setGlobal(dm->_luaState, dm->_interpreter, "__interpreter");
+ luabridge::getGlobalNamespace(dm->_luaState).beginClass<LuaDataModel>("DataModel").endClass();
+ luabridge::setGlobal(dm->_luaState, dm.get(), "__datamodel");
luabridge::getGlobalNamespace(dm->_luaState).addCFunction("In", luaInFunction);
luabridge::LuaRef ioProcTable = luabridge::newTable(dm->_luaState);
-
- std::map<std::string, IOProcessor>::const_iterator ioProcIter = dm->_interpreter->getIOProcessors().begin();
- while(ioProcIter != dm->_interpreter->getIOProcessors().end()) {
+ std::map<std::string, IOProcessor> ioProcs = dm->_callbacks->getIOProcessors();
+ std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcs.begin();
+ while(ioProcIter != ioProcs.end()) {
Data ioProcData = ioProcIter->second.getDataModelVariables();
ioProcTable[ioProcIter->first] = getDataAsLua(dm->_luaState, ioProcData);
ioProcIter++;
}
luabridge::setGlobal(dm->_luaState, ioProcTable, "_ioprocessors");
- luabridge::setGlobal(dm->_luaState, dm->_interpreter->getName(), "_name");
- luabridge::setGlobal(dm->_luaState, dm->_interpreter->getSessionId(), "_sessionid");
+ luabridge::LuaRef invTable = luabridge::newTable(dm->_luaState);
+ std::map<std::string, Invoker> invokers = dm->_callbacks->getInvokers();
+ std::map<std::string, Invoker>::const_iterator invIter = invokers.begin();
+ while(invIter != invokers.end()) {
+ Data invData = invIter->second.getDataModelVariables();
+ invTable[invIter->first] = getDataAsLua(dm->_luaState, invData);
+ invIter++;
+ }
+ luabridge::setGlobal(dm->_luaState, invTable, "_invokers");
+
+ luabridge::setGlobal(dm->_luaState, dm->_callbacks->getName(), "_name");
+ luabridge::setGlobal(dm->_luaState, dm->_callbacks->getSessionId(), "_sessionid");
return dm;
}
@@ -187,42 +242,8 @@ LuaDataModel::~LuaDataModel() {
lua_close(_luaState);
}
-void LuaDataModel::pushContext() {
-}
-
-void LuaDataModel::popContext() {
-}
-
-void LuaDataModel::initialize() {
-}
-
-static Data getLuaAsData(const luabridge::LuaRef& lua) {
- Data data;
- if (lua.isFunction()) {
- // TODO: this might lead to a stack-overflow
- luabridge::LuaRef luaEvald = lua();
- return getLuaAsData(luaEvald);
- } else if(lua.isLightUserdata() || lua.isUserdata()) {
- // not sure what to do
- } else if(lua.isThread()) {
- // not sure what to do
- } else if(lua.isNil()) {
- data.atom = "undefined";
- data.type = Data::INTERPRETED;
- } else if(lua.isString()) {
- data.atom = lua.tostring();
- data.type = Data::VERBATIM;
- } else if(lua.isNumber()) {
- data.atom = lua.tostring();
- data.type = Data::INTERPRETED;
- } else if(lua.isTable()) {
- for (luabridge::Iterator iter (lua); !iter.isNil (); ++iter) {
- luabridge::LuaRef luaKey = iter.key();
- luabridge::LuaRef luaVal = *iter;
- data.compound[luaKey.tostring()] = getLuaAsData(luaVal);
- }
- }
- return data;
+void LuaDataModel::addExtension(DataModelExtension* ext) {
+ ERROR_EXECUTION_THROW("Extensions unimplemented in lua datamodel");
}
void LuaDataModel::setEvent(const Event& event) {
@@ -230,14 +251,17 @@ void LuaDataModel::setEvent(const Event& event) {
luaEvent = luabridge::newTable(_luaState);
luaEvent["name"] = event.name;
- luaEvent["raw"] = event.raw;
- luaEvent["xml"] = event.xml;
- luaEvent["origin"] = event.origin;
- luaEvent["origintype"] = event.origintype;
- luaEvent["content"] = event.content;
- luaEvent["invokeId"] = event.invokeid;
- luaEvent["sendId"] = event.sendid;
- luaEvent["inspect"] = luaInspect;
+ if (event.raw.size() > 0)
+ luaEvent["raw"] = event.raw;
+ if (event.origin.size() > 0)
+ luaEvent["origin"] = event.origin;
+ if (event.origintype.size() > 0)
+ luaEvent["origintype"] = event.origintype;
+ if (event.invokeid.size() > 0)
+ luaEvent["invokeid"] = event.invokeid;
+ if (!event.hideSendId)
+ luaEvent["sendid"] = event.sendid;
+// luaEvent["inspect"] = luaInspect;
switch (event.eventType) {
case Event::INTERNAL:
@@ -254,64 +278,44 @@ void LuaDataModel::setEvent(const Event& event) {
break;
}
- if (event.dom) {
+ if (event.data.node) {
if (_luaHasXMLParser) {
const luabridge::LuaRef& luaLom = luabridge::getGlobal(_luaState, "lxp.lom");
const luabridge::LuaRef& luaLomParse = luaLom["parse"];
assert(luaLomParse.isFunction());
std::stringstream luaXMLSS;
- luaXMLSS << event.dom;
+ luaXMLSS << event.data.node;
try {
luaEvent["data"] = luaLomParse(luaXMLSS.str());
} catch (luabridge::LuaException e) {
ERROR_EXECUTION_THROW(e.what());
}
} else {
- // some error events have a dom node attached - do not throw for them
- // issue65
- if (!nameMatch("error.*", event.name)) {
- ERROR_EXECUTION_THROW("No DOM support in Lua datamodel");
- }
- }
- } else if (event.content.length() > 0) {
- // _event.data is a string or JSON
- Data json = Data::fromJSON(event.content);
- if (!json.empty()) {
- luaEvent["data"] = getDataAsLua(_luaState, json);
- } else {
- // test179
- std::string trimmed = boost::trim_copy(event.content);
- if ((boost::starts_with(trimmed, "'") && boost::ends_with(trimmed, "'")) ||
- (boost::starts_with(trimmed, "\"") && boost::ends_with(trimmed, "\""))) {
- luaEvent["data"] = spaceNormalize(event.content);
- } else {
- Data tmp(event.content, Data::INTERPRETED);
- luaEvent["data"] = getDataAsLua(_luaState, tmp);
- }
+ ERROR_EXECUTION_THROW("No DOM support in Lua datamodel");
}
} else {
// _event.data is KVP
- Event eventCopy(event);
+ Data d = event.data;
- if (!eventCopy.params.empty()) {
- Event::params_t::iterator paramIter = eventCopy.params.begin();
- while(paramIter != eventCopy.params.end()) {
- eventCopy.data.compound[paramIter->first] = paramIter->second;
+ if (!event.params.empty()) {
+ Event::params_t::const_iterator paramIter = event.params.begin();
+ while(paramIter != event.params.end()) {
+ d.compound[paramIter->first] = paramIter->second;
paramIter++;
}
}
- if (!eventCopy.namelist.empty()) {
- Event::namelist_t::iterator nameListIter = eventCopy.namelist.begin();
- while(nameListIter != eventCopy.namelist.end()) {
- eventCopy.data.compound[nameListIter->first] = nameListIter->second;
+ if (!event.namelist.empty()) {
+ Event::namelist_t::const_iterator nameListIter = event.namelist.begin();
+ while(nameListIter != event.namelist.end()) {
+ d.compound[nameListIter->first] = nameListIter->second;
nameListIter++;
}
}
- if (!eventCopy.data.empty()) {
- luabridge::LuaRef luaData = getDataAsLua(_luaState, eventCopy.data);
+ if (!d.empty()) {
+ luabridge::LuaRef luaData = getDataAsLua(_luaState, d);
assert(luaEvent.isTable());
- assert(luaData.isTable());
+ // assert(luaData.isTable()); // not necessarily test179
luaEvent["data"] = luaData;
}
}
@@ -319,31 +323,29 @@ void LuaDataModel::setEvent(const Event& event) {
luabridge::setGlobal(_luaState, luaEvent, "_event");
}
-Data LuaDataModel::getStringAsData(const std::string& content) {
-// Data data = Data::fromJSON(content);
+Data LuaDataModel::evalAsData(const std::string& content) {
Data data;
- if (data.empty()) {
- std::string trimmedExpr = boost::trim_copy(content);
- if (!boost::starts_with(trimmedExpr, "return")) {
- trimmedExpr = "return(" + trimmedExpr + ");";
- }
- int retVals = luaEval(Arabica::DOM::Element<std::string>(), trimmedExpr);
+ std::string trimmedExpr = boost::trim_copy(content);
+
+ try {
+ int retVals = luaEval(_luaState, "return(" + trimmedExpr + ")");
if (retVals == 1) {
- data = getLuaAsData(luabridge::LuaRef::fromStack(_luaState, -1));
+ data = getLuaAsData(_luaState, luabridge::LuaRef::fromStack(_luaState, -1));
}
lua_pop(_luaState, retVals);
-
+ } catch (ErrorEvent e) {
+ int retVals = luaEval(_luaState, trimmedExpr);
+ if (retVals == 1) {
+ data = getLuaAsData(_luaState, luabridge::LuaRef::fromStack(_luaState, -1));
+ lua_pop(_luaState, retVals);
+ } else {
+ lua_pop(_luaState, retVals);
+ throw e; // we will assume syntax error and throw
+ }
}
- return data;
-}
-bool LuaDataModel::validate(const std::string& location, const std::string& schema) {
- return true;
-}
-
-bool LuaDataModel::isLocation(const std::string& expr) {
- return true;
+ return data;
}
bool LuaDataModel::isValidSyntax(const std::string& expr) {
@@ -368,7 +370,9 @@ uint32_t LuaDataModel::getLength(const std::string& expr) {
trimmedExpr = "return(#" + trimmedExpr + ")";
}
- int retVals = luaEval(Arabica::DOM::Element<std::string>(), trimmedExpr);
+ int retVals = luaEval(_luaState, trimmedExpr);
+
+#if 1
if (retVals == 1 && lua_isnumber(_luaState, -1)) {
int result = lua_tointeger(_luaState, -1);
@@ -379,6 +383,21 @@ uint32_t LuaDataModel::getLength(const std::string& expr) {
lua_pop(_luaState, retVals);
ERROR_EXECUTION_THROW("'" + expr + "' does not evaluate to an array.");
return 0;
+#else
+
+ if (retVals == 1) {
+ luabridge::LuaRef luaData = luabridge::LuaRef::fromStack(_luaState, -1);
+ if (luaData.isNumber()) {
+ lua_pop(_luaState, retVals);
+ return luaData.cast<int>();
+ }
+ }
+ lua_pop(_luaState, retVals);
+
+ ERROR_EXECUTION_THROW("'" + expr + "' does not evaluate to an array.");
+ return 0;
+
+#endif
}
void LuaDataModel::setForeach(const std::string& item,
@@ -390,152 +409,110 @@ void LuaDataModel::setForeach(const std::string& item,
const luabridge::LuaRef& arrRef = luabridge::getGlobal(_luaState, array.c_str());
if (arrRef.isTable()) {
- // trigger syntax error for invalid items
- int retVals = luaEval(Arabica::DOM::Element<std::string>(), "return(" + item + ");");
+ // triggers syntax error for invalid items, test 152
+ int retVals = luaEval(_luaState, item + " = " + array + "[" + toStr(iteration) + "]");
lua_pop(_luaState, retVals);
- const luabridge::LuaRef& val = arrRef[iteration];
- luabridge::setGlobal(_luaState, val, item.c_str());
-
if (index.length() > 0) {
- // assign iteration element to index
- luabridge::setGlobal(_luaState, iteration, index.c_str());
+ int retVals = luaEval(_luaState, index + " = " + toStr(iteration));
+ lua_pop(_luaState, retVals);
}
}
}
-void LuaDataModel::eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr) {
- luaEval(scriptElem, expr);
-}
-
-int LuaDataModel::luaEval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr) {
- int preStack = lua_gettop(_luaState);
- int error = luaL_loadstring(_luaState, expr.c_str()) || lua_pcall(_luaState, 0, LUA_MULTRET, 0);
- if (error) {
- std::string errMsg = lua_tostring(_luaState, -1);
- lua_pop(_luaState, 1); /* pop error message from the stack */
- ERROR_EXECUTION_THROW(errMsg);
- }
- int postStack = lua_gettop(_luaState);
- return postStack - preStack;
-}
-
bool LuaDataModel::isDeclared(const std::string& expr) {
// see: http://lua-users.org/wiki/DetectingUndefinedVariables
return true;
}
-void LuaDataModel::assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content) {
- std::string key;
- if (HAS_ATTR(assignElem, "id")) {
- key = ATTR(assignElem, "id");
- } else if (HAS_ATTR(assignElem, "location")) {
- key = ATTR(assignElem, "location");
- }
- if (key.length() == 0) {
+
+void LuaDataModel::assign(const std::string& location, const Data& data) {
+ if (location.length() == 0) {
ERROR_EXECUTION_THROW("Assign element has neither id nor location");
}
// flags on attribute are ignored?
- if (key.compare("_sessionid") == 0) // test 322
+ if (location.compare("_sessionid") == 0) // test 322
ERROR_EXECUTION_THROW("Cannot assign to _sessionId");
- if (key.compare("_name") == 0)
+ if (location.compare("_name") == 0)
ERROR_EXECUTION_THROW("Cannot assign to _name");
- if (key.compare("_ioprocessors") == 0) // test 326
+ if (location.compare("_ioprocessors") == 0) // test 326
ERROR_EXECUTION_THROW("Cannot assign to _ioprocessors");
- if (key.compare("_invokers") == 0)
+ if (location.compare("_invokers") == 0)
ERROR_EXECUTION_THROW("Cannot assign to _invokers");
- if (key.compare("_event") == 0)
+ if (location.compare("_event") == 0)
ERROR_EXECUTION_THROW("Cannot assign to _event");
-// lua_pushnil(_luaState);
-// lua_setglobal(_luaState, key.c_str());
+ if (data.node) {
+ ERROR_EXECUTION_THROW("Cannot assign xml nodes in lua datamodel");
-// luabridge::setGlobal(_luaState, luabridge::Nil(), key.c_str());
-// luabridge::LuaRef val = luabridge::getGlobal(_luaState, key.c_str());
-// std::cout << val.tostring() << std::endl;
+ // TODO: DOM is prepared by swig
- int retVals = 0;
+// return SWIG_JSC_NewPointerObj(_ctx,
+// (void*)node,
+// SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode,
+// SWIG_as_voidptrptr(&node)),
+// 0);
- if (HAS_ATTR(assignElem, "expr")) {
- retVals = luaEval(Arabica::DOM::Element<std::string>(), key + " = " + ATTR(assignElem, "expr") + ";");
- } else if (node) {
- ERROR_EXECUTION_THROW("Cannot assign xml nodes in lua datamodel");
- } else if (content.size() > 0) {
- try {
- eval(Arabica::DOM::Element<std::string>(), key + " = " + content + ";");
- } catch (...) {
- eval(Arabica::DOM::Element<std::string>(), key + " = " + "\"" + spaceNormalize(content) + "\";");
- }
+
+// JSObjectSetProperty(_ctx, JSContextGetGlobalObject(_ctx), JSStringCreateWithUTF8CString(location.c_str()), getNodeAsValue(data.node), 0, &exception);
} else {
- eval(Arabica::DOM::Element<std::string>(), key + " = " + "nil;");
- }
-// val = luabridge::getGlobal(_luaState, key.c_str());
-// std::cout << val.tostring() << std::endl;
+ // trigger error.execution for undefined locations, test286 test311
+ int retVals = luaEval(_luaState, location + " = " + location);
+ lua_pop(_luaState, retVals);
-}
+ luabridge::LuaRef lua = getDataAsLua(_luaState, data);
+ luabridge::setGlobal(_luaState, lua, location.c_str());
-void LuaDataModel::assign(const std::string& location, const Data& data) {
- luabridge::setGlobal(_luaState, getDataAsLua(_luaState, data), location.c_str());
-}
-
-void LuaDataModel::init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content) {
- assign(dataElem, node, content);
+// std::cout << Data::toJSON(evalAsData(location)) << std::endl;
+ }
}
void LuaDataModel::init(const std::string& location, const Data& data) {
+ luabridge::setGlobal(_luaState, luabridge::Nil(), location.c_str());
assign(location, data);
}
-/**
- * The boolean expression language consists of the In predicate only. It has the
- * form 'In(id)', where id is the id of a state in the enclosing state machine.
- * The predicate must return 'true' if and only if that state is in the current
- * state configuration.
- */
-bool LuaDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
+bool LuaDataModel::evalAsBool(const std::string& expr) {
// we need the result of the expression on the lua stack -> has to "return"!
std::string trimmedExpr = boost::trim_copy(expr);
- if (!boost::starts_with(trimmedExpr, "return")) {
- trimmedExpr = "return(" + trimmedExpr + ");";
- }
- int retVals = luaEval(Arabica::DOM::Element<std::string>(), trimmedExpr);
+ int retVals = luaEval(_luaState, "return(" + trimmedExpr + ")");
- if (retVals == 1 && lua_isboolean(_luaState, -1)) {
+ if (retVals == 1) {
bool result = lua_toboolean(_luaState, -1);
lua_pop(_luaState, 1);
return result;
}
lua_pop(_luaState, retVals);
+
return false;
}
+Data LuaDataModel::getAsData(const std::string& content) {
+ Data data;
+ std::string trimmedExpr = boost::trim_copy(content);
-std::string LuaDataModel::evalAsString(const std::string& expr) {
- std::string trimmedExpr = boost::trim_copy(expr);
- if (!boost::starts_with(trimmedExpr, "return")) {
- trimmedExpr = "return(" + trimmedExpr + ")";
+ int retVals = luaEval(_luaState, "__tmp = " + content + "; return __tmp");
+ if (retVals == 1) {
+ data = getLuaAsData(_luaState, luabridge::LuaRef::fromStack(_luaState, -1));
}
+ lua_pop(_luaState, retVals);
- int retVals = luaEval(Arabica::DOM::Element<std::string>(), trimmedExpr);
-
- if (retVals == 1 && lua_isstring(_luaState, -1)) {
- std::string result = lua_tostring(_luaState, -1);
- lua_pop(_luaState, 1);
- return result;
+ // escape as a string, this is sometimes the case with <content>
+ if (data.atom == "nil" && data.type == Data::INTERPRETED) {
+ int retVals = luaEval(_luaState, "__tmp = '" + content + "'; return __tmp");
+ if (retVals == 1) {
+ data = getLuaAsData(_luaState, luabridge::LuaRef::fromStack(_luaState, -1));
+ }
+ lua_pop(_luaState, retVals);
}
- lua_pop(_luaState, retVals);
- return "";
+
+ return data;
}
+
std::string LuaDataModel::andExpressions(std::list<std::string> exprs) {
std::stringstream exprSS;
std::list<std::string>::const_iterator listIter;
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h
index eb23815..4e2fd43 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h
@@ -20,20 +20,20 @@
#ifndef LUADATAMODEL_H_113E014C
#define LUADATAMODEL_H_113E014C
-#include "uscxml/InterpreterInfo.h"
#include "uscxml/plugins/DataModel.h"
#include <list>
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+
namespace uscxml {
class Event;
class Data;
@@ -45,7 +45,9 @@ class LuaDataModel : public DataModelImpl {
public:
LuaDataModel();
virtual ~LuaDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
+ virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* callbacks);
+
+ virtual void addExtension(DataModelExtension* ext);
virtual std::list<std::string> getNames() {
std::list<std::string> names;
@@ -53,46 +55,31 @@ public:
return names;
}
- virtual void initialize();
- virtual void setEvent(const Event& event);
-
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
virtual bool isValidSyntax(const std::string& expr);
+ virtual void setEvent(const Event& event);
+
+ // foreach
virtual uint32_t getLength(const std::string& expr);
virtual void setForeach(const std::string& item,
const std::string& array,
const std::string& index,
uint32_t iteration);
- virtual void pushContext();
- virtual void popContext();
-
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void assign(const std::string& location, const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void init(const std::string& location, const Data& data);
+ virtual bool evalAsBool(const std::string& expr);
+ virtual Data evalAsData(const std::string& expr);
+ virtual Data getAsData(const std::string& content);
- virtual Data getStringAsData(const std::string& content);
virtual bool isDeclared(const std::string& expr);
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
+ virtual void assign(const std::string& location, const Data& data);
+ virtual void init(const std::string& location, const Data& data);
virtual std::string andExpressions(std::list<std::string>);
protected:
- virtual int luaEval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
+ static int luaInFunction(lua_State * l);
lua_State* _luaState;
};
diff --git a/src/uscxml/plugins/datamodel/lua/bindings.i b/src/uscxml/plugins/datamodel/lua/bindings.i
new file mode 100644
index 0000000..24b756b
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/lua/bindings.i
@@ -0,0 +1,38 @@
+#define XERCES_HAS_CPP_NAMESPACE 1
+
+%include <std_string.i>
+
+%module LuaDOM
+
+%import "uscxml/config.h"
+%import "uscxml/Common.h"
+
+%import "xercesc/util/XercesDefs.hpp"
+%import "xercesc/util/Xerces_autoconf_config.hpp"
+
+%include "../common/bindings/dom/ignore.i"
+%include "../common/bindings/dom/defines.i"
+%include "../common/bindings/dom/typemaps-general.i"
+
+// in typemap
+%typemap(in) XMLCh * %{
+ $1 = Lua2XMLString($input);
+%}
+
+%typemap(freearg) XMLCh * %{
+ delete[] $1;
+%}
+
+// out typemap
+%typemap(out) XMLCh * %{
+ $result = XMLString2Lua($1);
+%}
+
+%include "../common/bindings/dom/dom.i"
+
+// Operators we do want
+// %rename(operator_assignment) operator=;
+%rename(operator_equal_to) operator==;
+%rename(operator_not_equal_to) operator!=;
+
+%include "../common/bindings/event.i"
diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp
index 7211dc5..773a970 100644
--- a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp
@@ -21,10 +21,7 @@
#include "uscxml/Common.h"
#include "NULLDataModel.h"
-#include "uscxml/dom/DOMUtils.h"
-
-#include "uscxml/Message.h"
-#include <glog/logging.h>
+#include "uscxml/util/DOM.h"
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
@@ -43,28 +40,16 @@ bool pluginConnect(pluma::Host& host) {
NULLDataModel::NULLDataModel() {
}
-boost::shared_ptr<DataModelImpl> NULLDataModel::create(InterpreterInfo* interpreter) {
- boost::shared_ptr<NULLDataModel> dm = boost::shared_ptr<NULLDataModel>(new NULLDataModel());
- dm->_interpreter = interpreter;
+std::shared_ptr<DataModelImpl> NULLDataModel::create(DataModelCallbacks* callbacks) {
+ std::shared_ptr<NULLDataModel> dm(new NULLDataModel());
+ dm->_callbacks = callbacks;
return dm;
}
NULLDataModel::~NULLDataModel() {
}
-void NULLDataModel::pushContext() {
-}
-
-void NULLDataModel::popContext() {
-}
-
-void NULLDataModel::initialize() {
-}
-
-void NULLDataModel::setEvent(const Event& event) {
-}
-
-Data NULLDataModel::getStringAsData(const std::string& content) {
+Data NULLDataModel::getAsData(const std::string& content) {
Data data = Data::fromJSON(content);
if (data.empty()) {
data = Data(content, Data::VERBATIM);
@@ -72,39 +57,13 @@ Data NULLDataModel::getStringAsData(const std::string& content) {
return data;
}
-bool NULLDataModel::validate(const std::string& location, const std::string& schema) {
- return true;
-}
-
-bool NULLDataModel::isLocation(const std::string& expr) {
- return true;
-}
-
-uint32_t NULLDataModel::getLength(const std::string& expr) {
- return 0;
-}
-
-void NULLDataModel::setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration) {
-}
-
-void NULLDataModel::eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr) {
-}
-
-bool NULLDataModel::isDeclared(const std::string& expr) {
- return true;
-}
-
/**
* The boolean expression language consists of the In predicate only. It has the
* form 'In(id)', where id is the id of a state in the enclosing state machine.
* The predicate must return 'true' if and only if that state is in the current
* state configuration.
*/
-bool NULLDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
+bool NULLDataModel::evalAsBool(const xercesc::DOMElement* scriptNode, const std::string& expr) {
std::string trimmedExpr = expr;
boost::trim(trimmedExpr);
if (!boost::istarts_with(trimmedExpr, "in"))
@@ -138,7 +97,7 @@ bool NULLDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, c
stateName = *stateIter;
}
- if (_interpreter->isInState(stateName)) {
+ if (_callbacks->isInState(stateName)) {
continue;
}
return false;
@@ -146,9 +105,4 @@ bool NULLDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, c
return true;
}
-std::string NULLDataModel::evalAsString(const std::string& expr) {
- return expr;
-}
-
-
} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.h b/src/uscxml/plugins/datamodel/null/NULLDataModel.h
index f813ae1..c584357 100644
--- a/src/uscxml/plugins/datamodel/null/NULLDataModel.h
+++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.h
@@ -20,7 +20,6 @@
#ifndef NULLDATAMODEL_H_KN8TWG0V
#define NULLDATAMODEL_H_KN8TWG0V
-#include "uscxml/InterpreterInfo.h"
#include "uscxml/plugins/DataModel.h"
#include <list>
@@ -39,7 +38,7 @@ class NULLDataModel : public DataModelImpl {
public:
NULLDataModel();
virtual ~NULLDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
+ virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* callbacks);
virtual std::list<std::string> getNames() {
std::list<std::string> names;
@@ -47,38 +46,64 @@ public:
return names;
}
- virtual void initialize();
- virtual void setEvent(const Event& event);
+ virtual bool validate(const std::string& location, const std::string& schema) {
+ return true;
+ }
+ virtual bool isValidSyntax(const std::string& expr) {
+ return true; // overwrite when datamodel supports it
+ }
+ virtual void setEvent(const Event& event) {}
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
+ size_t replaceExpressions(std::string& content) {
+ return 0;
+ }
- virtual uint32_t getLength(const std::string& expr);
+ // foreach
+ virtual uint32_t getLength(const std::string& expr) {
+ return 0;
+ }
virtual void setForeach(const std::string& item,
const std::string& array,
const std::string& index,
- uint32_t iteration);
+ uint32_t iteration) {}
- virtual void pushContext();
- virtual void popContext();
+ virtual Data getAsData(const std::string& content);
+
+ virtual Data evalAsData(const std::string& content) {
+ return getAsData(content);
+ }
+ virtual std::string evalAsString(const std::string& expr) {
+ return expr;
+ }
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
+ virtual bool evalAsBool(const xercesc::DOMElement* scriptNode,
+ const std::string& expr);
+ virtual bool evalAsBool(const std::string& expr) {
+ return evalAsBool(NULL, expr);
+ }
+
+ virtual bool isDeclared(const std::string& expr) {
+ return true;
+ }
+
+ virtual void assign(const xercesc::DOMElement* assignElem,
+ const xercesc::DOMNode* node,
const std::string& content) {}
virtual void assign(const std::string& location, const Data& data) {}
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
+ virtual void init(const xercesc::DOMElement* dataElem,
+ const xercesc::DOMNode* node,
const std::string& content) {}
virtual void init(const std::string& location, const Data& data) {}
- virtual Data getStringAsData(const std::string& content);
- virtual bool isDeclared(const std::string& expr);
+ virtual void setCallbacks(DataModelCallbacks* callbacks) {
+ _callbacks = callbacks;
+ }
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
+ virtual void addExtension(DataModelExtension* ext) {}
+ virtual std::string andExpressions(std::list<std::string>) {
+ return "";
+ }
protected:
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIConfig.h.in b/src/uscxml/plugins/datamodel/prolog/swi/SWIConfig.h.in
deleted file mode 100644
index e3127b0..0000000
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIConfig.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#cmakedefine SWI_HAS_PL_NIL
-#cmakedefine SWI_HAS_PL_DICT
-#cmakedefine SWI_HAS_PL_LIST_PAIR
-#cmakedefine SWI_REINTERPRET_FOREIGN \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
deleted file mode 100644
index 8b120c8..0000000
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
+++ /dev/null
@@ -1,891 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "uscxml/Common.h"
-#include "uscxml/config.h"
-#include "uscxml/util/String.h"
-#include "uscxml/URL.h"
-#include "SWIDataModel.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/Message.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-// these are defined but not exported by swi-prolog 7
-extern "C" {
- PL_EXPORT(int) PL_is_dict(term_t t);
- PL_EXPORT(int) PL_for_dict(term_t dict, int (*func)(term_t key, term_t value, int last, void *closure), void *closure, int flags);
-}
-#define RETHROW_PLEX_AS_EVENT \
-catch (PlException plex) { \
- ERROR_EXECUTION_THROW((char*)plex); \
-} \
-
-#define PL_MODULE \
-_interpreter.getSessionId().c_str() \
-
-#define SET_PL_ENGINE(dm) \
-assert(_swiEngines.find(dm) != _swiEngines.end()); \
-int rc = PL_set_engine(_swiEngines[dm], NULL); \
-assert(rc == PL_ENGINE_SET); \
-_dmPtr = dm;
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SWIDataModelProvider() );
- return true;
-}
-#endif
-
-// SWI prolog does not support passing user data
-static SWIDataModel* _dmPtr;
-static std::map<SWIDataModel*, PL_engine_t> _swiEngines;
-
-PL_blob_t SWIDataModel::blobType = {
- PL_BLOB_MAGIC,
- PL_BLOB_NOCOPY,
- (char*)"blob",
- releaseBlob,
- compareBlob,
- writeBlob,
- acquireBlob
-};
-
-SWIDataModel::SWIDataModel() {
-}
-
-SWIDataModel::~SWIDataModel() {
- try {
- if (_swiEngines.find(this) != _swiEngines.end()) {
- PL_destroy_engine(_swiEngines[this]);
- _swiEngines.erase(this);
- }
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-boost::shared_ptr<DataModelImpl> SWIDataModel::create(InterpreterInfo* interpreter) {
- try {
- boost::shared_ptr<SWIDataModel> dm = boost::shared_ptr<SWIDataModel>(new SWIDataModel());
- dm->_interpreter = interpreter;
-
- const char* swibin = getenv("SWI_BINARY");
- if (swibin == NULL)
- swibin = SWI_BINARY;
- const char* quiet = "--quiet";
-
- int argc = 2;
- static char * av[] = {
- (char*)swibin,
- (char*)quiet,
- NULL
- };
-
- if (!PL_is_initialised(NULL, NULL)) {
- if(!PL_initialise(argc,av)) {
- LOG(ERROR) << "Error intializing prolog engine";
- PL_halt(1);
- return boost::shared_ptr<DataModelImpl>();
- }
-
- PL_set_engine(PL_ENGINE_CURRENT, &_engine);
-
- // load SWI XML parser
- try {
- PlCall("use_module", PlCompound("library", PlTerm("sgml")));
- } catch (PlException plex) {
-
- LOG(ERROR) << "Cannot load prolog sgml module - make sure you have it installed in your prolog runtime: " << (char*)plex;
- throw plex;
- }
-
- // load json parser
- try {
- PlCall("use_module", PlCompound("library", PlTerm("http/json")));
- PlCall("use_module", PlCompound("library", PlTerm("http/json_convert")));
- } catch (PlException plex) {
- LOG(ERROR) << "Cannot load prolog json module or json_convert - make sure you have it installed in your prolog runtime: " << (char*)plex;
- throw plex;
- }
-
- } else {
- LOG(WARNING) << "Instantiating more than one SWI prolog datamodel will lead to weird effects as I cannot seperate the environments";
-// engine = PL_create_engine(NULL);
- }
-
-// assert(engine);
-// _swiEngines[dm.get()] = engine;
- _dmPtr = dm.get();
-
-// int rc = PL_set_engine(engine, NULL);
-// assert(rc == PL_ENGINE_SET);
-// (void)rc;
-
- _plModule = boost::replace_all_copy(interpreter->getSessionId(), "-", "");
- boost::replace_all(_plModule, "0", "g");
- boost::replace_all(_plModule, "1", "h");
- boost::replace_all(_plModule, "2", "i");
- boost::replace_all(_plModule, "3", "j");
- boost::replace_all(_plModule, "4", "k");
- boost::replace_all(_plModule, "5", "l");
- boost::replace_all(_plModule, "6", "m");
- boost::replace_all(_plModule, "7", "n");
- boost::replace_all(_plModule, "8", "o");
- boost::replace_all(_plModule, "9", "p");
-
- // use atoms for double quoted
- PlCall("set_prolog_flag(double_quotes,atom).");
-
- // set system variables
- PlCall("assert", PlCompound("sessionid", PlTerm(PlString(dm->_interpreter->getSessionId().c_str()))));
- PlCall("assert", PlCompound("name", PlTerm(PlString(dm->_interpreter->getName().c_str()))));
-
- std::map<std::string, IOProcessor>::const_iterator ioProcIter = dm->_interpreter->getIOProcessors().begin();
- while(ioProcIter != dm->_interpreter->getIOProcessors().end()) {
- Data ioProcData = ioProcIter->second.getDataModelVariables();
-
- if (ioProcIter->first.find_first_of(":/'") == std::string::npos) {
- std::stringstream ioProcShortCall;
- ioProcShortCall << "assert(ioprocessors(" << ioProcIter->first << "(location('" << ioProcData.compound["location"].atom << "'))))";
- PlCall(ioProcShortCall.str().c_str());
- }
- std::stringstream ioProcCall;
- ioProcCall << "assert(ioprocessors(name('" << ioProcIter->first << "'), location('" << ioProcData.compound["location"].atom << "')))";
- PlCall(ioProcCall.str().c_str());
-
- ioProcIter++;
- }
-
- // the in predicate
- PlRegister("user", "in", 1, SWIDataModel::inPredicate);
- PL_set_engine(NULL, NULL);
- return dm;
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-foreign_t SWIDataModel::inPredicate(term_t a0, int arity, void* context) {
- try {
- char *s;
- if ( PL_get_atom_chars(a0, &s) ) {
- if (_dmPtr->_interpreter->isInState(s)) {
- return true;
- }
- }
- return FALSE;
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
-// std::cout << "SWIDataModel::registerIOProcessor" << std::endl;
-}
-
-void SWIDataModel::setSessionId(const std::string& sessionId) {
-// std::cout << "SWIDataModel::setSessionId" << std::endl;
- _sessionId = sessionId;
-}
-
-void SWIDataModel::setName(const std::string& name) {
-// std::cout << "SWIDataModel::setName" << std::endl;
- _name = name;
-}
-
-void SWIDataModel::pushContext() {
-// std::cout << "SWIDataModel::pushContext" << std::endl;
-}
-
-void SWIDataModel::popContext() {
-// std::cout << "SWIDataModel::popContext" << std::endl;
-}
-
-void SWIDataModel::initialize() {
-// std::cout << "SWIDataModel::initialize" << std::endl;
-}
-
-void SWIDataModel::setEvent(const Event& event) {
- SWIEngineLock engineLock;
-
- // remove old event
- try {
- PlCall("retractall(event(_))");
-
- // simple values
- PlCall("assert", PlCompound("event", PlCompound("name", PlTerm(event.name.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("origin", PlString(event.origin.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("origintype", PlString(event.invokeid.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("invokeid", PlTerm(event.origintype.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("raw", PlString(event.raw.c_str()))));
-
- // event.type
- std::string type;
- switch (event.eventType) {
- case Event::PLATFORM:
- type = "platform";
- break;
- case Event::INTERNAL:
- type = "internal";
- break;
- case Event::EXTERNAL:
- type = "external";
- break;
- }
- PlCall("assert", PlCompound("event", PlCompound("type", PlTerm(type.c_str()))));
-
- // event.sendid
- if (!event.hideSendId)
- PlCall("assert", PlCompound("event", PlCompound("sendid", PlTerm(event.sendid.c_str()))));
-
- // event.data
- URL domUrl;
- if (event.dom) {
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
-// xmlDoc << event.getFirstDOMElement();
- xmlDoc << event.dom;
- domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), assert(event(data(DATA)))";
- PlCall(dataInitStr.str().c_str());
- } else if (event.content.size() > 0) {
- PlCall("assert", PlCompound("event", PlCompound("data", PlString(spaceNormalize(event.content).c_str()))));
- } else if (!event.data.empty()) {
- assertFromData(event.data, "event(data(", 2);
- }
-
- Event::params_t::const_iterator paramIter = event.params.begin();
- while(paramIter != event.params.end()) {
- assertFromData(paramIter->second, "event(param(" + paramIter->first + "(", 3);
- paramIter++;
- }
-
- Event::namelist_t::const_iterator namelistIter = event.namelist.begin();
- while(namelistIter != event.namelist.end()) {
- assertFromData(paramIter->second, "event(param(" + namelistIter->first + "(", 3);
- namelistIter++;
- }
-
-#if 0
- // event.params
- size_t uniqueKeys = 0;
- Event::params_t::const_iterator paramIter = event.params.begin();
- while(paramIter != event.params.end()) {
- uniqueKeys++;
- paramIter = event.params.upper_bound(paramIter->first);
- }
- if (uniqueKeys > 0) {
- paramIter = event.params.begin();
- for(int i = 0; paramIter != event.params.end(); i++) {
- std::stringstream paramArray;
- Event::params_t::const_iterator lastValueIter = event.params.upper_bound(paramIter->first);
-
- paramArray << paramIter->first << "([";
- std::string termSep = "";
-
- for (size_t j = 0; paramIter != lastValueIter; j++) {
- paramArray << termSep << "'" << paramIter->second << "'";
- termSep = ", ";
- paramIter++;
- }
- paramArray << "])";
- std::stringstream paramExpr;
- paramExpr << "assert(event(param(" << paramArray.str() << ")))";
- //std::cout << paramExpr.str() << std::endl;
- PlCall(paramExpr.str().c_str());
-
- paramIter = lastValueIter;
- }
- }
-#endif
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::assertFromData(const Data& data, const std::string& expr, size_t nesting) {
- if (data.atom.size() > 0) {
- // terminal branch, this is where we assert
-
- std::stringstream ss;
- ss << expr;
-// nesting++;
-
- if (data.type == Data::VERBATIM) {
- ss << "\"" << data.atom << "\"";
- } else {
- ss << data.atom;
- }
-
- for (size_t i = 0; i < nesting; i++) {
- ss << ")";
- }
-
-// std::cout << ss.str() << std::endl;
- PlCall("assert", PlCompound(ss.str().c_str()));
- return;
- }
-
- if (data.compound.size() > 0) {
- std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
- while(compIter != data.compound.end()) {
-// std::cout << compIter->first << std::endl;
- std::stringstream prefix;
- size_t prefixNesting = 0;
- size_t oldPos = 0;
- size_t pos = 0;
- while((pos = compIter->first.find_first_of(",.(-", oldPos)) != std::string::npos) {
- prefix << compIter->first.substr(oldPos, pos - oldPos) << "(";
- prefixNesting++;
- oldPos = pos + 1;
- }
- if (oldPos != compIter->first.size()) {
- prefix << compIter->first.substr(oldPos, compIter->first.size() - oldPos) << "(";
- prefixNesting++;
- }
- assertFromData(compIter->second, expr + prefix.str(), nesting + prefixNesting);
- compIter++;
- }
- }
-
- if (data.array.size() > 0) {
- std::list<Data>::const_iterator arrIter = data.array.begin();
- while(arrIter != data.array.end()) {
- assertFromData(*arrIter, expr, nesting);
- arrIter++;
- }
- }
-
- if (data.node) {
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
-
- xmlDoc << data.node;
- URL domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), ";
- dataInitStr << "copy_term(XML,DATA), ";
- dataInitStr << "assert(";
- dataInitStr << expr << "(DATA)";
-
- for (size_t i = 0; i < nesting; i++) {
- dataInitStr << ")";
- }
-
- PlCall(dataInitStr.str().c_str());
- return;
- }
-}
-
-#if 0
-std::list<PlCompound> SWIDataModel::getSolutions(PlCompound compound) {
- std::list<PlCompound> solutions;
-
- PlTermv termv(compound.arity());
- for (size_t i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
- while(query.next_solution()) {
-// std::cout << (char*)compound << std::endl;
- solutions.push_back(compound);
- }
- return solutions;
-}
-#endif
-
-Data SWIDataModel::getStringAsData(const std::string& content) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(content.c_str());
- PlCompound orig(content.c_str());
- Data data;
-
- PlTermv termv(compound.arity());
- for (size_t i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
-
- while(query.next_solution()) {
- std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
- std::map<std::string, PlTerm>::const_iterator varIter = vars.begin();
-
- while(varIter != vars.end()) {
- data.merge(termAsData(varIter->second));
- varIter++;
- }
-
- }
-// std::cout << Data::toJSON(data) << std::endl;
- return data;
- } catch (PlException plex) {
- try {
- // could not parse as compound, try term and type in termAsData
- PlTerm term(content.c_str());
- return(termAsData(term));
- }
- RETHROW_PLEX_AS_EVENT
- }
- return Data();
-}
-
-Data SWIDataModel::termAsData(PlTerm term) {
-
- Data data;
-// std::cout << term.name() << (char*)term << std::endl;
-
- switch (term.type()) {
- case PL_TERM:
- for (size_t i = 1; i <= term.arity(); i++) { // arguments start at 1
- data.compound[term.name()] = termAsData(term[i]);
- }
- break;
- case PL_VARIABLE:
- case PL_INTEGER:
- case PL_FLOAT:
- case PL_SHORT:
- case PL_INT:
- case PL_LONG:
- case PL_DOUBLE:
- data.atom = std::string(term);
- data.type = Data::INTERPRETED;
- break;
- case PL_STRING:
- case PL_ATOM:
- data.atom = std::string(term);
- data.type = Data::VERBATIM;
- break;
-#ifdef SWI_HAS_PL_NIL
- case PL_NIL:
- data.array.push_back(Data("", Data::VERBATIM));
- break;
-#endif
-#ifdef SWI_HAS_PL_LIST_PAIR
- case PL_LIST_PAIR: {
- PlTail tail(term);
- PlTerm item;
- while(tail.next(item)) {
- data.array.push_back(termAsData(item));
- }
- break;
- }
-#endif
-#ifdef SWI_HAS_DICT
- case PL_DICT: {
- std::string key(term);
- size_t curlyPos = key.find_first_of("{");
- if (curlyPos == std::string::npos || curlyPos == 0) {
- // no key given
- PL_for_dict(term, SWIDataModel::dictCallBack, &data, 0);
- } else {
- // with key given
- Data& tmp = data.compound[boost::trim_copy(key.substr(0, curlyPos))];
- PL_for_dict(term, SWIDataModel::dictCallBack, &tmp, 0);
- }
- break;
- }
-#endif
- default:
- LOG(ERROR) << "Prolog type " << term.type() << " at '" << (char*)term << "' not supported";
- break;
- }
- return data;
-}
-
-int SWIDataModel::dictCallBack(term_t key, term_t value, int last, void *closure) {
- Data* data = (Data*)closure;
- PlTerm keyTerm(key);
- data->compound[(char*)keyTerm] = termAsData(value);
- return 0;
-}
-
-PlTerm SWIDataModel::dataAsTerm(Data data) {
- if (data.atom.length() > 0) {
- return PlTerm(data.atom.c_str());
- }
- if (data.array.size() > 0) {
- PlTerm head;
- PlTail list(head);
-
- std::list<Data>::const_iterator arrIter = data.array.begin();
- while(arrIter != data.array.end()) {
- list.append(dataAsTerm(*arrIter));
- arrIter++;
- }
- list.close();
- return PlTail(head);
- }
- if (data.compound.size() > 0) {
- if (data.compound.size() == 1 && data.compound.begin()->second.array.size() > 0) {
- // this used to be a prolog compound
- const Data& arr = data.compound.begin()->second;
- PlTermv termv(arr.array.size());
- int index = 0;
-
- std::list<Data>::const_iterator arrIter = arr.array.begin();
- while(arrIter != arr.array.end()) {
- termv[index] = dataAsTerm(*arrIter);
- index++;
- arrIter++;
- }
- return PlCompound(data.compound.begin()->first.c_str(), termv);
- } else if (data.compound.size() == 1 && data.compound.begin()->second.compound.size() > 0) {
- // this used to be a named dict - until we have dict support in C/C++ use PL_chars_to_term
- std::stringstream dictSS;
- std::string seperator;
- dictSS << data.compound.begin()->first << "{";
-
- std::map<std::string, Data>::const_iterator keyIter = data.compound.begin()->second.compound.begin();
- while(keyIter != data.compound.begin()->second.compound.end()) {
- dictSS << seperator << keyIter->first << ":" << (char*)dataAsTerm(keyIter->second);
- seperator = ",";
- keyIter++;
- }
- dictSS << "}";
- return PlCompound(dictSS.str().c_str());
-
- } else {
- // an array of dicts
- PlTermv termv(data.compound.size());
- int index = 0;
-
- std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
- while(compIter != data.compound.end()) {
- termv[index] = PlCompound(compIter->first.c_str(), dataAsTerm(compIter->second));
- index++;
- compIter++;
- }
- return PlCompound(data.compound.begin()->first.c_str(), termv);
-
- }
- }
- if (data.binary) {
- LOG(ERROR) << "Binary data with prolog datamodel still very experimental";
-// term_t binTerm = PL_new_term_ref();
-// PL_put_blob(binTerm, data.binary->data, data.binary->size, &blobType);
-// return binTerm;
- }
- if (data.node) {
- LOG(ERROR) << "DOM in event with prolog datamodel still very experimental";
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
- // xmlDoc << event.getFirstDOMElement();
- xmlDoc << data.node;
- URL domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), assert(event(data(DATA)))";
- PlCall(dataInitStr.str().c_str());
- }
-
- return PlTerm();
-}
-
-bool SWIDataModel::validate(const std::string& location, const std::string& schema) {
- SWIEngineLock engineLock;
-// std::cout << "SWIDataModel::validate" << std::endl;
- return true;
-}
-
-bool SWIDataModel::isLocation(const std::string& expr) {
- return true;
-}
-
-uint32_t SWIDataModel::getLength(const std::string& expr) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(expr.c_str());
- PlTermv termv(compound.arity());
- for (size_t i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
- uint32_t length = 0;
- while(query.next_solution() > 0)
- length++;
- return length;
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(array.c_str());
- PlCompound orig(array.c_str());
- PlTermv termv(compound.arity());
- for (size_t i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- {
- int tmp = iteration + 1;
- PlQuery query(compound.name(), termv);
- while (tmp) {
- query.next_solution();
- tmp--;
- }
- }
- PlCall("retractall", PlCompound(index.c_str(), 1));
- PlCall("retractall", PlCompound(item.c_str(), 1));
- PlCall("assert", PlCompound(index.c_str(), PlTerm((long)iteration)));
-
- std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
- std::map<std::string, PlTerm>::iterator varIter = vars.begin();
- while(varIter != vars.end()) {
- PlCall("assert", PlCompound(item.c_str(), varIter->second));
- varIter++;
- }
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::eval(const Element<std::string>& scriptElem, const std::string& expr) {
- SWIEngineLock engineLock;
- try {
- if (scriptElem && HAS_ATTR(scriptElem, "type") && iequals(ATTR(scriptElem, "type"), "query")) {
- evalAsBool(expr);
- } else {
- URL localPLFile = URL::toLocalFile(expr, ".pl");
- PlCall("user", "load_files", PlTermv(localPLFile.asLocalFile(".pl").c_str())) || LOG(ERROR) << "Could not execute prolog from file";
- }
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-bool SWIDataModel::evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
-}
-
-bool SWIDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(expr.c_str());
- PlTermv termv(compound.arity());
- for (size_t i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
- return query.next_solution() > 0;
- }
- RETHROW_PLEX_AS_EVENT
- catch(...) {
- return false;
- }
-}
-
-std::string SWIDataModel::evalAsString(const std::string& expr) {
- SWIEngineLock engineLock;
- try {
-
- PlCompound compound(expr.c_str());
-
- if (strlen(compound.name())) {
- PlCompound orig(expr.c_str());
-
- PlTermv termv(compound.arity());
- for (size_t i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
-
- std::stringstream ss;
- std::string solSeparator = "";
- while (query.next_solution()) {
- ss << solSeparator;
- std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
- std::map<std::string, PlTerm>::const_iterator varIter = vars.begin();
-
- std::string varSeparator = "";
- while(varIter != vars.end()) {
- ss << varSeparator << (char *)varIter->second;
- varSeparator = ", ";
- varIter++;
- }
- solSeparator = "\n";
- }
- return ss.str();
- }
- return std::string(compound);
-
- } catch(PlException plex) {
- // we got an exception while trying to evaluate as compound
- PlTerm term(expr.c_str());
- if (term.type() == PL_ATOM || term.type() == PL_CHARS || term.type() == PL_STRING) {
- return std::string(term);
- } else {
- ERROR_EXECUTION_THROW((char*)plex);
- }
- }
-}
-
-
-// this is similar to http://etalis.googlecode.com/svn/eEtalis/src/term.c
-std::map<std::string, PlTerm> SWIDataModel::resolveAtoms(PlTerm& term, PlTerm& orig) {
- try {
- std::map<std::string, PlTerm> atoms;
- switch (orig.type()) {
- case PL_VARIABLE: {
- atoms[(char *)orig] = term;
- break;
- }
- case PL_ATOM:
- break;
- case PL_STRING:
- break;
- case PL_INTEGER:
- break;
- case PL_TERM:
- for (size_t i = 1; i <= orig.arity(); i++) {
- PlTerm newTerm = term[i];
- PlTerm newOrig = orig[i];
- std::map<std::string, PlTerm> result = resolveAtoms(newTerm, newOrig);
- atoms.insert(result.begin(), result.end());
- }
- break;
- default:
- LOG(ERROR) << "Resolving variable of unknown type in query solution";
- }
- return atoms;
- }
- RETHROW_PLEX_AS_EVENT
-}
-
-void SWIDataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
- SWIEngineLock engineLock;
- try {
- std::string expr = content;
- std::string predicate;
- if (HAS_ATTR(assignElem, "expr")) {
- expr = ATTR(assignElem, "expr");
- }
- if (HAS_ATTR(assignElem, "id"))
- predicate = ATTR(assignElem, "id");
- if (HAS_ATTR(assignElem, "location"))
- predicate = ATTR(assignElem, "location");
-
- if (predicate.size() > 0) {
- std::string callAssert = "assert";
- std::string type;
- if (HAS_ATTR(assignElem, "type")) {
- type = ATTR(assignElem, "type");
- if(iequals(type, "append")) {
- callAssert = "assertz";
- } else if(iequals(type, "prepend")) {
- callAssert = "asserta";
- }
- }
-
- URL domUrl;
- Data json;
- if (!node)
- json = Data::fromJSON(expr);
- if (node) {
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
- Node<std::string> child = node;
- while(child) {
- xmlDoc << child;
- child = child.getNextSibling();
- }
- domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- if (iequals(type, "retract"))
- PlCall("retractall", PlCompound(predicate.c_str(), 1));
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), " << callAssert << "(" << predicate << "(DATA))";
- PlCall(dataInitStr.str().c_str());
- } else if (!json.empty()) {
- std::stringstream dataInitStr;
- if (iequals(type, "retract"))
- PlCall("retractall", PlCompound(predicate.c_str(), 1));
- dataInitStr << "json_to_prolog(" << expr << ", JSON), assert(" << predicate << "(JSON))";
- PlCall(dataInitStr.str().c_str());
- } else {
- // treat content as . seperated facts
- std::stringstream factStream(expr);
- std::string item;
- while(std::getline(factStream, item, '.')) {
- std::string fact = boost::trim_copy(item);
- if (fact.length() == 0)
- continue;
- PlCall((callAssert + "(" + predicate + "(" + fact + "))").c_str());
- }
- }
- } else if (expr.length() > 0) {
- if (boost::equals(TAGNAME(assignElem), "data")) {
- eval(assignElem, expr);
- } else {
- std::stringstream exprStream(expr);
- std::string item;
- while(std::getline(exprStream, item, '.')) {
- std::string plExpr = boost::trim_copy(item);
- if (plExpr.length() == 0)
- continue;
- PlCall(plExpr.c_str());
- }
- }
- }
- }
- RETHROW_PLEX_AS_EVENT
-}
-
-void SWIDataModel::assign(const std::string& location, const Data& data) {
- eval(Element<std::string>(), data.atom);
-}
-
-void SWIDataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& node,
- const std::string& content) {
- assign(dataElem, node, content);
-}
-void SWIDataModel::init(const std::string& location, const Data& data) {
- assign(location, data);
-}
-
-bool SWIDataModel::isDeclared(const std::string& expr) {
- return true;
-}
-
-void SWIDataModel::acquireBlob(atom_t symbol) {
-}
-
-
-int SWIDataModel::releaseBlob(atom_t symbol) {
- return TRUE;
-}
-
-int SWIDataModel::compareBlob(atom_t a, atom_t b) {
- return 0;
-}
-
-int SWIDataModel::writeBlob(void *s, atom_t symbol, int flags) {
- return TRUE;
-}
-
-
-}
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
deleted file mode 100644
index e968b61..0000000
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SWIDATAMODEL_H_KN8TWG0V
-#define SWIDATAMODEL_H_KN8TWG0V
-
-#include "uscxml/InterpreterInfo.h"
-#include "uscxml/plugins/DataModel.h"
-#include "uscxml/SWIConfig.h"
-
-#include <list>
-#include <SWI-cpp.h>
-
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class SWIDataModel : public DataModelImpl {
-public:
- class SWIEngineLock {
- public:
- SWIEngineLock() {
- isLocked = false;
- int rc = PL_set_engine(PL_ENGINE_MAIN, NULL);
- if (rc == PL_ENGINE_SET) {
- isLocked = true;
- }
- }
- ~SWIEngineLock() {
- if (isLocked)
- PL_set_engine(NULL, NULL);
- }
- bool isLocked;
- };
-
- SWIDataModel();
- virtual ~SWIDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("prolog");
- return names;
- }
-
- virtual void initialize();
- virtual void setSessionId(const std::string& sessionId);
- virtual void setName(const std::string& name);
- virtual void setEvent(const Event& event);
-
- virtual void registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor);
-
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
-
- virtual uint32_t getLength(const std::string& expr);
- virtual void setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration);
-
- virtual void pushContext();
- virtual void popContext();
-
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void assign(const std::string& location, const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void init(const std::string& location, const Data& data);
-
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
-
- virtual bool isDeclared(const std::string& expr);
-
- virtual Data getStringAsData(const std::string& content);
-
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
- virtual bool evalAsBool(const std::string& expr);
-
- static foreign_t inPredicate(term_t a0, int arity, void* context);
-protected:
- void assertFromData(const Data& data, const std::string& expr, size_t nesting);
-
- static Data termAsData(PlTerm term);
- static PlTerm dataAsTerm(Data data);
-
-// virtual std::list<PlCompound> getSolutions(PlCompound compound);
- virtual std::map<std::string, PlTerm> resolveAtoms(PlTerm& term, PlTerm& orig);
-
- static int dictCallBack(term_t key, term_t value, int last, void *closure);
-
- static PL_blob_t blobType;
- static void acquireBlob(atom_t symbol);
- static int releaseBlob(atom_t symbol);
- static int compareBlob(atom_t a, atom_t b);
- static int writeBlob(void *s, atom_t symbol, int flags);
-
- Event _event;
-
- std::string _plModule;
- std::string _name;
- std::string _sessionId;
- PL_engine_t _engine;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(SWIDataModel, DataModelImpl);
-#endif
-
-}
-
-#endif /* end of include guard: SWIDATAMODEL_H_KN8TWG0V */
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.new b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.new
deleted file mode 100644
index 8238577..0000000
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.new
+++ /dev/null
@@ -1,962 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "uscxml/Common.h"
-#include "uscxml/config.h"
-#include "SWIDataModel.h"
-#include "uscxml/DOMUtils.h"
-#include "uscxml/Message.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-// these are defined but not exported by swi-prolog 7
-extern "C" {
- PL_EXPORT(int) PL_is_dict(term_t t);
- PL_EXPORT(int) PL_for_dict(term_t dict, int (*func)(term_t key, term_t value, int last, void *closure), void *closure, int flags);
-}
-#define RETHROW_PLEX_AS_EVENT \
-catch (PlException plex) { \
- ERROR_EXECUTION_THROW((char*)plex); \
-} \
-
-#define PL_MODULE \
-_interpreter.getSessionId().c_str() \
-
-#define SET_PL_ENGINE(dm) \
-assert(_swiEngines.find(dm) != _swiEngines.end()); \
-int rc = PL_set_engine(_swiEngines[dm], NULL); \
-assert(rc == PL_ENGINE_SET); \
-_dmPtr = dm;
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SWIDataModelProvider() );
- return true;
-}
-#endif
-
-// SWI prolog does not support passing user data
-static SWIDataModel* _dmPtr;
-static std::map<SWIDataModel*, PL_engine_t> _swiEngines;
-
-PL_blob_t SWIDataModel::blobType = {
- PL_BLOB_MAGIC,
- PL_BLOB_NOCOPY,
- (char*)"blob",
- releaseBlob,
- compareBlob,
- writeBlob,
- acquireBlob
-};
-
-SWIDataModel::SWIDataModel() {
-}
-
-SWIDataModel::~SWIDataModel() {
- try {
- if (_swiEngines.find(this) != _swiEngines.end()) {
- PL_destroy_engine(_swiEngines[this]);
- _swiEngines.erase(this);
- }
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-boost::shared_ptr<DataModelImpl> SWIDataModel::create(InterpreterImpl* interpreter) {
- try {
- boost::shared_ptr<SWIDataModel> dm = boost::shared_ptr<SWIDataModel>(new SWIDataModel());
- dm->_interpreter = interpreter;
-
- const char* swibin = getenv("SWI_BINARY");
- if (swibin == NULL)
- swibin = SWI_BINARY;
- const char* quiet = "--quiet";
-
- int argc = 2;
- static char * av[] = {
- (char*)swibin,
- (char*)quiet,
- NULL
- };
-
- if (!PL_is_initialised(NULL, NULL)) {
- if(!PL_initialise(argc,av)) {
- LOG(ERROR) << "Error intializing prolog engine";
- PL_halt(1);
- return boost::shared_ptr<DataModelImpl>();
- }
-
- PL_set_engine(PL_ENGINE_CURRENT, &_engine);
-
- // load SWI XML parser
- try {
- PlCall("use_module", PlCompound("library", PlTerm("sgml")));
- } catch (PlException plex) {
-
- LOG(ERROR) << "Cannot load prolog sgml module - make sure you have it installed in your prolog runtime: " << (char*)plex;
- throw plex;
- }
-
- // load json parser
- try {
- PlCall("use_module", PlCompound("library", PlTerm("http/json")));
- PlCall("use_module", PlCompound("library", PlTerm("http/json_convert")));
- } catch (PlException plex) {
- LOG(ERROR) << "Cannot load prolog json module or json_convert - make sure you have it installed in your prolog runtime: " << (char*)plex;
- throw plex;
- }
-
- } else {
- LOG(WARNING) << "Instantiating more than one SWI prolog datamodel will lead to weird effects as I cannot seperate the environments";
-// engine = PL_create_engine(NULL);
- }
-
-// assert(engine);
-// _swiEngines[dm.get()] = engine;
- _dmPtr = dm.get();
-
-// int rc = PL_set_engine(engine, NULL);
-// assert(rc == PL_ENGINE_SET);
-// (void)rc;
-
- _plModule = boost::replace_all_copy(interpreter->getSessionId(), "-", "");
- boost::replace_all(_plModule, "0", "g");
- boost::replace_all(_plModule, "1", "h");
- boost::replace_all(_plModule, "2", "i");
- boost::replace_all(_plModule, "3", "j");
- boost::replace_all(_plModule, "4", "k");
- boost::replace_all(_plModule, "5", "l");
- boost::replace_all(_plModule, "6", "m");
- boost::replace_all(_plModule, "7", "n");
- boost::replace_all(_plModule, "8", "o");
- boost::replace_all(_plModule, "9", "p");
-
- // use atoms for double quoted
- PlCall("set_prolog_flag(double_quotes,atom).");
-
- // set system variables
- PlCall("assert", PlCompound("sessionid", PlTerm(PlString(dm->_interpreter->getSessionId().c_str()))));
- PlCall("assert", PlCompound("name", PlTerm(PlString(dm->_interpreter->getName().c_str()))));
-
- std::map<std::string, IOProcessor>::const_iterator ioProcIter = dm->_interpreter->getIOProcessors().begin();
- while(ioProcIter != dm->_interpreter->getIOProcessors().end()) {
- Data ioProcData = ioProcIter->second.getDataModelVariables();
-
- if (ioProcIter->first.find_first_of(":/'") == std::string::npos) {
- std::stringstream ioProcShortCall;
- ioProcShortCall << "assert(ioprocessors(" << ioProcIter->first << "(location('" << ioProcData.compound["location"].atom << "'))))";
- PlCall(ioProcShortCall.str().c_str());
- }
- std::stringstream ioProcCall;
- ioProcCall << "assert(ioprocessors(name('" << ioProcIter->first << "'), location('" << ioProcData.compound["location"].atom << "')))";
- PlCall(ioProcCall.str().c_str());
-
- ioProcIter++;
- }
-
- // the in predicate
- PlRegister("user", "in", 1, SWIDataModel::inPredicate);
- PL_set_engine(NULL, NULL);
- return dm;
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-foreign_t SWIDataModel::inPredicate(term_t a0, int arity, void* context) {
- try {
- char *s;
- if ( PL_get_atom_chars(a0, &s) ) {
- if (_dmPtr->_interpreter->isInState(s)) {
- return true;
- }
- }
- return FALSE;
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
-// std::cout << "SWIDataModel::registerIOProcessor" << std::endl;
-}
-
-void SWIDataModel::setSessionId(const std::string& sessionId) {
-// std::cout << "SWIDataModel::setSessionId" << std::endl;
- _sessionId = sessionId;
-}
-
-void SWIDataModel::setName(const std::string& name) {
-// std::cout << "SWIDataModel::setName" << std::endl;
- _name = name;
-}
-
-void SWIDataModel::pushContext() {
-// std::cout << "SWIDataModel::pushContext" << std::endl;
-}
-
-void SWIDataModel::popContext() {
-// std::cout << "SWIDataModel::popContext" << std::endl;
-}
-
-void SWIDataModel::initialize() {
-// std::cout << "SWIDataModel::initialize" << std::endl;
-}
-
-void SWIDataModel::setEvent(const Event& event) {
- SWIEngineLock engineLock;
-
- // remove old event
- try {
- PlCall("retractall(event(_))");
-
- // simple values
- PlCall("assert", PlCompound("event", PlCompound("name", PlTerm(event.name.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("origin", PlString(event.origin.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("origintype", PlString(event.invokeid.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("invokeid", PlTerm(event.origintype.c_str()))));
- PlCall("assert", PlCompound("event", PlCompound("raw", PlString(event.raw.c_str()))));
-
- // event.type
- std::string type;
- switch (event.eventType) {
- case Event::PLATFORM:
- type = "platform";
- break;
- case Event::INTERNAL:
- type = "internal";
- break;
- case Event::EXTERNAL:
- type = "external";
- break;
- }
- PlCall("assert", PlCompound("event", PlCompound("type", PlTerm(type.c_str()))));
-
- // event.sendid
- if (!event.hideSendId)
- PlCall("assert", PlCompound("event", PlCompound("sendid", PlTerm(event.sendid.c_str()))));
-
- // event.data
- URL domUrl;
- if (event.dom) {
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
-// xmlDoc << event.getFirstDOMElement();
- xmlDoc << event.dom;
- domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), assert(event(data(DATA)))";
- PlCall(dataInitStr.str().c_str());
- } else if (event.content.size() > 0) {
- PlCall("assert", PlCompound("event", PlCompound("data", PlString(InterpreterImpl::spaceNormalize(event.content).c_str()))));
- } else if (!event.data.empty()) {
- assertFromData(event.data, "event(data(", 2);
- }
-
- Event::params_t::const_iterator paramIter = event.params.begin();
- while(paramIter != event.params.end()) {
- assertFromData(paramIter->second, "event(param(" + paramIter->first + "(", 3);
- paramIter++;
- }
-
- Event::namelist_t::const_iterator namelistIter = event.namelist.begin();
- while(namelistIter != event.namelist.end()) {
- assertFromData(paramIter->second, "event(param(" + namelistIter->first + "(", 3);
- namelistIter++;
- }
-
-#if 0
- // event.params
- size_t uniqueKeys = 0;
- Event::params_t::const_iterator paramIter = event.params.begin();
- while(paramIter != event.params.end()) {
- uniqueKeys++;
- paramIter = event.params.upper_bound(paramIter->first);
- }
- if (uniqueKeys > 0) {
- paramIter = event.params.begin();
- for(int i = 0; paramIter != event.params.end(); i++) {
- std::stringstream paramArray;
- Event::params_t::const_iterator lastValueIter = event.params.upper_bound(paramIter->first);
-
- paramArray << paramIter->first << "([";
- std::string termSep = "";
-
- for (int j = 0; paramIter != lastValueIter; j++) {
- paramArray << termSep << "'" << paramIter->second << "'";
- termSep = ", ";
- paramIter++;
- }
- paramArray << "])";
- std::stringstream paramExpr;
- paramExpr << "assert(event(param(" << paramArray.str() << ")))";
- //std::cout << paramExpr.str() << std::endl;
- PlCall(paramExpr.str().c_str());
-
- paramIter = lastValueIter;
- }
- }
-#endif
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::assertFromData(const Data& data, const std::string& expr, size_t nesting) {
- if (data.atom.size() > 0) {
- // terminal branch, this is where we assert
-
- std::stringstream ss;
- ss << expr;
-// nesting++;
-
- if (data.type == Data::VERBATIM) {
- ss << "\"" << data.atom << "\"";
- } else {
- ss << data.atom;
- }
-
- for (size_t i = 0; i < nesting; i++) {
- ss << ")";
- }
-
-// std::cout << ss.str() << std::endl;
- PlCall("assert", PlCompound(ss.str().c_str()));
- return;
- }
-
- if (data.compound.size() > 0) {
- std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
- while(compIter != data.compound.end()) {
-// std::cout << compIter->first << std::endl;
- std::stringstream prefix;
- size_t prefixNesting = 0;
- size_t oldPos = 0;
- size_t pos = 0;
- while((pos = compIter->first.find_first_of(",.(-", oldPos)) != std::string::npos) {
- prefix << compIter->first.substr(oldPos, pos - oldPos) << "(";
- prefixNesting++;
- oldPos = pos + 1;
- }
- if (oldPos != compIter->first.size()) {
- prefix << compIter->first.substr(oldPos, compIter->first.size() - oldPos) << "(";
- prefixNesting++;
- }
- assertFromData(compIter->second, expr + prefix.str(), nesting + prefixNesting);
- compIter++;
- }
- }
-
- if (data.array.size() > 0) {
- std::list<Data>::const_iterator arrIter = data.array.begin();
- while(arrIter != data.array.end()) {
- assertFromData(*arrIter, expr, nesting);
- arrIter++;
- }
- }
-
- if (data.node) {
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
-
- xmlDoc << data.node;
- URL domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), ";
- dataInitStr << "copy_term(XML,DATA), ";
- dataInitStr << "assert(";
- dataInitStr << expr << "(DATA)";
-
- for (size_t i = 0; i < nesting; i++) {
- dataInitStr << ")";
- }
-
- PlCall(dataInitStr.str().c_str());
- return;
- }
-}
-
-#if 0
-std::list<PlCompound> SWIDataModel::getSolutions(PlCompound compound) {
- std::list<PlCompound> solutions;
-
- PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
- while(query.next_solution()) {
-// std::cout << (char*)compound << std::endl;
- solutions.push_back(compound);
- }
- return solutions;
-}
-#endif
-
-Data SWIDataModel::getStringAsData(const std::string& content) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(content.c_str());
- PlCompound orig(content.c_str());
- Data data;
-
- PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
-
- while(query.next_solution()) {
- std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
- std::map<std::string, PlTerm>::const_iterator varIter = vars.begin();
-
- while(varIter != vars.end()) {
- data.merge(termAsData(varIter->second));
- varIter++;
- }
-
- }
-// std::cout << Data::toJSON(data) << std::endl;
- return data;
- } catch (PlException plex) {
- try {
- // could not parse as compound, try term and type in termAsData
- PlTerm term(content.c_str());
- return(termAsData(term));
- }
- RETHROW_PLEX_AS_EVENT
- }
- return Data();
-}
-
-Data SWIDataModel::termAsData(PlTerm term) {
-
- Data data;
-// std::cout << term.name() << (char*)term << std::endl;
-
- switch (term.type()) {
- case PL_TERM:
- for (int i = 1; i <= term.arity(); i++) { // arguments start at 1
- data.compound[term.name()] = termAsData(term[i]);
- }
- break;
- case PL_VARIABLE:
- case PL_INTEGER:
- case PL_FLOAT:
- case PL_SHORT:
- case PL_INT:
- case PL_LONG:
- case PL_DOUBLE:
- data.atom = std::string(term);
- data.type = Data::INTERPRETED;
- break;
- case PL_STRING:
- case PL_ATOM:
- data.atom = std::string(term);
- data.type = Data::VERBATIM;
- break;
-#ifdef SWI_HAS_PL_NIL
- case PL_NIL:
- data.array.push_back(Data("", Data::VERBATIM));
- break;
-#endif
-#ifdef SWI_HAS_PL_LIST_PAIR
- case PL_LIST_PAIR: {
- PlTail tail(term);
- PlTerm item;
- while(tail.next(item)) {
- data.array.push_back(termAsData(item));
- }
- break;
- }
-#endif
-#ifdef SWI_HAS_DICT
- case PL_DICT: {
- std::string key(term);
- size_t curlyPos = key.find_first_of("{");
- if (curlyPos == std::string::npos || curlyPos == 0) {
- // no key given
- PL_for_dict(term, SWIDataModel::dictCallBack, &data, 0);
- } else {
- // with key given
- Data& tmp = data.compound[boost::trim_copy(key.substr(0, curlyPos))];
- PL_for_dict(term, SWIDataModel::dictCallBack, &tmp, 0);
- }
- break;
- }
-#endif
- default:
- LOG(ERROR) << "Prolog type " << term.type() << " at '" << (char*)term << "' not supported";
- break;
- }
- return data;
-}
-
-int SWIDataModel::dictCallBack(term_t key, term_t value, int last, void *closure) {
- Data* data = (Data*)closure;
- PlTerm keyTerm(key);
- data->compound[(char*)keyTerm] = termAsData(value);
- return 0;
-}
-
-PlTerm SWIDataModel::dataAsTerm(Data data) {
- if (data.atom.length() > 0) {
- return PlTerm(data.atom.c_str());
- }
- if (data.array.size() > 0) {
- PlTerm head;
- PlTail list(head);
-
- std::list<Data>::const_iterator arrIter = data.array.begin();
- while(arrIter != data.array.end()) {
- list.append(dataAsTerm(*arrIter));
- arrIter++;
- }
- list.close();
- return PlTail(head);
- }
- if (data.compound.size() > 0) {
- if (data.compound.size() == 1 && data.compound.begin()->second.array.size() > 0) {
- // this used to be a prolog compound
- const Data& arr = data.compound.begin()->second;
- PlTermv termv(arr.array.size());
- int index = 0;
-
- std::list<Data>::const_iterator arrIter = arr.array.begin();
- while(arrIter != arr.array.end()) {
- termv[index] = dataAsTerm(*arrIter);
- index++;
- arrIter++;
- }
- return PlCompound(data.compound.begin()->first.c_str(), termv);
- } else if (data.compound.size() == 1 && data.compound.begin()->second.compound.size() > 0) {
- // this used to be a named dict - until we have dict support in C/C++ use PL_chars_to_term
- std::stringstream dictSS;
- std::string seperator;
- dictSS << data.compound.begin()->first << "{";
-
- std::map<std::string, Data>::const_iterator keyIter = data.compound.begin()->second.compound.begin();
- while(keyIter != data.compound.begin()->second.compound.end()) {
- dictSS << seperator << keyIter->first << ":" << (char*)dataAsTerm(keyIter->second);
- seperator = ",";
- keyIter++;
- }
- dictSS << "}";
- return PlCompound(dictSS.str().c_str());
-
- } else {
- // an array of dicts
- PlTermv termv(data.compound.size());
- int index = 0;
-
- std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
- while(compIter != data.compound.end()) {
- termv[index] = PlCompound(compIter->first.c_str(), dataAsTerm(compIter->second));
- index++;
- compIter++;
- }
- return PlCompound(data.compound.begin()->first.c_str(), termv);
-
- }
- }
- if (data.binary) {
- LOG(ERROR) << "Binary data with prolog datamodel still very experimental";
-// term_t binTerm = PL_new_term_ref();
-// PL_put_blob(binTerm, data.binary->data, data.binary->size, &blobType);
-// return binTerm;
- }
- if (data.node) {
- LOG(ERROR) << "DOM in event with prolog datamodel still very experimental";
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
- // xmlDoc << event.getFirstDOMElement();
- xmlDoc << data.node;
- URL domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), assert(event(data(DATA)))";
- PlCall(dataInitStr.str().c_str());
- }
-
- return PlTerm();
-}
-
-bool SWIDataModel::validate(const std::string& location, const std::string& schema) {
- SWIEngineLock engineLock;
-// std::cout << "SWIDataModel::validate" << std::endl;
- return true;
-}
-
-bool SWIDataModel::isLocation(const std::string& expr) {
- return true;
-}
-
-uint32_t SWIDataModel::getLength(const std::string& expr) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(expr.c_str());
- PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
- uint32_t length = 0;
- while(query.next_solution() > 0)
- length++;
- return length;
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(array.c_str());
- PlCompound orig(array.c_str());
- PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- {
- int tmp = iteration + 1;
- PlQuery query(compound.name(), termv);
- while (tmp) {
- query.next_solution();
- tmp--;
- }
- }
- PlCall("retractall", PlCompound(index.c_str(), 1));
- PlCall("retractall", PlCompound(item.c_str(), 1));
- PlCall("assert", PlCompound(index.c_str(), PlTerm((long)iteration)));
-
- std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
- std::map<std::string, PlTerm>::iterator varIter = vars.begin();
- while(varIter != vars.end()) {
- PlCall("assert", PlCompound(item.c_str(), varIter->second));
- varIter++;
- }
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-void SWIDataModel::eval(const Element<std::string>& scriptElem, const std::string& expr) {
- SWIEngineLock engineLock;
- try {
- if (scriptElem && HAS_ATTR(scriptElem, "type") && iequals(ATTR(scriptElem, "type"), "query")) {
- evalAsBool(expr);
- } else {
- URL localPLFile = URL::toLocalFile(expr, ".pl");
- PlCall("user", "load_files", PlTermv(localPLFile.asLocalFile(".pl").c_str())) || LOG(ERROR) << "Could not execute prolog from file";
- }
- }
- RETHROW_PLEX_AS_EVENT;
-}
-
-bool SWIDataModel::evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
-}
-
-bool SWIDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
- SWIEngineLock engineLock;
- try {
- PlCompound compound(expr.c_str());
- PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
- return query.next_solution() > 0;
- }
- RETHROW_PLEX_AS_EVENT
- catch(...) {
- return false;
- }
-}
-
-std::string SWIDataModel::evalAsString(const std::string& expr) {
- SWIEngineLock engineLock;
- try {
-
- PlCompound compound(expr.c_str());
-
- if (strlen(compound.name())) {
- PlCompound orig(expr.c_str());
-
- PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
- termv[i] = compound[i + 1];
- }
- PlQuery query(compound.name(), termv);
-
- std::stringstream ss;
- std::string solSeparator = "";
- while (query.next_solution()) {
- ss << solSeparator;
- std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
- std::map<std::string, PlTerm>::const_iterator varIter = vars.begin();
-
- std::string varSeparator = "";
- while(varIter != vars.end()) {
- ss << varSeparator << (char *)varIter->second;
- varSeparator = ", ";
- varIter++;
- }
- solSeparator = "\n";
- }
- return ss.str();
- }
- return std::string(compound);
-
- } catch(PlException plex) {
- // we got an exception while trying to evaluate as compound
- PlTerm term(expr.c_str());
- if (term.type() == PL_ATOM || term.type() == PL_CHARS || term.type() == PL_STRING) {
- return std::string(term);
- } else {
- ERROR_EXECUTION_THROW((char*)plex);
- }
- }
-}
-
-
-// this is similar to http://etalis.googlecode.com/svn/eEtalis/src/term.c
-std::map<std::string, PlTerm> SWIDataModel::resolveAtoms(PlTerm& term, PlTerm& orig) {
- try {
- std::map<std::string, PlTerm> atoms;
- switch (orig.type()) {
- case PL_VARIABLE: {
- atoms[(char *)orig] = term;
- break;
- }
- case PL_ATOM:
- break;
- case PL_STRING:
- break;
- case PL_INTEGER:
- break;
- case PL_TERM:
- for (int i = 1; i <= orig.arity(); i++) {
- PlTerm newTerm = term[i];
- PlTerm newOrig = orig[i];
- std::map<std::string, PlTerm> result = resolveAtoms(newTerm, newOrig);
- atoms.insert(result.begin(), result.end());
- }
- break;
- default:
- LOG(ERROR) << "Resolving variable of unknown type in query solution";
- }
- return atoms;
- }
- RETHROW_PLEX_AS_EVENT
-}
-
-void SWIDataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
- SWIEngineLock engineLock;
- try {
- std::string callAssert = "assert";
- std::string solution;
- std::string expr = content;
- std::string predicate;
- if (HAS_ATTR(assignElem, "solution"))
- solution = ATTR(assignElem, "solution");
- if (HAS_ATTR(assignElem, "expr"))
- expr = ATTR(assignElem, "expr");
- if (HAS_ATTR(assignElem, "id"))
- predicate = ATTR(assignElem, "id");
- if (HAS_ATTR(assignElem, "location"))
- predicate = ATTR(assignElem, "location");
-
- if (solution.size() > 0 && expr.size() > 0 && predicate.size() > 0) {
- // <assign location="var1" solution="Y" expr="var1(X), Y is X + 1, retractall(var1(_))"/>
- std::cout << expr + ", " + callAssert + "(" + predicate + "(" + solution + "))" << std::endl;
- PlCall((expr + ", " + callAssert + "(" + predicate + "(" + solution + "))").c_str());
- return;
- }
-
- if (expr.size() > 0 && predicate.size()) {
- Data json = Data::fromJSON(expr);
- if (!json.empty()) {
- std::cout << callAssert + "(" + predicate + ")" << std::endl;
- PlCall((callAssert + "(" + predicate + ")").c_str());
- // expression is a JSON structure!
- std::stringstream dataInitStr;
- // if (iequals(type, "retract"))
- // PlCall("retractall", PlCompound(predicate.c_str(), 1));
- dataInitStr << "json_to_prolog(" << expr << ", JSON), assert(" << predicate << "(JSON))";
- PlCall(dataInitStr.str().c_str());
- return;
- }
- }
-
- if (expr.size() > 0 && predicate.size()) {
- // treat content as . seperated facts
- std::stringstream factStream(expr);
- std::string item;
- while(std::getline(factStream, item, '.')) {
- std::string fact = boost::trim_copy(item);
- if (fact.length() == 0)
- continue;
- std::cout << callAssert + "(" + predicate + "(" + fact + "))" << std::endl;
- PlCall((callAssert + "(" + predicate + "(" + fact + "))").c_str());
- }
- return;
- }
-
- if (predicate.size() > 0) {
- std::cout << callAssert + "(" + predicate + ")" << std::endl;
- PlCall((callAssert + "(" + predicate + ")").c_str());
- return;
- }
-
- abort();
-
- if (expr.size() == 0) {
- // no expression, just assert id or idlocation
- std::cout << callAssert + "(" + predicate + ")" << std::endl;
- PlCall((callAssert + "(" + predicate + ")").c_str());
- return;
- }
-
-
- std::cout << expr + ", " + callAssert + "(" + predicate + ")" << std::endl;
- PlCall((expr + ", " + callAssert + "(" + predicate + ")").c_str());
-
-
- }
-#if 0
- try {
- std::string expr = content;
- std::string predicate;
- if (HAS_ATTR(assignElem, "expr")) {
- expr = ATTR(assignElem, "expr");
- }
- if (HAS_ATTR(assignElem, "id"))
- predicate = ATTR(assignElem, "id");
- if (HAS_ATTR(assignElem, "location"))
- predicate = ATTR(assignElem, "location");
-
- if (predicate.size() > 0) {
- std::string callAssert = "assert";
- std::string type;
- if (HAS_ATTR(assignElem, "type")) {
- type = ATTR(assignElem, "type");
- if(iequals(type, "append")) {
- callAssert = "assertz";
- } else if(iequals(type, "prepend")) {
- callAssert = "asserta";
- }
- }
-
- URL domUrl;
- Data json;
- if (!node)
- json = Data::fromJSON(expr);
- if (node) {
- std::stringstream dataInitStr;
- std::stringstream xmlDoc;
- Node<std::string> child = node;
- while(child) {
- xmlDoc << child;
- child = child.getNextSibling();
- }
- domUrl = URL::toLocalFile(xmlDoc.str(), ".pl");
- if (iequals(type, "retract"))
- PlCall("retractall", PlCompound(predicate.c_str(), 1));
- dataInitStr << "load_xml_file('" << domUrl.asLocalFile(".pl") << "', XML), copy_term(XML,DATA), " << callAssert << "(" << predicate << "(DATA))";
- PlCall(dataInitStr.str().c_str());
- } else if (!json.empty()) {
- std::stringstream dataInitStr;
- if (iequals(type, "retract"))
- PlCall("retractall", PlCompound(predicate.c_str(), 1));
- dataInitStr << "json_to_prolog(" << expr << ", JSON), assert(" << predicate << "(JSON))";
- PlCall(dataInitStr.str().c_str());
- } else {
- // treat content as . seperated facts
- std::stringstream factStream(content);
- std::string item;
- while(std::getline(factStream, item, '.')) {
- std::string fact = boost::trim_copy(item);
- if (fact.length() == 0)
- continue;
- PlCall((callAssert + "(" + predicate + "(" + fact + "))").c_str());
- }
- }
- } else if (expr.length() > 0) {
- if (boost::equals(TAGNAME(assignElem), "data")) {
- eval(assignElem, expr);
- } else {
- std::stringstream exprStream(expr);
- std::string item;
- while(std::getline(exprStream, item, '.')) {
- std::string plExpr = boost::trim_copy(item);
- if (plExpr.length() == 0)
- continue;
- PlCall(plExpr.c_str());
- }
- }
- }
- }
-#endif
- RETHROW_PLEX_AS_EVENT
-}
-
-void SWIDataModel::assign(const std::string& location, const Data& data) {
- eval(Element<std::string>(), data.atom);
-}
-
-void SWIDataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& node,
- const std::string& content) {
- assign(dataElem, node, content);
-}
-void SWIDataModel::init(const std::string& location, const Data& data) {
- assign(location, data);
-}
-
-bool SWIDataModel::isDeclared(const std::string& expr) {
- return true;
-}
-
-void SWIDataModel::acquireBlob(atom_t symbol) {
-}
-
-
-int SWIDataModel::releaseBlob(atom_t symbol) {
- return TRUE;
-}
-
-int SWIDataModel::compareBlob(atom_t a, atom_t b) {
- return 0;
-}
-
-int SWIDataModel::writeBlob(void *s, atom_t symbol, int flags) {
- return TRUE;
-}
-
-
-}
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp
deleted file mode 100644
index d65e9c7..0000000
--- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp
+++ /dev/null
@@ -1,814 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "uscxml/Common.h"
-#include "uscxml/config.h"
-#include "uscxml/util/String.h"
-#include "PromelaDataModel.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/Message.h"
-#include <glog/logging.h>
-#include <cctype>
-
-#include "PromelaParser.h"
-#include "parser/promela.tab.hpp"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#define INVALID_ASSIGNMENT(name) \
-name.compare("_sessionid") == 0 || \
-name.compare("_name") == 0 || \
-name.compare("_ioprocessors") == 0 || \
-name.compare("_event") == 0
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new PromelaDataModelProvider() );
- return true;
-}
-#endif
-
-PromelaDataModel::PromelaDataModel() {
-}
-
-PromelaDataModel::~PromelaDataModel() {
-}
-
-boost::shared_ptr<DataModelImpl> PromelaDataModel::create(InterpreterInfo* interpreter) {
- boost::shared_ptr<PromelaDataModel> dm = boost::shared_ptr<PromelaDataModel>(new PromelaDataModel());
- dm->_interpreter = interpreter;
-
- // session id
- Data sessionId;
- sessionId.compound["type"] = Data("string", Data::VERBATIM);
- sessionId.compound["value"] = Data(interpreter->getSessionId(), Data::VERBATIM);
- dm->_variables["_sessionid"] = sessionId;
-
- // name
- Data name;
- name.compound["type"] = Data("string", Data::VERBATIM);
- name.compound["value"] = Data(interpreter->getName(), Data::VERBATIM);
- dm->_variables["_name"] = name;
-
- // ioprocessors
- Data ioProcs;
- ioProcs.compound["type"] = Data("compound", Data::VERBATIM);
-
- std::map<std::string, IOProcessor> ioProcessors = interpreter->getIOProcessors();
- for (std::map<std::string, IOProcessor>::iterator iter = ioProcessors.begin(); iter != ioProcessors.end(); iter++) {
- ioProcs.compound["value"].compound[iter->first] = iter->second.getDataModelVariables();
- }
- dm->_variables["_ioprocessors"] = ioProcs;
-
- dm->_lastMType = 0;
- return dm;
-}
-
-void PromelaDataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
-}
-
-void PromelaDataModel::pushContext() {
-// std::cout << "PromelaDataModel::pushContext" << std::endl;
-}
-
-void PromelaDataModel::popContext() {
-// std::cout << "PromelaDataModel::popContext" << std::endl;
-}
-
-void PromelaDataModel::setEvent(const Event& event) {
- Data variable;
- variable.compound["type"] = Data("compound", Data::VERBATIM);
- variable.compound["value"].compound["name"] = Data(event.name, Data::VERBATIM);
- variable.compound["value"].compound["origin"] = Data(event.origin, Data::VERBATIM);
- variable.compound["value"].compound["origintype"] = Data(event.origintype, Data::VERBATIM);
- variable.compound["value"].compound["invokeid"] = Data(event.invokeid, Data::VERBATIM);
- if (event.hideSendId) {
- variable.compound["value"].compound["sendid"] = Data("", Data::VERBATIM);
- } else {
- variable.compound["value"].compound["sendid"] = Data(event.sendid, Data::VERBATIM);
- }
- switch (event.eventType) {
- case Event::PLATFORM:
- variable.compound["value"].compound["type"] = Data("platform", Data::VERBATIM);
- break;
- case Event::INTERNAL:
- variable.compound["value"].compound["type"] = Data("internal", Data::VERBATIM);
- break;
- case Event::EXTERNAL:
- variable.compound["value"].compound["type"] = Data("external", Data::VERBATIM);
- break;
- default:
- variable.compound["value"].compound["type"] = Data("invalid", Data::VERBATIM);
- break;
- }
-
- if (event.dom) {
- // no support
- } else if (event.content.length() > 0) {
- // _event.data is a string or JSON
- Data json = Data::fromJSON(event.content);
- if (!json.empty()) {
- variable.compound["value"].compound["data"] = json;
- } else {
- if (isNumeric(event.content.c_str(), 10)) {
- variable.compound["value"].compound["data"] = Data(event.content, Data::INTERPRETED);
- } else {
- variable.compound["value"].compound["data"] = Data(spaceNormalize(event.content), Data::VERBATIM);
- }
- }
- } else {
- // _event.data is KVP
- if (!event.data.empty()) {
- variable.compound["value"].compound["data"] = event.data;
- } else {
- // test 343 / test 488
- variable.compound["value"].compound["data"];
- }
-
- for (Event::params_t::const_iterator start = event.params.begin(), end = event.params.end();
- start != end; start = event.params.upper_bound(start->first)) {
- // only set first param key
- if (isNumeric(start->second.atom.c_str(), 10)) {
- variable.compound["value"].compound["data"].compound[start->first] = strTo<int>(start->second.atom);
- } else {
- variable.compound["value"].compound["data"].compound[start->first] = start->second;
- }
- }
-
- for (Event::namelist_t::const_iterator iter = event.namelist.begin(); iter != event.namelist.end(); iter++) {
- if (isNumeric(iter->second.atom.c_str(), 10)) {
- variable.compound["value"].compound["data"].compound[iter->first] = strTo<int>(iter->second.atom);
- } else {
- variable.compound["value"].compound["data"].compound[iter->first] = iter->second;
- }
- }
- }
-
- // iterate all data elements and adapt type for int if atom is integer
- adaptType(variable.compound["value"].compound["data"]);
-
- _variables["_event"] = variable;
-}
-
-void PromelaDataModel::adaptType(Data& data) {
- if (data.atom.length() > 0 && isInteger(data.atom.c_str(), 10)) {
- data.type = Data::INTERPRETED;
- return;
- }
-
- if (data.array.size() > 0) {
- for (std::list<Data>::iterator iter = data.array.begin(); iter != data.array.end(); iter++) {
- adaptType(*iter);
- }
- return;
- }
-
- if (data.compound.size() > 0) {
- for (std::map<std::string, Data>::iterator iter = data.compound.begin(); iter != data.compound.end(); iter++) {
- adaptType(iter->second);
- }
- return;
- }
-
-}
-
-Data PromelaDataModel::getStringAsData(const std::string& content) {
- return evaluateExpr(content);
-}
-
-
-bool PromelaDataModel::validate(const std::string& location, const std::string& schema) {
-// std::cout << "PromelaDataModel::validate" << std::endl;
- return true;
-}
-
-bool PromelaDataModel::isLocation(const std::string& expr) {
- return true;
-}
-
-bool PromelaDataModel::isValidSyntax(const std::string& expr) {
- try {
- PromelaParser parser(expr);
- } catch (Event e) {
- LOG(ERROR) << e << std::endl;
- return false;
- }
- return true;
-}
-
-uint32_t PromelaDataModel::getLength(const std::string& expr) {
- if (!isDeclared(expr)) {
- ERROR_EXECUTION_THROW("Variable '" + expr + "' was not declared");
- }
-
- if (!_variables[expr].hasKey("size")) {
- ERROR_EXECUTION_THROW("Variable '" + expr + "' is no array");
- }
-
- return strTo<int>(_variables[expr]["size"].atom);
-}
-
-void PromelaDataModel::setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration) {
- // assign array element to item
- std::stringstream ss;
- ss << array << "[" << iteration << "]";
-
- PromelaParser itemParser(item, 1, PromelaParser::PROMELA_EXPR);
- if (itemParser.ast->type != PML_NAME)
- ERROR_EXECUTION_THROW("Expression '" + item + "' is no valid item");
-
- PromelaParser arrayParser(ss.str(), 1, PromelaParser::PROMELA_EXPR);
-
- setVariable(itemParser.ast, getVariable(arrayParser.ast));
-
- if (index.length() > 0) {
- PromelaParser indexParser(index, 1, PromelaParser::PROMELA_EXPR);
- setVariable(indexParser.ast, iteration);
- }
-
-}
-
-void PromelaDataModel::eval(const Element<std::string>& scriptElem, const std::string& expr) {
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_STMNT);
- evaluateStmnt(parser.ast);
-// parser.dump();
-}
-
-bool PromelaDataModel::evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
-}
-
-bool PromelaDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_EXPR);
-// parser.dump();
- Data tmp = evaluateExpr(parser.ast);
-
- if (tmp.atom.compare("false") == 0)
- return false;
- if (tmp.atom.compare("0") == 0)
- return false;
- return true;
-}
-
-std::string PromelaDataModel::evalAsString(const std::string& expr) {
- PromelaParser parser(expr);
- return evaluateExpr(parser.ast);
-}
-
-void PromelaDataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
- std::string key;
- std::string value;
-
- if (node) {
- ERROR_EXECUTION_THROW("Assigning DOM node to variable is not supported");
- }
-
- if (HAS_ATTR(assignElem, "id")) {
- key = ATTR(assignElem, "id");
- } else if (HAS_ATTR(assignElem, "location")) {
- key = ATTR(assignElem, "location");
- }
-
- if (HAS_ATTR(assignElem, "expr")) {
- if (key.length() == 0) {
- ERROR_EXECUTION_THROW("Assign element has neither id nor location");
- }
- value = ATTR(assignElem, "expr");
- } else {
- value = content;
- }
-
- if (value.length() == 0)
- return;
-
- Data json = Data::fromJSON(value);
- if (!json.empty()) {
- // simply assign from json to key
- assign(key, json);
- } else {
- std::string expr = key + " = " + value;
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_STMNT);
- evaluateStmnt(parser.ast);
- }
-}
-
-void PromelaDataModel::evaluateDecl(const std::string& expr) {
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_DECL);
- evaluateDecl(parser.ast);
-}
-
-Data PromelaDataModel::evaluateExpr(const std::string& expr) {
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_EXPR);
- return evaluateExpr(parser.ast);
-}
-
-void PromelaDataModel::evaluateStmnt(const std::string& expr) {
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_STMNT);
- evaluateStmnt(parser.ast);
-}
-
-void PromelaDataModel::evaluateDecl(void* ast) {
- PromelaParserNode* node = (PromelaParserNode*)ast;
-// node->dump();
- if (false) {
- } else if (node->type == PML_DECL) {
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
- PromelaParserNode* vis = *opIter++;
- PromelaParserNode* type = *opIter++;
- PromelaParserNode* varlist = *opIter++;
-
- for (std::list<PromelaParserNode*>::iterator nameIter = varlist->operands.begin();
- nameIter != varlist->operands.end();
- nameIter++) {
- Data variable;
- variable.compound["vis"] = Data(vis->value, Data::VERBATIM);
- variable.compound["type"] = Data(type->value, Data::VERBATIM);
-
- if (false) {
- } else if ((*nameIter)->type == PML_NAME) {
- // plain variables without initial assignment
-
- if (type->value == "mtype") {
- variable.compound["value"] = Data(_lastMType++, Data::INTERPRETED);
- } else {
- variable.compound["value"] = Data(0, Data::INTERPRETED);
- }
- _variables.compound[(*nameIter)->value] = variable;
-
- } else if ((*nameIter)->type == PML_ASGN) {
- // initially assigned variables
-
- std::list<PromelaParserNode*>::iterator opIterAsgn = (*nameIter)->operands.begin();
- PromelaParserNode* name = *opIterAsgn++;
- PromelaParserNode* expr = *opIterAsgn++;
-
- try {
- variable.compound["value"] = evaluateExpr(expr);
- } catch(uscxml::Event e) {
- // test277, declare and throw
- _variables.compound[name->value] = variable;
- throw e;
- }
-
- assert(opIterAsgn == (*nameIter)->operands.end());
- _variables.compound[name->value] = variable;
- } else if ((*nameIter)->type == PML_VAR_ARRAY) {
- // variable arrays
-
- std::list<PromelaParserNode*>::iterator opIterAsgn = (*nameIter)->operands.begin();
- PromelaParserNode* name = *opIterAsgn++;
- int size = dataToInt(evaluateExpr(*opIterAsgn++));
-
- variable.compound["size"] = size;
- for (size_t i = 0; i < size; i++) {
- variable.compound["value"].array.push_back(Data(0, Data::INTERPRETED));
- }
-
- assert(opIterAsgn == (*nameIter)->operands.end());
- _variables.compound[name->value] = variable;
-
- } else {
- ERROR_EXECUTION_THROW("Declaring variables via " + PromelaParserNode::typeToDesc((*nameIter)->type) + " not implemented");
- }
- }
- assert(opIter == node->operands.end());
- } else if (node->type == PML_DECLLIST) {
- for (std::list<PromelaParserNode*>::iterator declIter = node->operands.begin();
- declIter != node->operands.end();
- declIter++) {
- evaluateDecl(*declIter);
- }
- } else {
- node->dump();
- ERROR_EXECUTION_THROW("Declaring variables via " + PromelaParserNode::typeToDesc(node->type) + " not implemented");
- }
-}
-
-int PromelaDataModel::dataToInt(const Data& data) {
- if (data.type != Data::INTERPRETED)
- ERROR_EXECUTION_THROW("Operand is not integer");
- int value = strTo<int>(data.atom);
- if (data.atom.compare(toStr(value)) != 0)
- ERROR_EXECUTION_THROW("Operand is not integer");
- return value;
-}
-
-bool PromelaDataModel::dataToBool(const Data& data) {
- if (data.atom.size() == 0) // empty string or undefined
- return false;
-
- if (data.type == Data::VERBATIM) {
- // non-empty string is true
- return true;
- } else {
- if (data.atom.compare("true") == 0) {
- // boolean true is true
- return true;
- } else if (data.atom.compare("false") == 0) {
- return false;
- } else if (dataToInt(data) != 0) {
- return true; // non zero values are true
- }
- }
- return false;
-}
-
-Data PromelaDataModel::evaluateExpr(void* ast) {
- PromelaParserNode* node = (PromelaParserNode*)ast;
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
- switch (node->type) {
- case PML_CONST:
- if (iequals(node->value, "false"))
- return Data(false);
- if (iequals(node->value, "true"))
- return Data(true);
- return strTo<int>(node->value);
- case PML_NAME:
- case PML_VAR_ARRAY:
- case PML_CMPND:
- return getVariable(node);
- case PML_STRING: {
- std::string stripped = node->value.substr(1, node->value.size() - 2);
- return Data(stripped, Data::VERBATIM);
-// return Data(node->value, Data::INTERPRETED);
- }
- case PML_PLUS:
- return dataToInt(evaluateExpr(*opIter++)) + dataToInt(evaluateExpr(*opIter++));
- case PML_MINUS:
- return dataToInt(evaluateExpr(*opIter++)) - dataToInt(evaluateExpr(*opIter++));
- case PML_DIVIDE:
- return dataToInt(evaluateExpr(*opIter++)) / dataToInt(evaluateExpr(*opIter++));
- case PML_MODULO:
- return dataToInt(evaluateExpr(*opIter++)) % dataToInt(evaluateExpr(*opIter++));
- case PML_EQ: {
- PromelaParserNode* lhs = *opIter++;
- PromelaParserNode* rhs = *opIter++;
-
- Data left = evaluateExpr(lhs);
- Data right = evaluateExpr(rhs);
-
- if (left == right) // overloaded operator==
- return Data(true);
-
- // literal strings or strings in variables
- if ((lhs->type == PML_STRING || rhs->type == PML_STRING)
- || (left.type == Data::VERBATIM && right.type == Data::VERBATIM)) {
- return (left.atom.compare(right.atom) == 0 ? Data(true) : Data(false));
- }
- return dataToInt(left) == dataToInt(right);
- }
- case PML_NEG:
- return !dataToBool(evaluateExpr(*opIter++));
- case PML_LT:
- return dataToInt(evaluateExpr(*opIter++)) < dataToInt(evaluateExpr(*opIter++));
- case PML_LE:
- return dataToInt(evaluateExpr(*opIter++)) <= dataToInt(evaluateExpr(*opIter++));
- case PML_GT:
- return dataToInt(evaluateExpr(*opIter++)) > dataToInt(evaluateExpr(*opIter++));
- case PML_GE:
- return dataToInt(evaluateExpr(*opIter++)) >= dataToInt(evaluateExpr(*opIter++));
- case PML_TIMES:
- return dataToInt(evaluateExpr(*opIter++)) * dataToInt(evaluateExpr(*opIter++));
- case PML_LSHIFT:
- return dataToInt(evaluateExpr(*opIter++)) << dataToInt(evaluateExpr(*opIter++));
- case PML_RSHIFT:
- return dataToInt(evaluateExpr(*opIter++)) >> dataToInt(evaluateExpr(*opIter++));
- case PML_AND:
- case PML_OR: {
- PromelaParserNode* lhs = *opIter++;
- PromelaParserNode* rhs = *opIter++;
-
-// std::cout << "-----" << std::endl;
-// lhs->dump();
-// rhs->dump();
-
- Data left = evaluateExpr(lhs);
- Data right = evaluateExpr(rhs);
-
- bool truthLeft = dataToBool(left);
- bool truthRight = dataToBool(right);
-
- if (node->type == PML_AND) {
- return truthLeft && truthRight;
- } else {
- return truthLeft || truthRight;
- }
- }
- default:
- ERROR_EXECUTION_THROW("Support for " + PromelaParserNode::typeToDesc(node->type) + " expressions not implemented");
- }
- return 0;
-}
-
-void PromelaDataModel::evaluateStmnt(void* ast) {
- PromelaParserNode* node = (PromelaParserNode*)ast;
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
- switch (node->type) {
- case PML_ASGN: {
- PromelaParserNode* name = *opIter++;
- PromelaParserNode* expr = *opIter++;
- setVariable(name, evaluateExpr(expr));
- break;
- }
- case PML_STMNT: {
- while(opIter != node->operands.end()) {
- evaluateStmnt(*opIter++);
- }
- break;
- }
- case PML_INCR: {
- PromelaParserNode* name = *opIter++;
- setVariable(name, strTo<long>(getVariable(name)) + 1);
- break;
- }
- case PML_DECR: {
- PromelaParserNode* name = *opIter++;
- setVariable(name, strTo<long>(getVariable(name)) - 1);
- break;
- }
- default:
- node->dump();
- ERROR_EXECUTION_THROW("No support for " + PromelaParserNode::typeToDesc(node->type) + " statement implemented");
- }
-}
-
-
-void PromelaDataModel::setVariable(void* ast, const Data& value) {
- PromelaParserNode* node = (PromelaParserNode*)ast;
-
- if (INVALID_ASSIGNMENT(node->value)) {
- ERROR_EXECUTION_THROW("Cannot assign to " + node->value);
- }
-
-// if (_variables.compound.find(name->value) == _variables.compound.end()) {
-// // declare implicitly / convenience
-// evaluateDecl(ast);
-// }
-
- switch (node->type) {
- case PML_VAR_ARRAY: {
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
-
- PromelaParserNode* name = *opIter++;
- PromelaParserNode* expr = *opIter++;
-
- // is the location an array?
- if (!_variables[name->value].hasKey("size")) {
- ERROR_EXECUTION_THROW("Variable " + name->value + " is no array");
- }
-
- // is the array large enough?
- int index = dataToInt(evaluateExpr(expr));
- if (strTo<int>(_variables[name->value]["size"].atom) <= index) {
- ERROR_EXECUTION_THROW("Index " + toStr(index) + " in array " + name->value + "[" + _variables[name->value]["size"].atom + "] is out of bounds");
- }
-
- _variables.compound[name->value].compound["value"][index] = value;
-
- break;
- }
- case PML_NAME: {
- // location is an array, but no array was passed
- if (_variables[node->value].hasKey("size")) {
- if (value.compound.size() > 0 || value.atom.size() > 0)
- ERROR_EXECUTION_THROW("Variable " + node->value + " is an array");
-
- if (strTo<size_t>(_variables[node->value].compound["size"].atom) < value.array.size())
- ERROR_EXECUTION_THROW("Array assigned to " + node->value + " is too large");
- }
-
- _variables.compound[node->value].compound["value"] = value;
- break;
- }
- case PML_CMPND: {
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
- PromelaParserNode* name = *opIter++;
-
- // location is no array
- if (_variables[name->value].hasKey("size")) {
- ERROR_EXECUTION_THROW("Variable " + name->value + " is an array");
- }
-
-// std::cout << Data::toJSON(_variables) << std::endl;;
-
- Data* var = &_variables[name->value].compound["value"];
- var->compound["type"] = Data("compound", Data::VERBATIM);
- var->compound["vis"] = Data("", Data::VERBATIM);
-
- while(opIter != node->operands.end()) {
- name = *opIter;
- opIter++;
- var = &(var->compound[name->value]);
- }
- *var = value;
-
- break;
- }
- default:
- node->dump();
- ERROR_EXECUTION_THROW("No support for " + PromelaParserNode::typeToDesc(node->type) + " variables implemented");
- break;
- }
-
-// std::cout << Data::toJSON(_variables) << std::endl;
-}
-
-Data PromelaDataModel::getVariable(void* ast) {
- PromelaParserNode* node = (PromelaParserNode*)ast;
-// node->dump();
-
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
- switch(node->type) {
- case PML_NAME:
- if (_variables.compound.find(node->value) == _variables.compound.end()) {
- ERROR_EXECUTION_THROW("No variable " + node->value + " was declared");
- }
-// if (_variables[node->value].compound.find("size") != _variables[node->value].compound.end()) {
-// ERROR_EXECUTION_THROW("Type error: Variable " + node->value + " is an array");
-// }
- return _variables[node->value]["value"];
- case PML_VAR_ARRAY: {
- PromelaParserNode* name = *opIter++;
- PromelaParserNode* expr = *opIter++;
- int index = dataToInt(evaluateExpr(expr));
-
- if (_variables.compound.find(name->value) == _variables.compound.end()) {
- ERROR_EXECUTION_THROW("No variable " + name->value + " was declared");
- }
-
- if (!_variables[name->value].hasKey("size")) {
- ERROR_EXECUTION_THROW("Variable " + name->value + " is no array");
- }
-
- if (strTo<int>(_variables[name->value]["size"].atom) <= index) {
- ERROR_EXECUTION_THROW("Index " + toStr(index) + " in array " + name->value + "[" + _variables[name->value]["size"].atom + "] is out of bounds");
- }
- return _variables.compound[name->value].compound["value"][index];
- }
- case PML_CMPND: {
-// node->dump();
-// std::cout << Data::toJSON(_variables["_event"]);
- std::stringstream idPath;
- PromelaParserNode* name = *opIter++;
-
- // special case for _x variables
- if (name->value.compare("_x") == 0) {
- PromelaParserNode* what = *opIter++;
-
- if (what->type == PML_VAR_ARRAY) {
- if (what->operands.size() == 2) {
- std::string arrName = what->operands.front()->value;
- std::string index = what->operands.back()->value;
-
- if (what->operands.back()->type == PML_STRING) {
- index = index.substr(1, index.size() - 2); // remove quotes
- }
-
- if (arrName.compare("states") == 0) {
- return Data(_interpreter->isInState(index));
- }
- }
- }
- ERROR_EXECUTION_THROW("No variable " + name->value + " was declared");
- }
-
- if (_variables.compound.find(name->value) == _variables.compound.end()) {
- ERROR_EXECUTION_THROW("No variable " + name->value + " was declared");
- }
-
- Data currData = _variables.compound[name->value]["value"];
- idPath << name->value;
- while(opIter != node->operands.end()) {
- std::string key = (*opIter)->value;
- idPath << "." << key;
- if (currData.compound.find(key) == currData.compound.end()) {
- ERROR_EXECUTION_THROW("No variable " + idPath.str() + " was declared");
- }
- Data tmp = currData.compound[key];
- currData = tmp;
-
- opIter++;
- }
- return currData;
- }
- default:
- ERROR_EXECUTION_THROW("Retrieving value of " + PromelaParserNode::typeToDesc(node->type) + " variable not implemented");
- }
- return 0;
-}
-
-std::string PromelaDataModel::andExpressions(std::list<std::string> expressions) {
-
- if (expressions.size() == 0)
- return "";
-
- if (expressions.size() == 1)
- return *(expressions.begin());
-
- std::ostringstream exprSS;
- exprSS << "(";
- std::string conjunction = "";
- for (std::list<std::string>::const_iterator exprIter = expressions.begin();
- exprIter != expressions.end();
- exprIter++) {
- exprSS << conjunction << "(" << *exprIter << ")";
- conjunction = " && ";
- }
- exprSS << ")";
- return exprSS.str();
-}
-
-void PromelaDataModel::assign(const std::string& location, const Data& data) {
- // used for e.g. to assign command line parameters and idlocation
- PromelaParser parser(location);
- setVariable(parser.ast, data);
-}
-
-void PromelaDataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& node,
- const std::string& content) {
- // from <datamodel>
- if (HAS_ATTR(dataElem, "id")) {
- std::string identifier = ATTR(dataElem, "id");
- std::string type = (HAS_ATTR(dataElem, "type") ? ATTR(dataElem, "type") : "auto");
- std::string arrSize;
-
- size_t bracketPos = type.find("[");
- if (bracketPos != std::string::npos) {
- arrSize = type.substr(bracketPos, type.length() - bracketPos);
- type = type.substr(0, bracketPos);
- }
-
- std::string expr = type + " " + identifier + arrSize;
- PromelaParser parser(expr, 1, PromelaParser::PROMELA_DECL);
- evaluateDecl(parser.ast);
-
- }
- assign(dataElem, node, content);
-}
-void PromelaDataModel::init(const std::string& location, const Data& data) {
- assign(location, data);
-}
-
-bool PromelaDataModel::isDeclared(const std::string& expr) {
- PromelaParser parser(expr);
-// parser.dump();
- if (parser.ast->type == PML_VAR_ARRAY)
- return _variables.compound.find(parser.ast->operands.front()->value) != _variables.compound.end();
-
- if (parser.ast->type == PML_CMPND) {
- // JSON declaration
- std::list<PromelaParserNode*>::iterator opIter = parser.ast->operands.begin();
- Data* var = &_variables;
-
- while(opIter != parser.ast->operands.end()) {
- std::string name = (*opIter)->value;
- opIter++;
- if (var->compound.find(name) != var->compound.end()) {
- var = &(var->compound.at(name));
- } else if (var->compound.find("value") != var->compound.end() && var->compound.at("value").compound.find(name) != var->compound.at("value").compound.end()) {
- var = &(var->compound.at("value").compound.at(name));
- } else {
- return false;
- }
- }
- return true;
-
- }
-
- return _variables.compound.find(expr) != _variables.compound.end();
-}
-
-
-}
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h
deleted file mode 100644
index 0778ecf..0000000
--- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef PROMELADATAMODEL_H_4VG0TDMU
-#define PROMELADATAMODEL_H_4VG0TDMU
-
-#include "uscxml/InterpreterInfo.h"
-#include "uscxml/plugins/DataModel.h"
-#include <list>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class PromelaDataModel : public DataModelImpl {
-public:
- PromelaDataModel();
- virtual ~PromelaDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("promela");
- return names;
- }
-
- virtual void setEvent(const Event& event);
-
- virtual void registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor);
-
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
- virtual bool isValidSyntax(const std::string& expr);
-
- virtual uint32_t getLength(const std::string& expr);
- virtual void setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration);
-
- virtual void pushContext();
- virtual void popContext();
-
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void assign(const std::string& location, const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void init(const std::string& location, const Data& data);
-
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
-
- virtual bool isDeclared(const std::string& expr);
-
- virtual Data getStringAsData(const std::string& content);
-
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
- virtual bool evalAsBool(const std::string& expr);
-
- virtual std::string andExpressions(std::list<std::string> expressions);
-
-protected:
-
- int dataToInt(const Data& data);
- bool dataToBool(const Data& data);
-
- void evaluateDecl(void* ast);
- Data evaluateExpr(void* ast);
- void evaluateStmnt(void* ast);
-
- void evaluateDecl(const std::string& expr);
- Data evaluateExpr(const std::string& expr);
- void evaluateStmnt(const std::string& expr);
-
- void setVariable(void* ast, const Data& value);
- Data getVariable(void* ast);
-
- void adaptType(Data& data);
-
- int _lastMType;
-
- Event _event;
- std::string _name;
- std::string _sessionId;
-
- Data _variables;
-
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(PromelaDataModel, DataModelImpl);
-#endif
-
-}
-
-#endif /* end of include guard: PROMELADATAMODEL_H_4VG0TDMU */
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
deleted file mode 100644
index 3467598..0000000
--- a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "PromelaParser.h"
-#include "parser/promela.tab.hpp"
-#include "uscxml/messages/Event.h"
-
-#include <iostream>
-
-struct yy_buffer_state;
-typedef yy_buffer_state *YY_BUFFER_STATE;
-extern YY_BUFFER_STATE promela__scan_buffer(char *, size_t, void*);
-void promela__delete_buffer(YY_BUFFER_STATE, void*);
-YY_BUFFER_STATE promela__scan_string (const char * yystr , void*);
-
-
-extern int promela_lex (PROMELA_STYPE* yylval_param, PROMELA_LTYPE* yylloc_param, void* yyscanner);
-int promela_lex_init (void**);
-int promela_lex_destroy (void*);
-
-void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscanner, const char* err) {
- PROMELA_LTYPE* yylloc = (PROMELA_LTYPE*)yylloc_param;
- // mark as pending exception as we cannot throw from constructor and have the destructor called
- ERROR_EXECUTION(excEvent, err);
- excEvent.data.compound["line"] = uscxml::Data(yylloc->first_line, uscxml::Data::VERBATIM);
- excEvent.data.compound["col"] = uscxml::Data(yylloc->first_column, uscxml::Data::VERBATIM);
-
- std::stringstream ssUnderline;
- for (size_t i = 0; i < yylloc->first_column; i++)
- ssUnderline << " ";
- ssUnderline << "^";
- excEvent.data.compound["sourcemark"] = uscxml::Data(ssUnderline.str(), uscxml::Data::VERBATIM);
-
- ctx->pendingException = excEvent;
-}
-
-namespace uscxml {
-
-PromelaParser::PromelaParser(const std::string& expr) {
- init(expr);
-}
-
-PromelaParser::PromelaParser(const std::string& expr, int nrArgs, ...) {
- init(expr);
-
- if (nrArgs == 0)
- return;
-
- std::stringstream errSS;
- std::string seperator;
- errSS << "Promela syntax type mismatch: Expected {";
-
- va_list ap;
- va_start(ap, nrArgs);
- for(int i = 1; i <= nrArgs; i++) {
- int expectedType = va_arg(ap, int);
- if (type == expectedType)
- return;
- errSS << seperator << typeToDesc(expectedType);
- seperator = ", ";
- }
- errSS << "} but got " << typeToDesc(type);
- ERROR_EXECUTION_THROW(errSS.str());
-}
-
-void PromelaParser::init(const std::string& expr) {
- ast = NULL;
- parseInCompound = 0;
- input_length = expr.length() + 2; // plus some zero terminators
- input = (char*) calloc(1, input_length);
- memcpy(input, expr.c_str(), expr.length());
-
- promela_lex_init(&scanner);
- // promela_assign_set_extra(ast, &scanner);
- buffer = promela__scan_string(input, scanner);
- // buffer = promela__scan_buffer(input, input_length, scanner);
- promela_parse(this, scanner);
- if (pendingException.name.size() > 0) {
- // parsing failed in promela_error
- destroy();
- pendingException.data.compound["sourceline"] = Data(expr, Data::VERBATIM);
- throw pendingException;
- }
-}
-
-void PromelaParser::destroy() {
- if (ast)
- delete(ast);
- free(input);
- promela__delete_buffer((YY_BUFFER_STATE)buffer, scanner);
- promela_lex_destroy(scanner);
-}
-
-PromelaParser::~PromelaParser() {
- destroy();
-}
-
-std::string PromelaParser::typeToDesc(int type) {
- switch (type) {
- case PROMELA_EXPR:
- return "expression";
- case PROMELA_DECL:
- return "declarations";
- case PROMELA_STMNT:
- return "statements";
- default:
- break;
- }
- return "";
-}
-
-PromelaParserNode::~PromelaParserNode() {
- while(operands.size() > 0) {
- delete operands.front();
- operands.pop_front();
- }
- if (loc)
- free(loc);
-}
-
-PromelaParserNode* PromelaParser::node(int type, int nrArgs, ...) {
- PromelaParserNode* newNode = new PromelaParserNode();
-
- newNode->type = type;
- va_list ap;
- va_start(ap, nrArgs);
- for(int i = 1; i <= nrArgs; i++) {
- newNode->operands.push_back(va_arg(ap, PromelaParserNode*));
- newNode->operands.back()->parent = newNode;
- }
- return newNode;
-}
-
-PromelaParserNode* PromelaParser::value(int type, void* location, const char* value) {
- PromelaParserNode* newNode = new PromelaParserNode();
-
- if (location) {
- PROMELA_LTYPE* location_param = (PROMELA_LTYPE*)location;
- newNode->loc = (PromelaParserNode::Location*)malloc(sizeof(PromelaParserNode::Location));
- newNode->loc->firstCol = location_param->first_column;
- newNode->loc->firstLine = location_param->first_line;
- newNode->loc->lastCol = location_param->last_column;
- newNode->loc->lastLine = location_param->last_line;
- }
-
- newNode->value = value;
- newNode->type = type;
- return newNode;
-}
-
-
-void PromelaParser::dump() {
- switch (type) {
- case PROMELA_EXPR:
- std::cout << "Promela Expression" << std::endl;
- break;
- case PROMELA_DECL:
- std::cout << "Promela Declarations" << std::endl;
- break;
- case PROMELA_STMNT:
- std::cout << "Promela Statement" << std::endl;
- break;
- }
- ast->dump();
-}
-
-
-void PromelaParserNode::merge(PromelaParserNode* node) {
- for (std::list<PromelaParserNode*>::iterator iter = node->operands.begin();
- iter != node->operands.end(); iter++) {
- operands.push_back(*iter);
- (*iter)->parent = this;
- }
- node->operands.clear();
-}
-
-void PromelaParserNode::push(PromelaParserNode* node) {
- node->parent = this;
- operands.push_back(node);
-}
-
-void PromelaParserNode::dump(int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
- std::cout << padding << typeToDesc(type) << ": " << value;
- if (loc != NULL) {
- std::cout << " (" << loc->firstLine << ":" << loc->firstCol << ")-(" << loc->lastLine << ":" << loc->lastCol << ")";
- }
- std::cout << std::endl;
- for (std::list<PromelaParserNode*>::iterator iter = operands.begin();
- iter != operands.end(); iter++) {
- (*iter)->dump(indent + 1);
- }
-}
-
-std::string PromelaParserNode::typeToDesc(int type) {
- switch(type) {
- case PML_PLUS:
- return "PLUS";
- case PML_MINUS:
- return "MINUS";
- case PML_TIMES:
- return "TIMES";
- case PML_DIVIDE:
- return "DIVIDE";
- case PML_MODULO:
- return "MODULO";
- case PML_BITAND:
- return "BITAND";
- case PML_BITXOR:
- return "BITXOR";
- case PML_BITOR:
- return "BITOR";
- case PML_GT:
- return "GT";
- case PML_LT:
- return "LT";
- case PML_GE:
- return "GE";
- case PML_LE:
- return "LE";
- case PML_EQ:
- return "EQ";
- case PML_NE:
- return "NE";
- case PML_AND:
- return "AND";
- case PML_OR:
- return "OR";
- case PML_LSHIFT:
- return "LSHIFT";
- case PML_RSHIFT:
- return "RSHIFT";
- case PML_NEG:
- return "NEG";
- case PML_ASGN:
- return "ASGN";
- case PML_INCR:
- return "INCR";
- case PML_DECR:
- return "DECR";
- case PML_VAR_ARRAY:
- return "VAR_ARRAY";
- case PML_DECL:
- return "DECL";
- case PML_STMNT:
- return "STMNT";
- case PML_TYPE:
- return "TYPE";
- case PML_NAME:
- return "NAME";
- case PML_CONST:
- return "CONST";
- case PML_PRINT:
- return "PRINT";
- case PML_SHOW:
- return "SHOW";
- case PML_EXPR:
- return "EXPR";
- case PML_VARLIST:
- return "VARLIST";
- case PML_DECLLIST:
- return "DECLLIST";
- case PML_NAMELIST:
- return "NAMELIST";
- case PML_STRING:
- return "STRING";
- case PML_TYPEDEF:
- return "TYPEDEF";
- case PML_CMPND:
- return "CMPND";
- case PML_ASSERT:
- return "ASSERT";
-
- default:
- return std::string("UNK(") + toStr(type) + ")";
- }
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaParser.h b/src/uscxml/plugins/datamodel/promela/PromelaParser.h
deleted file mode 100644
index d79a2d0..0000000
--- a/src/uscxml/plugins/datamodel/promela/PromelaParser.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-// bison -v promela.ypp && flex promela.l
-
-#ifndef PROMELA_H_9AB78YB1
-#define PROMELA_H_9AB78YB1
-
-#include <stdlib.h>
-//#include <stdarg.h>
-#include <cstdarg>
-
-#include "uscxml/Message.h"
-
-namespace uscxml {
-
-class PromelaParser;
-
-class PromelaParserNode {
-public:
- struct Location {
- int firstLine;
- int firstCol;
- int lastLine;
- int lastCol;
- };
-
- PromelaParserNode() : type(0), parent(NULL), loc(NULL) {}
- virtual ~PromelaParserNode();
-
- void merge(PromelaParserNode* node);
- void push(PromelaParserNode* node);
- void dump(int indent = 0);
-
- static std::string typeToDesc(int type);
-
- int type;
- std::string value;
- std::list<PromelaParserNode*> operands;
- PromelaParserNode* parent;
- Location* loc;
-};
-
-class PromelaParser {
-public:
- enum Type {
- PROMELA_EXPR,
- PROMELA_DECL,
- PROMELA_STMNT
- };
-
- static std::string typeToDesc(int type);
-
- PromelaParser() : ast(NULL) {}
- PromelaParser(const std::string& expr);
- PromelaParser(const std::string& expr, int nrArgs, ...);
- virtual ~PromelaParser();
-
- virtual PromelaParserNode* node(int type, int nrArgs, ...);
- virtual PromelaParserNode* value(int type, void* location, const char* value);
- void dump();
-
- int parseInCompound;
-
- PromelaParserNode* ast;
- Type type;
-
- Event pendingException;
- operator bool() const {
- return ast != NULL;
- }
-
-protected:
-
- void init(const std::string& expr);
- void destroy();
-
- void* buffer;
- void* scanner;
- char* input;
- size_t input_length;
-};
-
-}
-
-void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscanner, const char* err);
-
-#endif /* end of include guard: PROMELA_H_9AB78YB1 */
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.l b/src/uscxml/plugins/datamodel/promela/parser/promela.l
deleted file mode 100644
index 1edc625..0000000
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.l
+++ /dev/null
@@ -1,117 +0,0 @@
-/* see: http://www.phpcompiler.org/articles/reentrantparser.html */
-/* see: http://spinroot.com/spin/Man/operators.html */
-
-
-%option yylineno
-%option reentrant
-%option bison-bridge
-%option prefix="promela_"
-%option outfile="promela.lex.yy.cpp"
-%option noyywrap
-%option debug
-%option never-interactive nounistd
-%option bison-locations
-
-%{
-
-#include "../PromelaParser.h"
-#include "promela.tab.hpp"
-#define YYSTYPE PROMELA_STYPE
-#define YYLTYPE PROMELA_LTYPE
-#define YY_USER_INIT \
- yycolumn = yylloc->first_line = yylloc->first_column = 0; \
- yylineno = yylloc->last_line = yylloc->last_column = 0; \
-
-//int yycolumn = 1;
-
-#define YY_USER_ACTION \
-{ \
- yylloc->first_line = yylineno; \
- yylloc->first_column = yycolumn; \
- yylloc->last_column = yycolumn + yyleng; \
- yylloc->last_line = yylineno; \
- yycolumn = yycolumn + yyleng; \
-}
-
-%}
-
-DIGIT [0-9]
-ID [_a-zA-Z][_a-zA-Z0-9]*
-L [a-zA-Z_]
-
-%%
-
-\/\*([^*]|\*[^/])*\*+\/ /* multiline comments */
-
-bit|bool|byte|int|mtype|short|unsigned|string|auto {
- yylval->value = strdup(yytext);
- return PML_TYPE;
-}
-
-len { return PML_LEN; }
-false|skip|true { yylval->value = strdup(yytext); return PML_CONST; }
-printf { return PML_PRINT; }
-typedef { return PML_TYPEDEF; }
-assert { return PML_ASSERT; }
-
-"!" { return PML_NEG; }
-"~" { return PML_COMPL; }
-"++" { return PML_INCR; }
-"--" { return PML_DECR; }
-
-"*" { return PML_TIMES; }
-"/" { return PML_DIVIDE; }
-"%" { return PML_MODULO; }
-
-"+" { return PML_PLUS; }
-"-" { return PML_MINUS; }
-
-"<<" { return PML_LSHIFT; }
-">>" { return PML_RSHIFT; }
-
-"<=" { return PML_LE; }
-">=" { return PML_GE; }
-"<" { return PML_LT; }
-">" { return PML_GT; }
-
-"!=" { return PML_NE; }
-"==" { return PML_EQ; }
-
-"&" { return PML_BITAND; }
-"^" { return PML_BITXOR; }
-"|" { return PML_BITOR; }
-
-
-"&&" { return PML_AND; }
-"||" { return PML_OR; }
-
-"." { return PML_DOT; }
-"," { return PML_COMMA; }
-";" { return PML_SEMI; }
-
-"(" { return '('; }
-")" { return ')'; }
-
-"[" { return '['; }
-"]" { return ']'; }
-
-"{" { return '{'; }
-"}" { return '}'; }
-
-"=" { return PML_ASGN; }
-
-L?\"(\\.|[^\\"])*\" { yylval->value = strdup(yytext); return(PML_STRING); }
-
-
-L?'(\\.|[^\'])*\' {
- /* Non PROMELA extension for single quoted string literals */
- yylval->value = strdup(yytext); return(PML_STRING);
-}
-
-{DIGIT}+ { yylval->value = strdup(yytext); return PML_CONST; }
-{ID} { yylval->value = strdup(yytext); return PML_NAME; }
-
-[ \t\n]+ /* eat up whitespace */
-
-
-. { /*printf( "Unrecognized character: %s\n", yytext ); */ }
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp b/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
deleted file mode 100644
index 3a99921..0000000
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
+++ /dev/null
@@ -1,2598 +0,0 @@
-#line 2 "promela.lex.yy.cpp"
-
-#line 4 "promela.lex.yy.cpp"
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-/* %not-for-header */
-
-/* %if-c-only */
-/* %if-not-reentrant */
-/* %endif */
-/* %endif */
-/* %ok-for-header */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* %if-c++-only */
-/* %endif */
-
-/* %if-c-only */
-
-/* %endif */
-
-/* %if-c-only */
-
-/* %endif */
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-/* %if-c-only */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-/* %endif */
-
-/* %if-tables-serialization */
-/* %endif */
-/* end standard C headers. */
-
-/* %if-c-or-c++ */
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-typedef uint64_t flex_uint64_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#endif /* ! FLEXINT_H */
-
-/* %endif */
-
-/* %if-c++-only */
-/* %endif */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* %not-for-header */
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-/* %ok-for-header */
-
-/* %not-for-header */
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-/* %ok-for-header */
-
-/* %if-reentrant */
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* %endif */
-
-/* %if-not-reentrant */
-/* %endif */
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE promela_restart(yyin ,yyscanner )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#define YY_BUF_SIZE 16384
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-/* %if-not-reentrant */
-/* %endif */
-
-/* %if-c-only */
-/* %if-not-reentrant */
-/* %endif */
-/* %endif */
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
- * access to the local variable yy_act. Since yyless() is a macro, it would break
- * existing scanners that call yyless() from OUTSIDE promela_lex.
- * One obvious solution it to make yy_act a global. I tried that, and saw
- * a 5% performance hit in a non-yylineno scanner, because yy_act is
- * normally declared as a register variable-- so it is not worth it.
- */
-#define YY_LESS_LINENO(n) \
- do { \
- yy_size_t yyl;\
- for ( yyl = n; yyl < yyleng; ++yyl )\
- if ( yytext[yyl] == '\n' )\
- --yylineno;\
- }while(0)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state {
- /* %if-c-only */
- FILE *yy_input_file;
- /* %endif */
-
- /* %if-c++-only */
- /* %endif */
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- yy_size_t yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via promela_restart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
-};
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* %if-c-only Standard (non-C++) definition */
-/* %not-for-header */
-
-/* %if-not-reentrant */
-/* %endif */
-/* %ok-for-header */
-
-/* %endif */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-/* %if-c-only Standard (non-C++) definition */
-
-/* %if-not-reentrant */
-/* %not-for-header */
-
-/* %ok-for-header */
-
-/* %endif */
-
-void promela_restart (FILE *input_file ,yyscan_t yyscanner );
-void promela__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE promela__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void promela__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void promela__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void promela_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void promela_pop_buffer_state (yyscan_t yyscanner );
-
-static void promela_ensure_buffer_stack (yyscan_t yyscanner );
-static void promela__load_buffer_state (yyscan_t yyscanner );
-static void promela__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
-
-#define YY_FLUSH_BUFFER promela__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
-
-YY_BUFFER_STATE promela__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE promela__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE promela__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
-
-/* %endif */
-
-void *promela_alloc (yy_size_t ,yyscan_t yyscanner );
-void *promela_realloc (void *,yy_size_t ,yyscan_t yyscanner );
-void promela_free (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer promela__create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- promela_ensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- promela_ensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
-
-#define promela_wrap(n) 1
-#define YY_SKIP_YYWRAP
-
-#define FLEX_DEBUG
-
-typedef unsigned char YY_CHAR;
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-/* %if-c-only Standard (non-C++) definition */
-
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
-
-/* %endif */
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
-/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
- yyleng = (yy_size_t) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
-/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
- yyg->yy_c_buf_p = yy_cp;
-
-/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
-#define YY_NUM_RULES 46
-#define YY_END_OF_BUFFER 47
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
-};
-static yyconst flex_int16_t yy_accept[126] = {
- 0,
- 0, 0, 47, 45, 44, 44, 8, 45, 14, 25,
- 45, 33, 34, 12, 15, 31, 16, 30, 13, 42,
- 32, 21, 39, 22, 43, 43, 35, 36, 26, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 37,
- 27, 38, 9, 44, 23, 0, 40, 0, 28, 0,
- 41, 0, 10, 11, 0, 42, 17, 19, 24, 20,
- 18, 43, 0, 0, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 29, 0, 41, 0, 0, 0, 43, 43, 2, 43,
- 43, 43, 3, 43, 43, 43, 43, 43, 43, 43,
-
- 43, 0, 1, 43, 43, 43, 43, 43, 4, 43,
- 43, 43, 1, 43, 43, 43, 43, 43, 7, 5,
- 43, 43, 6, 43, 0
-} ;
-
-static yyconst flex_int32_t yy_ec[256] = {
- 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 5, 1, 1, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 1, 18, 19,
- 20, 21, 1, 1, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 24, 25, 26, 27, 22, 1, 28, 29, 22, 30,
-
- 31, 32, 33, 34, 35, 22, 36, 37, 38, 39,
- 40, 41, 22, 42, 43, 44, 45, 22, 22, 22,
- 46, 22, 47, 48, 49, 50, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
-} ;
-
-static yyconst flex_int32_t yy_meta[51] = {
- 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
- 1, 2, 2, 1, 1, 1, 1, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 1, 1, 1
-} ;
-
-static yyconst flex_int16_t yy_base[131] = {
- 0,
- 0, 0, 172, 173, 49, 51, 151, 50, 173, 163,
- 48, 173, 173, 173, 157, 173, 154, 173, 156, 149,
- 173, 38, 145, 39, 0, 56, 173, 173, 173, 20,
- 31, 136, 124, 131, 117, 118, 34, 30, 120, 173,
- 110, 173, 173, 77, 173, 57, 173, 154, 173, 59,
- 173, 66, 173, 173, 145, 138, 173, 173, 173, 173,
- 173, 0, 76, 75, 111, 109, 108, 111, 106, 112,
- 104, 108, 100, 110, 104, 108, 100, 96, 99, 96,
- 173, 77, 78, 84, 127, 77, 106, 96, 0, 98,
- 103, 90, 0, 91, 92, 88, 88, 93, 96, 95,
-
- 90, 78, 173, 82, 92, 91, 77, 76, 0, 80,
- 88, 75, 96, 62, 73, 71, 68, 59, 0, 0,
- 65, 65, 0, 65, 173, 109, 111, 88, 113, 115
-} ;
-
-static yyconst flex_int16_t yy_def[131] = {
- 0,
- 125, 1, 125, 125, 125, 125, 125, 126, 125, 125,
- 127, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 128, 128, 125, 125, 125, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 125,
- 125, 125, 125, 125, 125, 126, 125, 126, 125, 127,
- 125, 129, 125, 125, 130, 125, 125, 125, 125, 125,
- 125, 128, 126, 127, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 125, 127, 127, 129, 130, 130, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-
- 128, 130, 125, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 130, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 0, 125, 125, 125, 125, 125
-} ;
-
-static yyconst flex_int16_t yy_nxt[224] = {
- 0,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 4, 28, 29, 30, 31, 25,
- 25, 32, 25, 25, 33, 25, 34, 35, 25, 25,
- 36, 25, 37, 38, 39, 25, 40, 41, 42, 43,
- 44, 44, 44, 44, 47, 51, 57, 58, 60, 61,
- 63, 47, 65, 64, 66, 67, 51, 75, 50, 76,
- 68, 78, 52, 83, 48, 79, 69, 77, 44, 44,
- 47, 48, 51, 52, 51, 51, 50, 102, 86, 62,
- 84, 83, 103, 113, 89, 124, 123, 122, 121, 52,
-
- 48, 52, 52, 89, 120, 119, 86, 118, 84, 46,
- 46, 50, 50, 82, 82, 85, 85, 117, 116, 89,
- 115, 89, 109, 114, 112, 111, 109, 110, 109, 108,
- 107, 106, 105, 89, 89, 89, 104, 86, 101, 100,
- 99, 98, 97, 96, 95, 94, 93, 89, 92, 91,
- 90, 89, 88, 87, 56, 86, 125, 81, 80, 74,
- 73, 72, 71, 70, 59, 56, 55, 54, 53, 49,
- 45, 125, 3, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
-
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125
-} ;
-
-static yyconst flex_int16_t yy_chk[224] = {
- 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 5, 5, 6, 6, 8, 11, 22, 22, 24, 24,
- 26, 46, 30, 26, 30, 31, 50, 37, 52, 37,
- 31, 38, 11, 52, 8, 38, 31, 37, 44, 44,
- 63, 46, 64, 50, 82, 83, 84, 86, 102, 128,
- 52, 84, 86, 102, 124, 122, 121, 118, 117, 64,
-
- 63, 82, 83, 116, 115, 114, 113, 112, 84, 126,
- 126, 127, 127, 129, 129, 130, 130, 111, 110, 108,
- 107, 106, 105, 104, 101, 100, 99, 98, 97, 96,
- 95, 94, 92, 91, 90, 88, 87, 85, 80, 79,
- 78, 77, 76, 75, 74, 73, 72, 71, 70, 69,
- 68, 67, 66, 65, 56, 55, 48, 41, 39, 36,
- 35, 34, 33, 32, 23, 20, 19, 17, 15, 10,
- 7, 3, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
-
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125
-} ;
-
-/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[47] = {
- 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 1, 0, 0,
-};
-
-static yyconst flex_int16_t yy_rule_linenum[46] = {
- 0,
- 44, 46, 51, 52, 53, 54, 55, 57, 58, 59,
- 60, 62, 63, 64, 66, 67, 69, 70, 72, 73,
- 74, 75, 77, 78, 80, 81, 82, 85, 86, 88,
- 89, 90, 92, 93, 95, 96, 98, 99, 101, 103,
- 106, 111, 112, 114, 117
-} ;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#line 1 "promela.l"
-/* see: http://www.phpcompiler.org/articles/reentrantparser.html */
-/* see: http://spinroot.com/spin/Man/operators.html */
-#define YY_NO_UNISTD_H 1
-#line 16 "promela.l"
-
-#include "../PromelaParser.h"
-#include "promela.tab.hpp"
-#define YYSTYPE PROMELA_STYPE
-#define YYLTYPE PROMELA_LTYPE
-#define YY_USER_INIT \
- yycolumn = yylloc->first_line = yylloc->first_column = 0; \
- yylineno = yylloc->last_line = yylloc->last_column = 0; \
-
-//int yycolumn = 1;
-
-#define YY_USER_ACTION \
-{ \
- yylloc->first_line = yylineno; \
- yylloc->first_column = yycolumn; \
- yylloc->last_column = yycolumn + yyleng; \
- yylloc->last_line = yylineno; \
- yycolumn = yycolumn + yyleng; \
-}
-
-#line 661 "promela.lex.yy.cpp"
-
-#define INITIAL 0
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-/* %if-c-only */
-#include <unistd.h>
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-/* %if-c-only Reentrant structure and macros (non-C++). */
-/* %if-reentrant */
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- yy_size_t yy_n_chars;
- yy_size_t yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
- YYSTYPE * yylval_r;
-
- YYLTYPE * yylloc_r;
-
-}; /* end struct yyguts_t */
-
-/* %if-c-only */
-
-static int yy_init_globals (yyscan_t yyscanner );
-
-/* %endif */
-
-/* %if-reentrant */
-
-/* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
-# define yylval yyg->yylval_r
-
-# define yylloc yyg->yylloc_r
-
-int promela_lex_init (yyscan_t* scanner);
-
-int promela_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* %endif */
-
-/* %endif End reentrant structures and macros. */
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int promela_lex_destroy (yyscan_t yyscanner );
-
-int promela_get_debug (yyscan_t yyscanner );
-
-void promela_set_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE promela_get_extra (yyscan_t yyscanner );
-
-void promela_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *promela_get_in (yyscan_t yyscanner );
-
-void promela_set_in (FILE * in_str ,yyscan_t yyscanner );
-
-FILE *promela_get_out (yyscan_t yyscanner );
-
-void promela_set_out (FILE * out_str ,yyscan_t yyscanner );
-
-yy_size_t promela_get_leng (yyscan_t yyscanner );
-
-char *promela_get_text (yyscan_t yyscanner );
-
-int promela_get_lineno (yyscan_t yyscanner );
-
-void promela_set_lineno (int line_number ,yyscan_t yyscanner );
-
-/* %if-bison-bridge */
-
-YYSTYPE * promela_get_lval (yyscan_t yyscanner );
-
-void promela_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-YYLTYPE *promela_get_lloc (yyscan_t yyscanner );
-
-void promela_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
-
-/* %endif */
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int promela_wrap (yyscan_t yyscanner );
-#else
-extern int promela_wrap (yyscan_t yyscanner );
-#endif
-#endif
-
-/* %not-for-header */
-
-static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
-
-/* %ok-for-header */
-
-/* %endif */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-/* %if-c-only Standard (non-C++) definition */
-/* %not-for-header */
-
-#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
-#else
-static int input (yyscan_t yyscanner );
-#endif
-/* %ok-for-header */
-
-/* %endif */
-#endif
-
-/* %if-c-only */
-
-/* %endif */
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* %if-c-only Standard (non-C++) definition */
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
-/* %endif */
-/* %if-c++-only C++ definition */
-/* %endif */
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- yy_size_t n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
-/* %if-c++-only C++ definition \ */\
-/* %endif */
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-/* %if-c-only */
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-#endif
-
-/* %if-tables-serialization structures and prototypes */
-/* %not-for-header */
-
-/* %ok-for-header */
-
-/* %not-for-header */
-
-/* %tables-yydmap generated elements */
-/* %endif */
-/* end tables serialization structures and prototypes */
-
-/* %ok-for-header */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-/* %if-c-only Standard (non-C++) definition */
-
-extern int promela_lex \
-(YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
-
-#define YY_DECL int promela_lex \
- (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only C++ definition */
-/* %endif */
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-/* %% [6.0] YY_RULE_SETUP definition goes here */
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-/* %not-for-header */
-
-/** The main scanner function which does all the work.
- */
-YY_DECL {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* %% [7.0] user's declarations go here */
-#line 42 "promela.l"
-
-
-#line 970 "promela.lex.yy.cpp"
-
- yylval = yylval_param;
-
- yylloc = yylloc_param;
-
- if ( !yyg->yy_init ) {
- yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
-
- if ( ! yyin )
- /* %if-c-only */
- yyin = stdin;
- /* %endif */
- /* %if-c++-only */
- /* %endif */
-
- if ( ! yyout )
- /* %if-c-only */
- yyout = stdout;
- /* %endif */
- /* %if-c++-only */
- /* %endif */
-
- if ( ! YY_CURRENT_BUFFER ) {
- promela_ensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- promela__load_buffer_state(yyscanner );
- }
-
- while ( 1 ) { /* loops until end-of-file is reached */
- /* %% [8.0] yymore()-related code goes here */
- yy_cp = yyg->yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- /* %% [9.0] code to set up and find next match goes here */
- yy_current_state = yyg->yy_start;
-yy_match:
- do {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] ) {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 126 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- } while ( yy_current_state != 125 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
- /* %% [10.0] code to find the action number goes here */
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
- /* %% [11.0] code for yylineno update goes here */
-
- if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) {
- yy_size_t yyl;
- for ( yyl = 0; yyl < yyleng; ++yyl )
- if ( yytext[yyl] == '\n' )
-
- do {
- yylineno++;
- yycolumn=0;
- } while(0)
- ;
- }
-
-do_action: /* This label is used only to access EOF actions. */
-
- /* %% [12.0] debug code goes here */
- if ( yy_flex_debug ) {
- if ( yy_act == 0 )
- fprintf( stderr, "--scanner backing up\n" );
- else if ( yy_act < 46 )
- fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
- (long)yy_rule_linenum[yy_act], yytext );
- else if ( yy_act == 46 )
- fprintf( stderr, "--accepting default rule (\"%s\")\n",
- yytext );
- else if ( yy_act == 47 )
- fprintf( stderr, "--(end of buffer or a NUL)\n" );
- else
- fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
- }
-
- switch ( yy_act ) {
- /* beginning of action switch */
- /* %% [13.0] actions go here */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
-
- case 1:
- /* rule 1 can match eol */
- YY_RULE_SETUP
-#line 44 "promela.l"
- /* multiline comments */
- YY_BREAK
- case 2:
- YY_RULE_SETUP
-#line 46 "promela.l"
- {
- yylval->value = strdup(yytext);
- return PML_TYPE;
- }
- YY_BREAK
- case 3:
- YY_RULE_SETUP
-#line 51 "promela.l"
- { return PML_LEN; }
- YY_BREAK
- case 4:
- YY_RULE_SETUP
-#line 52 "promela.l"
- { yylval->value = strdup(yytext); return PML_CONST; }
- YY_BREAK
- case 5:
- YY_RULE_SETUP
-#line 53 "promela.l"
- { return PML_PRINT; }
- YY_BREAK
- case 6:
- YY_RULE_SETUP
-#line 54 "promela.l"
- { return PML_TYPEDEF; }
- YY_BREAK
- case 7:
- YY_RULE_SETUP
-#line 55 "promela.l"
- { return PML_ASSERT; }
- YY_BREAK
- case 8:
- YY_RULE_SETUP
-#line 57 "promela.l"
- { return PML_NEG; }
- YY_BREAK
- case 9:
- YY_RULE_SETUP
-#line 58 "promela.l"
- { return PML_COMPL; }
- YY_BREAK
- case 10:
- YY_RULE_SETUP
-#line 59 "promela.l"
- { return PML_INCR; }
- YY_BREAK
- case 11:
- YY_RULE_SETUP
-#line 60 "promela.l"
- { return PML_DECR; }
- YY_BREAK
- case 12:
- YY_RULE_SETUP
-#line 62 "promela.l"
- { return PML_TIMES; }
- YY_BREAK
- case 13:
- YY_RULE_SETUP
-#line 63 "promela.l"
- { return PML_DIVIDE; }
- YY_BREAK
- case 14:
- YY_RULE_SETUP
-#line 64 "promela.l"
- { return PML_MODULO; }
- YY_BREAK
- case 15:
- YY_RULE_SETUP
-#line 66 "promela.l"
- { return PML_PLUS; }
- YY_BREAK
- case 16:
- YY_RULE_SETUP
-#line 67 "promela.l"
- { return PML_MINUS; }
- YY_BREAK
- case 17:
- YY_RULE_SETUP
-#line 69 "promela.l"
- { return PML_LSHIFT; }
- YY_BREAK
- case 18:
- YY_RULE_SETUP
-#line 70 "promela.l"
- { return PML_RSHIFT; }
- YY_BREAK
- case 19:
- YY_RULE_SETUP
-#line 72 "promela.l"
- { return PML_LE; }
- YY_BREAK
- case 20:
- YY_RULE_SETUP
-#line 73 "promela.l"
- { return PML_GE; }
- YY_BREAK
- case 21:
- YY_RULE_SETUP
-#line 74 "promela.l"
- { return PML_LT; }
- YY_BREAK
- case 22:
- YY_RULE_SETUP
-#line 75 "promela.l"
- { return PML_GT; }
- YY_BREAK
- case 23:
- YY_RULE_SETUP
-#line 77 "promela.l"
- { return PML_NE; }
- YY_BREAK
- case 24:
- YY_RULE_SETUP
-#line 78 "promela.l"
- { return PML_EQ; }
- YY_BREAK
- case 25:
- YY_RULE_SETUP
-#line 80 "promela.l"
- { return PML_BITAND; }
- YY_BREAK
- case 26:
- YY_RULE_SETUP
-#line 81 "promela.l"
- { return PML_BITXOR; }
- YY_BREAK
- case 27:
- YY_RULE_SETUP
-#line 82 "promela.l"
- { return PML_BITOR; }
- YY_BREAK
- case 28:
- YY_RULE_SETUP
-#line 85 "promela.l"
- { return PML_AND; }
- YY_BREAK
- case 29:
- YY_RULE_SETUP
-#line 86 "promela.l"
- { return PML_OR; }
- YY_BREAK
- case 30:
- YY_RULE_SETUP
-#line 88 "promela.l"
- { return PML_DOT; }
- YY_BREAK
- case 31:
- YY_RULE_SETUP
-#line 89 "promela.l"
- { return PML_COMMA; }
- YY_BREAK
- case 32:
- YY_RULE_SETUP
-#line 90 "promela.l"
- { return PML_SEMI; }
- YY_BREAK
- case 33:
- YY_RULE_SETUP
-#line 92 "promela.l"
- { return '('; }
- YY_BREAK
- case 34:
- YY_RULE_SETUP
-#line 93 "promela.l"
- { return ')'; }
- YY_BREAK
- case 35:
- YY_RULE_SETUP
-#line 95 "promela.l"
- { return '['; }
- YY_BREAK
- case 36:
- YY_RULE_SETUP
-#line 96 "promela.l"
- { return ']'; }
- YY_BREAK
- case 37:
- YY_RULE_SETUP
-#line 98 "promela.l"
- { return '{'; }
- YY_BREAK
- case 38:
- YY_RULE_SETUP
-#line 99 "promela.l"
- { return '}'; }
- YY_BREAK
- case 39:
- YY_RULE_SETUP
-#line 101 "promela.l"
- { return PML_ASGN; }
- YY_BREAK
- case 40:
- /* rule 40 can match eol */
- YY_RULE_SETUP
-#line 103 "promela.l"
- { yylval->value = strdup(yytext); return(PML_STRING); }
- YY_BREAK
- case 41:
- /* rule 41 can match eol */
- YY_RULE_SETUP
-#line 106 "promela.l"
- {
- /* Non PROMELA extension for single quoted string literals */
- yylval->value = strdup(yytext);
- return(PML_STRING);
- }
- YY_BREAK
- case 42:
- YY_RULE_SETUP
-#line 111 "promela.l"
- { yylval->value = strdup(yytext); return PML_CONST; }
- YY_BREAK
- case 43:
- YY_RULE_SETUP
-#line 112 "promela.l"
- { yylval->value = strdup(yytext); return PML_NAME; }
- YY_BREAK
- case 44:
- /* rule 44 can match eol */
- YY_RULE_SETUP
-#line 114 "promela.l"
- /* eat up whitespace */
- YY_BREAK
- case 45:
- YY_RULE_SETUP
-#line 117 "promela.l"
- { /*printf( "Unrecognized character: %s\n", yytext ); */ }
- YY_BREAK
- case 46:
- YY_RULE_SETUP
-#line 118 "promela.l"
- ECHO;
- YY_BREAK
-#line 1336 "promela.lex.yy.cpp"
- case YY_STATE_EOF(INITIAL):
- yyterminate();
-
- case YY_END_OF_BUFFER: {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * promela_lex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) {
- /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state ) {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else {
- /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) ) {
- case EOB_ACT_END_OF_FILE: {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( promela_wrap(yyscanner ) ) {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
-} /* end of promela_lex */
-/* %ok-for-header */
-
-/* %if-c++-only */
-/* %not-for-header */
-
-/* %ok-for-header */
-
-/* %endif */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-/* %if-c-only */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = yyg->yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) {
- /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else {
- yy_size_t num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 ) {
- /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer ) {
- yy_size_t new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- promela_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
- } else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 ) {
- if ( number_to_move == YY_MORE_ADJ ) {
- ret_val = EOB_ACT_END_OF_FILE;
- promela_restart(yyin ,yyscanner);
- }
-
- else {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) promela_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
-
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-/* %if-c-only */
-/* %not-for-header */
-
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- register yy_state_type yy_current_state;
- register char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* %% [15.0] code to get the start state into yy_current_state goes here */
- yy_current_state = yyg->yy_start;
-
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) {
- /* %% [16.0] code to find the next state goes here */
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] ) {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 126 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-/* %if-c-only */
-static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- register int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
- register char *yy_cp = yyg->yy_c_buf_p;
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] ) {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 126 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 125);
-
- return yy_is_jam ? 0 : yy_current_state;
-}
-
-/* %if-c-only */
-
-static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- register char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_cp = yyg->yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yyg->yy_hold_char;
-
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) {
- /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register yy_size_t number_to_move = yyg->yy_n_chars + 2;
- register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
- register char *source =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
- while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
- /* %% [18.0] update yylineno here */
-
- if ( c == '\n' ) {
- --yylineno;
- }
-
- yyg->yytext_ptr = yy_bp;
- yyg->yy_hold_char = *yy_cp;
- yyg->yy_c_buf_p = yy_cp;
-}
-/* %if-c-only */
-
-/* %endif */
-
-/* %if-c-only */
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner)
-#else
-static int input (yyscan_t yyscanner)
-#endif
-
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else {
- /* need more input */
- yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) ) {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- promela_restart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE: {
- if ( promela_wrap(yyscanner ) )
- return 0;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(yyscanner);
-#else
- return input(yyscanner);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
- /* %% [19.0] update BOL and yylineno */
- if ( c == '\n' )
-
- do {
- yylineno++;
- yycolumn=0;
- } while(0)
- ;
-
- return c;
-}
-/* %if-c-only */
-#endif /* ifndef YY_NO_INPUT */
-/* %endif */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
-/* %if-c-only */
-void promela_restart (FILE * input_file , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ) {
- promela_ensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- promela__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- promela__load_buffer_state(yyscanner );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
-/* %if-c-only */
-void promela__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* TODO. We should be able to replace this entire function body
- * with
- * promela_pop_buffer_state();
- * promela_push_buffer_state(new_buffer);
- */
- promela_ensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER ) {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- promela__load_buffer_state(yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (promela_wrap()) processing, but the only time this flag
- * is looked at is after promela_wrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-/* %if-c-only */
-static void promela__load_buffer_state (yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
-/* %if-c-only */
-YY_BUFFER_STATE promela__create_buffer (FILE * file, int size , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) promela_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in promela__create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) promela_alloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in promela__create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- promela__init_buffer(b,file ,yyscanner);
-
- return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with promela__create_buffer()
- * @param yyscanner The scanner object.
- */
-/* %if-c-only */
-void promela__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- promela_free((void *) b->yy_ch_buf ,yyscanner );
-
- promela_free((void *) b ,yyscanner );
-}
-
-/* %if-c-only */
-
-/* %endif */
-
-/* %if-c++-only */
-/* %endif */
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a promela_restart() or at EOF.
- */
-/* %if-c-only */
-static void promela__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- promela__flush_buffer(b ,yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then promela__init_buffer was _probably_
- * called from promela_restart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER) {
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- /* %if-c-only */
-
- b->yy_is_interactive = 0;
-
- /* %endif */
- /* %if-c++-only */
- /* %endif */
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
-/* %if-c-only */
-void promela__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- promela__load_buffer_state(yyscanner );
-}
-
-/* %if-c-or-c++ */
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- * @param yyscanner The scanner object.
- */
-/* %if-c-only */
-void promela_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- promela_ensure_buffer_stack(yyscanner);
-
- /* This block is copied from promela__switch_to_buffer. */
- if ( YY_CURRENT_BUFFER ) {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from promela__switch_to_buffer. */
- promela__load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-/* %endif */
-
-/* %if-c-or-c++ */
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- * @param yyscanner The scanner object.
- */
-/* %if-c-only */
-void promela_pop_buffer_state (yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- promela__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
-
- if (YY_CURRENT_BUFFER) {
- promela__load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
-}
-/* %endif */
-
-/* %if-c-or-c++ */
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-/* %if-c-only */
-static void promela_ensure_buffer_stack (yyscan_t yyscanner)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-{
- yy_size_t num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (!yyg->yy_buffer_stack) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)promela_alloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in promela_ensure_buffer_stack()" );
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
-
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) {
-
- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)promela_realloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in promela_ensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
-}
-/* %endif */
-
-/* %if-c-only */
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) promela_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in promela__scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- promela__switch_to_buffer(b ,yyscanner );
-
- return b;
-}
-/* %endif */
-
-/* %if-c-only */
-/** Setup the input buffer state to scan a string. The next call to promela_lex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * promela__scan_bytes() instead.
- */
-YY_BUFFER_STATE promela__scan_string (yyconst char * yystr , yyscan_t yyscanner) {
-
- return promela__scan_bytes(yystr,strlen(yystr) ,yyscanner);
-}
-/* %endif */
-
-/* %if-c-only */
-/** Setup the input buffer state to scan the given bytes. The next call to promela_lex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE promela__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n, i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) promela_alloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in promela__scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = promela__scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in promela__scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-/* %endif */
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-/* %if-c-only */
-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-/* %endif */
-/* %if-c++-only */
-/* %endif */
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-/* Accessor methods (get/set functions) to struct members. */
-
-/* %if-c-only */
-/* %if-reentrant */
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE promela_get_extra (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
-}
-
-/* %endif */
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int promela_get_lineno (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
-}
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int promela_get_column (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
-}
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *promela_get_in (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *promela_get_out (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
-}
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-yy_size_t promela_get_leng (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *promela_get_text (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
-}
-
-/* %if-reentrant */
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void promela_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
-}
-
-/* %endif */
-
-/** Set the current line number.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void promela_set_lineno (int line_number , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "promela_set_lineno called with no buffer" , yyscanner);
-
- yylineno = line_number;
-}
-
-/** Set the current column.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void promela_set_column (int column_no , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "promela_set_column called with no buffer" , yyscanner);
-
- yycolumn = column_no;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see promela__switch_to_buffer
- */
-void promela_set_in (FILE * in_str , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
-}
-
-void promela_set_out (FILE * out_str , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
-}
-
-int promela_get_debug (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-void promela_set_debug (int bdebug , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = bdebug ;
-}
-
-/* %endif */
-
-/* %if-reentrant */
-/* Accessor methods for yylval and yylloc */
-
-/* %if-bison-bridge */
-
-YYSTYPE * promela_get_lval (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
-}
-
-void promela_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
-}
-
-YYLTYPE *promela_get_lloc (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylloc;
-}
-
-void promela_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylloc = yylloc_param;
-}
-
-/* %endif */
-
-/* User-visible API */
-
-/* promela_lex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-
-int promela_lex_init(yyscan_t* ptr_yy_globals)
-
-{
- if (ptr_yy_globals == NULL) {
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) promela_alloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL) {
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* promela_lex_init_extra has the same functionality as promela_lex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to promela_alloc in
- * the yyextra field.
- */
-
-int promela_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
-{
- struct yyguts_t dummy_yyguts;
-
- promela_set_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL) {
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) promela_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL) {
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- promela_set_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* %endif if-c-only */
-
-/* %if-c-only */
-static int yy_init_globals (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from promela_lex_destroy(), so don't allocate here.
- */
-
- yyg->yy_buffer_stack = 0;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = (char *) 0;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
- /* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
-#else
- yyin = (FILE *) 0;
- yyout = (FILE *) 0;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * promela_lex_init()
- */
- return 0;
-}
-/* %endif */
-
-/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
-/* promela_lex_destroy is for both reentrant and non-reentrant scanners. */
-int promela_lex_destroy (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER) {
- promela__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- promela_pop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- promela_free(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
-
- /* Destroy the start condition stack. */
- promela_free(yyg->yy_start_stack ,yyscanner );
- yyg->yy_start_stack = NULL;
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * promela_lex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* %if-reentrant */
- /* Destroy the main struct (reentrant only). */
- promela_free ( yyscanner , yyscanner );
- yyscanner = NULL;
- /* %endif */
- return 0;
-}
-/* %endif */
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-void *promela_alloc (yy_size_t size , yyscan_t yyscanner) {
- return (void *) malloc( size );
-}
-
-void *promela_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
-}
-
-void promela_free (void * ptr , yyscan_t yyscanner) {
- free( (char *) ptr ); /* see promela_realloc() for (char *) cast */
-}
-
-/* %if-tables-serialization definitions */
-/* %define-yytables The name for this specific scanner's tables. */
-#define YYTABLES_NAME "yytables"
-/* %endif */
-
-/* %ok-for-header */
-
-#line 118 "promela.l"
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
deleted file mode 100644
index 098c890..0000000
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
+++ /dev/null
@@ -1,2634 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "2.7.12-4996"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-/* Substitute the type names. */
-#define YYSTYPE PROMELA_STYPE
-#define YYLTYPE PROMELA_LTYPE
-/* Substitute the variable and function names. */
-#define yyparse promela_parse
-#define yylex promela_lex
-#define yyerror promela_error
-#define yylval promela_lval
-#define yychar promela_char
-#define yydebug promela_debug
-#define yynerrs promela_nerrs
-#define yylloc promela_lloc
-
-/* Copy the first part of user declarations. */
-/* Line 371 of yacc.c */
-#line 14 "promela.ypp"
-
-#include "../PromelaParser.h"
-#include "promela.tab.hpp"
-#include <sys/types.h>
-#include <stdarg.h>
-
-#define YYMAXDEPTH 20000 // default is 10000
-#define YYDEBUG 1
-#define YYERROR_VERBOSE 1
-
-extern int promela_lex (PROMELA_STYPE* yylval_param, PROMELA_LTYPE* yylloc_param, void* yyscanner);
-
-using namespace uscxml;
-
-/* Line 371 of yacc.c */
-#line 93 "promela.tab.cpp"
-
-# ifndef YY_NULL
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULL nullptr
-# else
-# define YY_NULL 0
-# endif
-# endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 1
-#endif
-
-/* In a future release of Bison, this section will be replaced
- by #include "promela.tab.hpp". */
-#ifndef YY_PROMELA_PROMELA_TAB_HPP_INCLUDED
-# define YY_PROMELA_PROMELA_TAB_HPP_INCLUDED
-/* Enabling traces. */
-#ifndef PROMELA_DEBUG
-# if defined YYDEBUG
-# if YYDEBUG
-# define PROMELA_DEBUG 1
-# else
-# define PROMELA_DEBUG 0
-# endif
-# else /* ! defined YYDEBUG */
-# define PROMELA_DEBUG 1
-# endif /* ! defined YYDEBUG */
-#endif /* ! defined PROMELA_DEBUG */
-#if PROMELA_DEBUG
-extern int promela_debug;
-#endif
-
-/* Tokens. */
-#ifndef PROMELA_TOKENTYPE
-# define PROMELA_TOKENTYPE
-/* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
-enum promela_tokentype {
- PML_VAR_ARRAY = 258,
- PML_VARLIST = 259,
- PML_DECL = 260,
- PML_DECLLIST = 261,
- PML_STMNT = 262,
- PML_COLON = 263,
- PML_EXPR = 264,
- PML_NAMELIST = 265,
- PML_ASSERT = 266,
- PML_PRINT = 267,
- PML_PRINTM = 268,
- PML_LEN = 269,
- PML_STRING = 270,
- PML_TYPEDEF = 271,
- PML_MTYPE = 272,
- PML_INLINE = 273,
- PML_RETURN = 274,
- PML_LABEL = 275,
- PML_OF = 276,
- PML_GOTO = 277,
- PML_BREAK = 278,
- PML_ELSE = 279,
- PML_SEMI = 280,
- PML_ARROW = 281,
- PML_IF = 282,
- PML_FI = 283,
- PML_DO = 284,
- PML_OD = 285,
- PML_FOR = 286,
- PML_SELECT = 287,
- PML_IN = 288,
- PML_SEP = 289,
- PML_DOTDOT = 290,
- PML_HIDDEN = 291,
- PML_SHOW = 292,
- PML_ISLOCAL = 293,
- PML_CONST = 294,
- PML_TYPE = 295,
- PML_XU = 296,
- PML_NAME = 297,
- PML_UNAME = 298,
- PML_PNAME = 299,
- PML_INAME = 300,
- PML_CLAIM = 301,
- PML_TRACE = 302,
- PML_INIT = 303,
- PML_LTL = 304,
- PML_COMMA = 305,
- PML_ASGN = 306,
- PML_AND = 307,
- PML_OR = 308,
- PML_BITAND = 309,
- PML_BITXOR = 310,
- PML_BITOR = 311,
- PML_NE = 312,
- PML_EQ = 313,
- PML_LE = 314,
- PML_GE = 315,
- PML_LT = 316,
- PML_GT = 317,
- PML_RSHIFT = 318,
- PML_LSHIFT = 319,
- PML_MINUS = 320,
- PML_PLUS = 321,
- PML_MODULO = 322,
- PML_DIVIDE = 323,
- PML_TIMES = 324,
- PML_DECR = 325,
- PML_INCR = 326,
- PML_COMPL = 327,
- PML_NEG = 328,
- PML_CMPND = 329,
- PML_DOT = 330
-};
-#endif
-
-
-#if ! defined PROMELA_STYPE && ! defined PROMELA_STYPE_IS_DECLARED
-typedef union PROMELA_STYPE {
- /* Line 387 of yacc.c */
-#line 39 "promela.ypp"
-
- uscxml::PromelaParserNode* node;
- char* value;
-
-
- /* Line 387 of yacc.c */
-#line 225 "promela.tab.cpp"
-} PROMELA_STYPE;
-# define PROMELA_STYPE_IS_TRIVIAL 1
-# define promela_stype PROMELA_STYPE /* obsolescent; will be withdrawn */
-# define PROMELA_STYPE_IS_DECLARED 1
-#endif
-
-#if ! defined PROMELA_LTYPE && ! defined PROMELA_LTYPE_IS_DECLARED
-typedef struct PROMELA_LTYPE {
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-} PROMELA_LTYPE;
-# define promela_ltype PROMELA_LTYPE /* obsolescent; will be withdrawn */
-# define PROMELA_LTYPE_IS_DECLARED 1
-# define PROMELA_LTYPE_IS_TRIVIAL 1
-#endif
-
-
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int promela_parse (void *YYPARSE_PARAM);
-#else
-int promela_parse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int promela_parse (uscxml::PromelaParser* ctx, void * scanner);
-#else
-int promela_parse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-#endif /* !YY_PROMELA_PROMELA_TAB_HPP_INCLUDED */
-
-/* Copy the second part of user declarations. */
-
-/* Line 390 of yacc.c */
-#line 265 "promela.tab.cpp"
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if (! defined __GNUC__ || __GNUC__ < 2 \
- || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
-# define __attribute__(Spec) /* empty */
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-
-
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
-int yyi;
-#endif
-{
- return yyi;
-}
-#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-/* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-/* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-# ifndef YYSTACK_ALLOC_MAXIMUM
-/* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL \
- && defined PROMELA_STYPE_IS_TRIVIAL && PROMELA_STYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc {
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
- YYLTYPE yyls_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
- + 2 * YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 32
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 285
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 82
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 21
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 81
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 143
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 330
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] = {
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 11, 12, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 13, 2, 14, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 15, 2, 16, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- 81
-};
-
-#if PROMELA_DEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] = {
- 0, 0, 3, 5, 7, 9, 11, 13, 18, 21,
- 22, 25, 29, 33, 37, 41, 45, 49, 53, 57,
- 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
- 101, 104, 107, 112, 114, 116, 118, 119, 121, 123,
- 125, 129, 133, 140, 143, 149, 151, 154, 158, 160,
- 164, 166, 170, 172, 176, 181, 183, 186, 190, 194,
- 198, 202, 206, 210, 212, 215, 218, 220, 223, 227,
- 229, 233, 236, 239, 245, 250, 255, 258, 260, 261,
- 264, 266
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] = {
- 83, 0, -1, 92, -1, 88, -1, 98, -1, 86,
- -1, 48, -1, 48, 13, 88, 14, -1, 85, 87,
- -1, -1, 81, 86, -1, 11, 88, 12, -1, 88,
- 72, 88, -1, 88, 71, 88, -1, 88, 75, 88,
- -1, 88, 74, 88, -1, 88, 73, 88, -1, 88,
- 60, 88, -1, 88, 61, 88, -1, 88, 62, 88,
- -1, 88, 68, 88, -1, 88, 67, 88, -1, 88,
- 66, 88, -1, 88, 65, 88, -1, 88, 64, 88,
- -1, 88, 63, 88, -1, 88, 58, 88, -1, 88,
- 59, 88, -1, 88, 70, 88, -1, 88, 69, 88,
- -1, 79, 88, -1, 71, 88, -1, 20, 11, 84,
- 12, -1, 84, -1, 45, -1, 21, -1, -1, 42,
- -1, 43, -1, 44, -1, 89, 46, 93, -1, 89,
- 49, 93, -1, 89, 46, 57, 15, 97, 16, -1,
- 89, 91, -1, 22, 48, 15, 92, 16, -1, 90,
- -1, 90, 31, -1, 90, 31, 92, -1, 94, -1,
- 94, 56, 93, -1, 95, -1, 95, 57, 88, -1,
- 48, -1, 48, 8, 45, -1, 48, 13, 96, 14,
- -1, 45, -1, 71, 96, -1, 11, 96, 12, -1,
- 96, 72, 96, -1, 96, 71, 96, -1, 96, 75,
- 96, -1, 96, 74, 96, -1, 96, 73, 96, -1,
- 48, -1, 97, 48, -1, 97, 56, -1, 99, -1,
- 99, 31, -1, 99, 31, 98, -1, 100, -1, 84,
- 57, 88, -1, 84, 77, -1, 84, 76, -1, 18,
- 11, 21, 101, 12, -1, 18, 11, 84, 12, -1,
- 18, 11, 45, 12, -1, 17, 88, -1, 88, -1,
- -1, 56, 102, -1, 88, -1, 88, 56, 102, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint8 yyrline[] = {
- 0, 85, 85, 89, 93, 99, 102, 103, 106, 121,
- 122, 132, 133, 134, 135, 136, 137, 138, 139, 140,
- 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
- 151, 152, 154, 155, 156, 157, 163, 164, 165, 166,
- 169, 170, 171, 172, 175, 178, 179, 180, 190, 191,
- 194, 195, 198, 199, 200, 203, 204, 205, 206, 207,
- 208, 209, 210, 213, 214, 223, 226, 227, 228, 231,
- 234, 235, 236, 237, 238, 239, 240, 241, 244, 245,
- 248, 249
-};
-#endif
-
-#if PROMELA_DEBUG || YYERROR_VERBOSE || 1
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] = {
- "$end", "error", "$undefined", "PML_VAR_ARRAY", "PML_VARLIST",
- "PML_DECL", "PML_DECLLIST", "PML_STMNT", "PML_COLON", "PML_EXPR",
- "PML_NAMELIST", "'('", "')'", "'['", "']'", "'{'", "'}'", "PML_ASSERT",
- "PML_PRINT", "PML_PRINTM", "PML_LEN", "PML_STRING", "PML_TYPEDEF",
- "PML_MTYPE", "PML_INLINE", "PML_RETURN", "PML_LABEL", "PML_OF",
- "PML_GOTO", "PML_BREAK", "PML_ELSE", "PML_SEMI", "PML_ARROW", "PML_IF",
- "PML_FI", "PML_DO", "PML_OD", "PML_FOR", "PML_SELECT", "PML_IN",
- "PML_SEP", "PML_DOTDOT", "PML_HIDDEN", "PML_SHOW", "PML_ISLOCAL",
- "PML_CONST", "PML_TYPE", "PML_XU", "PML_NAME", "PML_UNAME", "PML_PNAME",
- "PML_INAME", "PML_CLAIM", "PML_TRACE", "PML_INIT", "PML_LTL",
- "PML_COMMA", "PML_ASGN", "PML_AND", "PML_OR", "PML_BITAND", "PML_BITXOR",
- "PML_BITOR", "PML_NE", "PML_EQ", "PML_LE", "PML_GE", "PML_LT", "PML_GT",
- "PML_RSHIFT", "PML_LSHIFT", "PML_MINUS", "PML_PLUS", "PML_MODULO",
- "PML_DIVIDE", "PML_TIMES", "PML_DECR", "PML_INCR", "PML_COMPL",
- "PML_NEG", "PML_CMPND", "PML_DOT", "$accept", "program", "varref",
- "pfld", "cmpnd", "sfld", "expr", "vis", "one_decl", "utype", "decl_lst",
- "var_list", "ivar", "vardcl", "const_expr", "nlst", "stmnt_lst", "stmnt",
- "Stmnt", "prargs", "arg", YY_NULL
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] = {
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 40, 41, 91, 93, 123, 125, 266, 267, 268,
- 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
- 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
- 299, 300, 301, 302, 303, 304, 305, 306, 307, 308,
- 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
- 319, 320, 321, 322, 323, 324, 325, 326, 327, 328,
- 329, 330
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] = {
- 0, 82, 83, 83, 83, 84, 85, 85, 86, 87,
- 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 89, 89, 89, 89,
- 90, 90, 90, 90, 91, 92, 92, 92, 93, 93,
- 94, 94, 95, 95, 95, 96, 96, 96, 96, 96,
- 96, 96, 96, 97, 97, 97, 98, 98, 98, 99,
- 100, 100, 100, 100, 100, 100, 100, 100, 101, 101,
- 102, 102
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] = {
- 0, 2, 1, 1, 1, 1, 1, 4, 2, 0,
- 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 4, 1, 1, 1, 0, 1, 1, 1,
- 3, 3, 6, 2, 5, 1, 2, 3, 1, 3,
- 1, 3, 1, 3, 4, 1, 2, 3, 3, 3,
- 3, 3, 3, 1, 2, 2, 1, 2, 3, 1,
- 3, 2, 2, 5, 4, 4, 2, 1, 0, 2,
- 1, 3
-};
-
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] = {
- 36, 0, 0, 0, 0, 35, 37, 38, 39, 34,
- 6, 0, 0, 0, 33, 9, 5, 3, 0, 45,
- 2, 4, 66, 69, 33, 0, 76, 0, 0, 0,
- 31, 30, 1, 0, 72, 71, 0, 8, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 43,
- 36, 67, 11, 78, 0, 0, 0, 0, 70, 10,
- 26, 27, 17, 18, 19, 25, 24, 23, 22, 21,
- 20, 29, 28, 13, 12, 16, 15, 14, 0, 52,
- 0, 40, 48, 50, 41, 47, 77, 68, 0, 0,
- 75, 74, 32, 7, 36, 0, 0, 0, 0, 0,
- 80, 79, 73, 0, 53, 0, 55, 0, 0, 63,
- 0, 49, 51, 0, 44, 0, 56, 54, 0, 0,
- 0, 0, 0, 42, 64, 65, 81, 57, 59, 58,
- 62, 61, 60
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] = {
- -1, 13, 24, 15, 16, 37, 110, 18, 19, 59,
- 20, 91, 92, 93, 118, 120, 21, 22, 23, 99,
- 111
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -112
-static const yytype_int16 yypact[] = {
- 14, 53, 53, 3, 13, -112, -112, -112, -112, -112,
- 15, 53, 53, 26, 34, -51, -112, 138, 81, 5,
- -112, -112, 58, -112, -112, 75, 160, 169, 42, 53,
- -66, -112, -112, 53, -112, -112, 42, -112, 53, 53,
- 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
- 53, 53, 53, 53, 53, 53, 44, -35, 51, -112,
- 72, 49, -112, 46, 88, 96, 100, 93, 160, -112,
- 176, 176, 189, 189, 189, 200, 200, 207, 207, 207,
- 207, 120, 120, -66, -66, -112, -112, -112, 98, -3,
- 102, -112, 63, 74, -112, -112, 160, -112, 53, 113,
- -112, -112, -112, -112, 62, 126, -8, 167, 51, 53,
- 114, -112, -112, 267, -112, -8, -112, -8, 9, -112,
- 70, -112, 160, 53, -112, 4, 48, -112, -8, -8,
- -8, -8, -8, -112, -112, -112, -112, -112, 48, 48,
- -112, -112, -112
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] = {
- -112, -112, 68, -112, 180, -112, 0, -112, -112, -112,
- -33, -43, -112, -112, -111, -112, 223, -112, -112, -112,
- 162
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -78
-static const yytype_int16 yytable[] = {
- 17, 25, 26, 115, 125, 105, 126, 53, 54, 55,
- 106, 30, 31, 89, 27, 94, 137, 138, 139, 140,
- 141, 142, 90, 127, 28, 1, 32, 95, 29, 67,
- 36, 2, 3, 68, 4, 5, 60, 116, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
- 82, 83, 84, 85, 86, 87, 6, 7, 8, 9,
- 1, 96, 10, 117, 1, 121, 2, 3, 14, 4,
- 5, 113, -46, 4, 5, 128, 129, 130, 131, 132,
- 128, 129, 130, 131, 132, 11, 133, 62, -46, 61,
- 10, 33, 88, 12, 9, 65, 66, 10, 9, 89,
- 100, 10, 98, 56, 6, 7, 8, 103, 101, 122,
- 34, 35, 102, 104, 6, 7, 8, 107, 134, 108,
- 11, 130, 131, 132, 11, 112, 135, 57, 12, 14,
- 58, 109, 12, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, -77,
- 123, 114, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 63, 51, 52, 53, 54, 55, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 64, 119, 69, 10, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 49, 50, 51, 52,
- 53, 54, 55, 124, 97, 136
-};
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-112)))
-
-#define yytable_value_is_error(Yytable_value) \
- YYID (0)
-
-static const yytype_uint8 yycheck[] = {
- 0, 1, 2, 11, 115, 8, 117, 73, 74, 75,
- 13, 11, 12, 48, 11, 58, 12, 128, 129, 130,
- 131, 132, 57, 14, 11, 11, 0, 60, 13, 29,
- 81, 17, 18, 33, 20, 21, 31, 45, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 42, 43, 44, 45,
- 11, 61, 48, 71, 11, 108, 17, 18, 0, 20,
- 21, 104, 0, 20, 21, 71, 72, 73, 74, 75,
- 71, 72, 73, 74, 75, 71, 16, 12, 16, 31,
- 48, 57, 48, 79, 45, 27, 28, 48, 45, 48,
- 12, 48, 56, 22, 42, 43, 44, 14, 12, 109,
- 76, 77, 12, 15, 42, 43, 44, 15, 48, 56,
- 71, 73, 74, 75, 71, 12, 56, 46, 79, 61,
- 49, 57, 79, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 31,
- 56, 45, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 21, 71, 72, 73, 74, 75, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 45, 48, 36, 48, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, 75, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 69, 70, 71, 72,
- 73, 74, 75, 16, 61, 123
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] = {
- 0, 11, 17, 18, 20, 21, 42, 43, 44, 45,
- 48, 71, 79, 83, 84, 85, 86, 88, 89, 90,
- 92, 98, 99, 100, 84, 88, 88, 11, 11, 13,
- 88, 88, 0, 57, 76, 77, 81, 87, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 22, 46, 49, 91,
- 31, 31, 12, 21, 45, 84, 84, 88, 88, 86,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 48, 48,
- 57, 93, 94, 95, 93, 92, 88, 98, 56, 101,
- 12, 12, 12, 14, 15, 8, 13, 15, 56, 57,
- 88, 102, 12, 92, 45, 11, 45, 71, 96, 48,
- 97, 93, 88, 56, 16, 96, 96, 14, 71, 72,
- 73, 74, 75, 16, 48, 56, 102, 12, 96, 96,
- 96, 96, 96
-};
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
-/* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (&yylloc, ctx, scanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
-
-#ifndef YY_LOCATION_PRINT
-# if defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL
-
-/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
-
-__attribute__((__unused__))
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static unsigned
-yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
-#else
-static unsigned
-yy_location_print_ (yyo, yylocp)
-FILE *yyo;
-YYLTYPE const * const yylocp;
-#endif
-{
- unsigned res = 0;
- int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
- if (0 <= yylocp->first_line) {
- res += fprintf (yyo, "%d", yylocp->first_line);
- if (0 <= yylocp->first_column)
- res += fprintf (yyo, ".%d", yylocp->first_column);
- }
- if (0 <= yylocp->last_line) {
- if (yylocp->first_line < yylocp->last_line) {
- res += fprintf (yyo, "-%d", yylocp->last_line);
- if (0 <= end_col)
- res += fprintf (yyo, ".%d", end_col);
- } else if (0 <= end_col && yylocp->first_column < end_col)
- res += fprintf (yyo, "-%d", end_col);
- }
- return res;
-}
-
-# define YY_LOCATION_PRINT(File, Loc) \
- yy_location_print_ (File, &(Loc))
-
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, &yylloc, scanner)
-#endif
-
-/* Enable debugging if requested. */
-#if PROMELA_DEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, Location, ctx, scanner); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner)
-FILE *yyoutput;
-int yytype;
-YYSTYPE const * const yyvaluep;
-YYLTYPE const * const yylocationp;
-uscxml::PromelaParser* ctx;
-void * scanner;
-#endif
-{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- if (!yyvaluep)
- return;
- YYUSE (yylocationp);
- YYUSE (ctx);
- YYUSE (scanner);
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
-# endif
- YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner)
-FILE *yyoutput;
-int yytype;
-YYSTYPE const * const yyvaluep;
-YYLTYPE const * const yylocationp;
-uscxml::PromelaParser* ctx;
-void * scanner;
-#endif
-{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- YY_LOCATION_PRINT (yyoutput, *yylocationp);
- YYFPRINTF (yyoutput, ": ");
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
-yytype_int16 *yybottom;
-yytype_int16 *yytop;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++) {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, uscxml::PromelaParser* ctx, void * scanner)
-#else
-static void
-yy_reduce_print (yyvsp, yylsp, yyrule, ctx, scanner)
-YYSTYPE *yyvsp;
-YYLTYPE *yylsp;
-int yyrule;
-uscxml::PromelaParser* ctx;
-void * scanner;
-#endif
-{
- int yynrhs = yyr2[yyrule];
- int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++) {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, scanner);
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, yylsp, Rule, ctx, scanner); \
-} while (YYID (0))
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !PROMELA_DEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !PROMELA_DEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
-const char *yystr;
-#endif
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
-char *yydest;
-const char *yysrc;
-#endif
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr) {
- if (*yystr == '"') {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp) {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
-do_not_strip_quotes:
- ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken) {
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULL;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY) {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn)) {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn])) {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
- }
-
- switch (yycount) {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
-
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
-
- if (*yymsg_alloc < yysize) {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- } else {
- yyp++;
- yyformat++;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, uscxml::PromelaParser* ctx, void * scanner)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, yylocationp, ctx, scanner)
-const char *yymsg;
-int yytype;
-YYSTYPE *yyvaluep;
-YYLTYPE *yylocationp;
-uscxml::PromelaParser* ctx;
-void * scanner;
-#endif
-{
- YYUSE (yyvaluep);
- YYUSE (yylocationp);
- YYUSE (ctx);
- YYUSE (scanner);
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- YYUSE (yytype);
-}
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (uscxml::PromelaParser* ctx, void * scanner)
-#else
-int
-yyparse (ctx, scanner)
-uscxml::PromelaParser* ctx;
-void * scanner;
-#endif
-#endif
-{
- /* The lookahead symbol. */
- int yychar;
-
-
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
- /* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
- /* Default value used for initialization, for pacifying older GCCs
- or non-GCC compilers. */
- static YYSTYPE yyval_default;
-# define YY_INITIAL_VALUE(Value) = Value
-#endif
- static YYLTYPE yyloc_default
-# if defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL
- = { 1, 1, 1, 1 }
-# endif
- ;
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
- /* The semantic value of the lookahead symbol. */
- YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
-
- /* Location data for the lookahead symbol. */
- YYLTYPE yylloc = yyloc_default;
-
-
- /* Number of syntax errors so far. */
- int yynerrs;
-
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
- `yyls': related to locations.
-
- Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls;
- YYLTYPE *yylsp;
-
- /* The locations where the error started and ended. */
- YYLTYPE yyerror_range[3];
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
- YYLTYPE yyloc;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yylsp = yyls = yylsa;
- yystacksize = YYINITDEPTH;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
- yylsp[0] = yylloc;
- goto yysetstate;
-
- /*------------------------------------------------------------.
- | yynewstate -- Push a new state, which is found in yystate. |
- `------------------------------------------------------------*/
-yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
-yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp) {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
- YYLTYPE *yyls1 = yyls;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yyls1, yysize * sizeof (*yylsp),
- &yystacksize);
-
- yyls = yyls1;
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
- YYSTACK_RELOCATE (yyls_alloc, yyls);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
- yylsp = yyls + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
- /*-----------.
- | yybackup. |
- `-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY) {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF) {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- } else {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0) {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
- *++yylsp = yylloc;
- goto yynewstate;
-
-
- /*-----------------------------------------------------------.
- | yydefault -- do the default action for the current state. |
- `-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
- /*-----------------------------.
- | yyreduce -- Do a reduction. |
- `-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
- /* Default location. */
- YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
- YY_REDUCE_PRINT (yyn);
- switch (yyn) {
- case 2:
- /* Line 1787 of yacc.c */
-#line 85 "promela.ypp"
- {
- ctx->ast = (yyvsp[(1) - (1)].node);
- ctx->type = PromelaParser::PROMELA_DECL;
- }
- break;
-
- case 3:
- /* Line 1787 of yacc.c */
-#line 89 "promela.ypp"
- {
- ctx->ast = (yyvsp[(1) - (1)].node);
- ctx->type = PromelaParser::PROMELA_EXPR;
- }
- break;
-
- case 4:
- /* Line 1787 of yacc.c */
-#line 93 "promela.ypp"
- {
- ctx->ast = (yyvsp[(1) - (1)].node);
- ctx->type = PromelaParser::PROMELA_STMNT;
- }
- break;
-
- case 5:
- /* Line 1787 of yacc.c */
-#line 99 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 6:
- /* Line 1787 of yacc.c */
-#line 102 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 7:
- /* Line 1787 of yacc.c */
-#line 103 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (4)])), (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node));
- free((yyvsp[(1) - (4)].value));
- }
- break;
-
- case 8:
- /* Line 1787 of yacc.c */
-#line 107 "promela.ypp"
- {
- if ((yyvsp[(2) - (2)].node) != NULL) {
- if ((yyvsp[(2) - (2)].node)->type == PML_CMPND) {
- (yyval.node) = ctx->node(PML_CMPND, 1, (yyvsp[(1) - (2)].node));
- (yyval.node)->merge((yyvsp[(2) - (2)].node));
- delete (yyvsp[(2) - (2)].node);
- } else {
- (yyval.node) = ctx->node(PML_CMPND, 2, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node));
- }
- } else {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- }
- break;
-
- case 9:
- /* Line 1787 of yacc.c */
-#line 121 "promela.ypp"
- {
- (yyval.node) = NULL;
- }
- break;
-
- case 10:
- /* Line 1787 of yacc.c */
-#line 122 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (2)].node);
- }
- break;
-
- case 11:
- /* Line 1787 of yacc.c */
-#line 132 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (3)].node);
- }
- break;
-
- case 12:
- /* Line 1787 of yacc.c */
-#line 133 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 13:
- /* Line 1787 of yacc.c */
-#line 134 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 14:
- /* Line 1787 of yacc.c */
-#line 135 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 15:
- /* Line 1787 of yacc.c */
-#line 136 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 16:
- /* Line 1787 of yacc.c */
-#line 137 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 17:
- /* Line 1787 of yacc.c */
-#line 138 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_BITAND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 18:
- /* Line 1787 of yacc.c */
-#line 139 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_BITXOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 19:
- /* Line 1787 of yacc.c */
-#line 140 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_BITOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 20:
- /* Line 1787 of yacc.c */
-#line 141 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_GT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 21:
- /* Line 1787 of yacc.c */
-#line 142 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 22:
- /* Line 1787 of yacc.c */
-#line 143 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_GE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 23:
- /* Line 1787 of yacc.c */
-#line 144 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 24:
- /* Line 1787 of yacc.c */
-#line 145 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_EQ, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 25:
- /* Line 1787 of yacc.c */
-#line 146 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_NE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 26:
- /* Line 1787 of yacc.c */
-#line 147 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_AND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 27:
- /* Line 1787 of yacc.c */
-#line 148 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_OR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 28:
- /* Line 1787 of yacc.c */
-#line 149 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 29:
- /* Line 1787 of yacc.c */
-#line 150 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_RSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 30:
- /* Line 1787 of yacc.c */
-#line 151 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_NEG, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 31:
- /* Line 1787 of yacc.c */
-#line 152 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 32:
- /* Line 1787 of yacc.c */
-#line 154 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LEN, 1, (yyvsp[(3) - (4)].node));
- }
- break;
-
- case 33:
- /* Line 1787 of yacc.c */
-#line 155 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 34:
- /* Line 1787 of yacc.c */
-#line 156 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 35:
- /* Line 1787 of yacc.c */
-#line 157 "promela.ypp"
- {
- /* Non standard promela for string literals */
- (yyval.node) = ctx->value(PML_STRING, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 36:
- /* Line 1787 of yacc.c */
-#line 163 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_SHOW, 0);
- }
- break;
-
- case 37:
- /* Line 1787 of yacc.c */
-#line 164 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_HIDDEN, 0);
- }
- break;
-
- case 38:
- /* Line 1787 of yacc.c */
-#line 165 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_SHOW, 0);
- }
- break;
-
- case 39:
- /* Line 1787 of yacc.c */
-#line 166 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_ISLOCAL, 0);
- }
- break;
-
- case 40:
- /* Line 1787 of yacc.c */
-#line 169 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (3)].node), ctx->value(PML_TYPE, (void*)&((yylsp[(2) - (3)])), (yyvsp[(2) - (3)].value)), (yyvsp[(3) - (3)].node));
- free((yyvsp[(2) - (3)].value));
- }
- break;
-
- case 41:
- /* Line 1787 of yacc.c */
-#line 170 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_UNAME, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 42:
- /* Line 1787 of yacc.c */
-#line 171 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (6)].node), ctx->value(PML_TYPE, (void*)&((yylsp[(2) - (6)])), (yyvsp[(2) - (6)].value)), (yyvsp[(5) - (6)].node));
- free((yyvsp[(2) - (6)].value));
- }
- break;
-
- case 43:
- /* Line 1787 of yacc.c */
-#line 172 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (2)].node);
- }
- break;
-
- case 44:
- /* Line 1787 of yacc.c */
-#line 175 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (void*)&((yylsp[(2) - (5)])), (yyvsp[(2) - (5)].value)), (yyvsp[(4) - (5)].node));
- }
- break;
-
- case 45:
- /* Line 1787 of yacc.c */
-#line 178 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 46:
- /* Line 1787 of yacc.c */
-#line 179 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- break;
-
- case 47:
- /* Line 1787 of yacc.c */
-#line 180 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DECLLIST, 1, (yyvsp[(1) - (3)].node));
- if((yyvsp[(3) - (3)].node)->type == PML_DECLLIST) {
- (yyval.node)->merge((yyvsp[(3) - (3)].node));
- delete (yyvsp[(3) - (3)].node);
- } else {
- (yyval.node)->push((yyvsp[(3) - (3)].node));
- }
- }
- break;
-
- case 48:
- /* Line 1787 of yacc.c */
-#line 190 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (1)].node));
- }
- break;
-
- case 49:
- /* Line 1787 of yacc.c */
-#line 191 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (3)].node));
- (yyval.node)->merge((yyvsp[(3) - (3)].node));
- delete (yyvsp[(3) - (3)].node);
- }
- break;
-
- case 50:
- /* Line 1787 of yacc.c */
-#line 194 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 51:
- /* Line 1787 of yacc.c */
-#line 195 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 52:
- /* Line 1787 of yacc.c */
-#line 198 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 53:
- /* Line 1787 of yacc.c */
-#line 199 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (3)])), (yyvsp[(1) - (3)].value)), ctx->value(PML_CONST, (void*)&((yylsp[(3) - (3)])), (yyvsp[(3) - (3)].value)));
- free((yyvsp[(1) - (3)].value));
- free((yyvsp[(3) - (3)].value));
- }
- break;
-
- case 54:
- /* Line 1787 of yacc.c */
-#line 200 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (4)])), (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node));
- free((yyvsp[(1) - (4)].value));
- }
- break;
-
- case 55:
- /* Line 1787 of yacc.c */
-#line 203 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 56:
- /* Line 1787 of yacc.c */
-#line 204 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 57:
- /* Line 1787 of yacc.c */
-#line 205 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (3)].node);
- }
- break;
-
- case 58:
- /* Line 1787 of yacc.c */
-#line 206 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 59:
- /* Line 1787 of yacc.c */
-#line 207 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 60:
- /* Line 1787 of yacc.c */
-#line 208 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 61:
- /* Line 1787 of yacc.c */
-#line 209 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 62:
- /* Line 1787 of yacc.c */
-#line 210 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 63:
- /* Line 1787 of yacc.c */
-#line 213 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 64:
- /* Line 1787 of yacc.c */
-#line 214 "promela.ypp"
- {
- if ((yyvsp[(1) - (2)].node)->type == PML_NAME) {
- (yyval.node) = ctx->node(PML_NAMELIST, 1, (yyvsp[(1) - (2)].node));
- (yyval.node)->push(ctx->value(PML_NAME, (void*)&((yylsp[(2) - (2)])), (yyvsp[(2) - (2)].value)));
- } else {
- (yyvsp[(1) - (2)].node)->push(ctx->value(PML_NAME, (void*)&((yylsp[(2) - (2)])), (yyvsp[(2) - (2)].value)));
- }
- free((yyvsp[(2) - (2)].value));
- }
- break;
-
- case 65:
- /* Line 1787 of yacc.c */
-#line 223 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- break;
-
- case 66:
- /* Line 1787 of yacc.c */
-#line 226 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 67:
- /* Line 1787 of yacc.c */
-#line 227 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- break;
-
- case 68:
- /* Line 1787 of yacc.c */
-#line 228 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_STMNT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 69:
- /* Line 1787 of yacc.c */
-#line 231 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 70:
- /* Line 1787 of yacc.c */
-#line 234 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
- case 71:
- /* Line 1787 of yacc.c */
-#line 235 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_INCR, 1, (yyvsp[(1) - (2)].node));
- }
- break;
-
- case 72:
- /* Line 1787 of yacc.c */
-#line 236 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DECR, 1, (yyvsp[(1) - (2)].node));
- }
- break;
-
- case 73:
- /* Line 1787 of yacc.c */
-#line 237 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (void*)&((yylsp[(3) - (5)])), (yyvsp[(3) - (5)].value)), (yyvsp[(4) - (5)].node));
- free((yyvsp[(3) - (5)].value));
- }
- break;
-
- case 74:
- /* Line 1787 of yacc.c */
-#line 238 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PRINT, 1, (yyvsp[(3) - (4)].node));
- }
- break;
-
- case 75:
- /* Line 1787 of yacc.c */
-#line 239 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (void*)&((yylsp[(3) - (4)])), (yyvsp[(3) - (4)].value)));
- free((yyvsp[(3) - (4)].value));
- }
- break;
-
- case 76:
- /* Line 1787 of yacc.c */
-#line 240 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_ASSERT, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 77:
- /* Line 1787 of yacc.c */
-#line 241 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 78:
- /* Line 1787 of yacc.c */
-#line 244 "promela.ypp"
- {
- (yyval.node) = ctx->value(0, NULL, "");
- }
- break;
-
- case 79:
- /* Line 1787 of yacc.c */
-#line 245 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (2)].node);
- }
- break;
-
- case 80:
- /* Line 1787 of yacc.c */
-#line 248 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 81:
- /* Line 1787 of yacc.c */
-#line 249 "promela.ypp"
- {
- (yyval.node) = ctx->node(0, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
-
- /* Line 1787 of yacc.c */
-#line 2285 "promela.tab.cpp"
- default:
- break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
- *++yylsp = yyloc;
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
- /*------------------------------------.
- | yyerrlab -- here on detecting error |
- `------------------------------------*/
-yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus) {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (&yylloc, ctx, scanner, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1) {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg) {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- } else {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (&yylloc, ctx, scanner, yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
- }
-
- yyerror_range[1] = yylloc;
-
- if (yyerrstatus == 3) {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF) {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- } else {
- yydestruct ("Error: discarding",
- yytoken, &yylval, &yylloc, ctx, scanner);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
- /*---------------------------------------------------.
- | yyerrorlab -- error raised explicitly by YYERROR. |
- `---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- yyerror_range[1] = yylsp[1-yylen];
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
- /*-------------------------------------------------------------.
- | yyerrlab1 -- common code for both syntax error and YYERROR. |
- `-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;) {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn)) {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- yyerror_range[1] = *yylsp;
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, yylsp, ctx, scanner);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
- yyerror_range[2] = yylloc;
- /* Using YYLLOC is tempting, but would change the location of
- the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
- *++yylsp = yyloc;
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
- /*-------------------------------------.
- | yyacceptlab -- YYACCEPT comes here. |
- `-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
- /*-----------------------------------.
- | yyabortlab -- YYABORT comes here. |
- `-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#if !defined yyoverflow || YYERROR_VERBOSE
- /*-------------------------------------------------.
- | yyexhaustedlab -- memory exhaustion comes here. |
- `-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (&yylloc, ctx, scanner, YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEMPTY) {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc, ctx, scanner);
- }
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss) {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, yylsp, ctx, scanner);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
-}
-
-
-/* Line 2050 of yacc.c */
-#line 253 "promela.ypp"
-
-
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp
deleted file mode 100644
index a48031a..0000000
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
-
-/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-#ifndef YY_PROMELA_PROMELA_TAB_HPP_INCLUDED
-# define YY_PROMELA_PROMELA_TAB_HPP_INCLUDED
-/* Enabling traces. */
-#ifndef PROMELA_DEBUG
-# if defined YYDEBUG
-# if YYDEBUG
-# define PROMELA_DEBUG 1
-# else
-# define PROMELA_DEBUG 0
-# endif
-# else /* ! defined YYDEBUG */
-# define PROMELA_DEBUG 1
-# endif /* ! defined YYDEBUG */
-#endif /* ! defined PROMELA_DEBUG */
-#if PROMELA_DEBUG
-extern int promela_debug;
-#endif
-
-/* Tokens. */
-#ifndef PROMELA_TOKENTYPE
-# define PROMELA_TOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum promela_tokentype {
- PML_VAR_ARRAY = 258,
- PML_VARLIST = 259,
- PML_DECL = 260,
- PML_DECLLIST = 261,
- PML_STMNT = 262,
- PML_COLON = 263,
- PML_EXPR = 264,
- PML_NAMELIST = 265,
- PML_ASSERT = 266,
- PML_PRINT = 267,
- PML_PRINTM = 268,
- PML_LEN = 269,
- PML_STRING = 270,
- PML_TYPEDEF = 271,
- PML_MTYPE = 272,
- PML_INLINE = 273,
- PML_RETURN = 274,
- PML_LABEL = 275,
- PML_OF = 276,
- PML_GOTO = 277,
- PML_BREAK = 278,
- PML_ELSE = 279,
- PML_SEMI = 280,
- PML_ARROW = 281,
- PML_IF = 282,
- PML_FI = 283,
- PML_DO = 284,
- PML_OD = 285,
- PML_FOR = 286,
- PML_SELECT = 287,
- PML_IN = 288,
- PML_SEP = 289,
- PML_DOTDOT = 290,
- PML_HIDDEN = 291,
- PML_SHOW = 292,
- PML_ISLOCAL = 293,
- PML_CONST = 294,
- PML_TYPE = 295,
- PML_XU = 296,
- PML_NAME = 297,
- PML_UNAME = 298,
- PML_PNAME = 299,
- PML_INAME = 300,
- PML_CLAIM = 301,
- PML_TRACE = 302,
- PML_INIT = 303,
- PML_LTL = 304,
- PML_COMMA = 305,
- PML_ASGN = 306,
- PML_AND = 307,
- PML_OR = 308,
- PML_BITAND = 309,
- PML_BITXOR = 310,
- PML_BITOR = 311,
- PML_NE = 312,
- PML_EQ = 313,
- PML_LE = 314,
- PML_GE = 315,
- PML_LT = 316,
- PML_GT = 317,
- PML_RSHIFT = 318,
- PML_LSHIFT = 319,
- PML_MINUS = 320,
- PML_PLUS = 321,
- PML_MODULO = 322,
- PML_DIVIDE = 323,
- PML_TIMES = 324,
- PML_DECR = 325,
- PML_INCR = 326,
- PML_COMPL = 327,
- PML_NEG = 328,
- PML_CMPND = 329,
- PML_DOT = 330
- };
-#endif
-
-
-#if ! defined PROMELA_STYPE && ! defined PROMELA_STYPE_IS_DECLARED
-typedef union PROMELA_STYPE
-{
-/* Line 2053 of yacc.c */
-#line 39 "promela.ypp"
-
- uscxml::PromelaParserNode* node;
- char* value;
-
-
-/* Line 2053 of yacc.c */
-#line 146 "promela.tab.hpp"
-} PROMELA_STYPE;
-# define PROMELA_STYPE_IS_TRIVIAL 1
-# define promela_stype PROMELA_STYPE /* obsolescent; will be withdrawn */
-# define PROMELA_STYPE_IS_DECLARED 1
-#endif
-
-#if ! defined PROMELA_LTYPE && ! defined PROMELA_LTYPE_IS_DECLARED
-typedef struct PROMELA_LTYPE
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-} PROMELA_LTYPE;
-# define promela_ltype PROMELA_LTYPE /* obsolescent; will be withdrawn */
-# define PROMELA_LTYPE_IS_DECLARED 1
-# define PROMELA_LTYPE_IS_TRIVIAL 1
-#endif
-
-
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int promela_parse (void *YYPARSE_PARAM);
-#else
-int promela_parse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int promela_parse (uscxml::PromelaParser* ctx, void * scanner);
-#else
-int promela_parse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-#endif /* !YY_PROMELA_PROMELA_TAB_HPP_INCLUDED */
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp
deleted file mode 100644
index d76b24a..0000000
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp
+++ /dev/null
@@ -1,254 +0,0 @@
-/** Subset extracted from spin.y by Stefan Radomski 2014 */
-
-/***** spin: spin.y *****/
-
-/* Copyright (c) 1989-2003 by Lucent Technologies, Bell Laboratories. */
-/* All Rights Reserved. This software is for educational purposes only. */
-/* No guarantee whatsoever is expressed or implied by the distribution of */
-/* this code. Permission is given to distribute this code provided that */
-/* this introductory message is not removed and no monies are exchanged. */
-/* Software written by Gerard J. Holzmann. For tool documentation see: */
-/* http://spinroot.com/ */
-/* Send all bug-reports and/or questions to: bugs@spinroot.com */
-
-%{
-#include "../PromelaParser.h"
-#include "promela.tab.hpp"
-#include <sys/types.h>
-#include <stdarg.h>
-
-#define YYMAXDEPTH 20000 // default is 10000
-#define YYDEBUG 1
-#define YYERROR_VERBOSE 1
-
-extern int promela_lex (PROMELA_STYPE* yylval_param, PROMELA_LTYPE* yylloc_param, void* yyscanner);
-
-using namespace uscxml;
-%}
-
-%pure-parser
-%debug
-%locations
-%file-prefix "promela"
-%parse-param { uscxml::PromelaParser* ctx }
-%lex-param {void * scanner}
-%parse-param {void * scanner}
-%define api.prefix promela_
-%defines
-
-%union {
- uscxml::PromelaParserNode* node;
- char* value;
-}
-
-%error-verbose
-
-/* %type <node> expr_lst */
-%type <node> expr pfld sfld varref decl_lst stmnt_lst vardcl ivar var_list one_decl prargs utype cmpnd
-%type <node> stmnt Stmnt const_expr nlst vis arg
-
-%token PML_VAR_ARRAY PML_VARLIST PML_DECL PML_DECLLIST PML_STMNT PML_COLON PML_EXPR PML_NAMELIST
-
-%token '(' ')'
-%token '[' ']'
-%token '{' '}'
-%token PML_ASSERT PML_PRINT PML_PRINTM
-%token <value> PML_LEN PML_STRING
-%token PML_TYPEDEF PML_MTYPE PML_INLINE PML_RETURN PML_LABEL PML_OF
-%token PML_GOTO PML_BREAK PML_ELSE PML_SEMI PML_ARROW
-%token PML_IF PML_FI PML_DO PML_OD PML_FOR PML_SELECT PML_IN PML_SEP PML_DOTDOT
-%token PML_HIDDEN PML_SHOW PML_ISLOCAL
-%token <value> PML_CONST PML_TYPE PML_XU /* val */
-%token <value> PML_NAME PML_UNAME PML_PNAME PML_INAME /* sym */
-%token PML_CLAIM PML_TRACE PML_INIT PML_LTL /* sym */
-%token PML_COMMA
-
-%right PML_ASGN
-%left PML_OR PML_AND
-%left PML_BITOR PML_BITXOR PML_BITAND
-%left PML_EQ PML_NE
-%left PML_GT PML_LT PML_GE PML_LE
-%left PML_LSHIFT PML_RSHIFT
-%left PML_PLUS PML_MINUS
-%left PML_TIMES PML_DIVIDE PML_MODULO
-%left PML_INCR PML_DECR
-%left PML_COMPL
-%right PML_NEG
-%left PML_DOT PML_CMPND
-
-%%
-
-
-/** PROMELA Grammar Rules **/
-
-program :
- decl_lst {
- ctx->ast = $1;
- ctx->type = PromelaParser::PROMELA_DECL;
- }
- | expr {
- ctx->ast = $1;
- ctx->type = PromelaParser::PROMELA_EXPR;
- }
- | stmnt_lst {
- ctx->ast = $1;
- ctx->type = PromelaParser::PROMELA_STMNT;
- }
- ;
-
-varref : cmpnd { $$ = $1; }
- ;
-
-pfld : PML_NAME { $$ = ctx->value(PML_NAME, (void*)&(@1), $1); free($1); }
- | PML_NAME '[' expr ']' { $$ = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&(@1), $1), $3); free($1); }
- ;
-
-cmpnd : pfld
- sfld {
- if ($2 != NULL) {
- if ($2->type == PML_CMPND) {
- $$ = ctx->node(PML_CMPND, 1, $1);
- $$->merge($2); delete $2;
- } else {
- $$ = ctx->node(PML_CMPND, 2, $1, $2);
- }
- } else {
- $$ = $1;
- }
- }
- ;
-
-sfld : /* empty */ { $$ = NULL; }
- | PML_DOT cmpnd %prec PML_DOT { $$ = $2; }
- ;
-
-/*
-expr_lst: expr { $$ = ctx->node(PML_EXPR, 1, $1); }
- | expr PML_SEMI { $$ = ctx->node(PML_EXPR, 1, $1); }
- | expr PML_SEMI expr_lst { $$ = ctx->node(PML_EXPR, 2, $1, $3); }
- ;
-*/
-
-expr : '(' expr ')' { $$ = $2; }
- | expr PML_PLUS expr { $$ = ctx->node(PML_PLUS, 2, $1, $3); }
- | expr PML_MINUS expr { $$ = ctx->node(PML_MINUS, 2, $1, $3); }
- | expr PML_TIMES expr { $$ = ctx->node(PML_TIMES, 2, $1, $3); }
- | expr PML_DIVIDE expr { $$ = ctx->node(PML_DIVIDE, 2, $1, $3); }
- | expr PML_MODULO expr { $$ = ctx->node(PML_MODULO, 2, $1, $3); }
- | expr PML_BITAND expr { $$ = ctx->node(PML_BITAND, 2, $1, $3); }
- | expr PML_BITXOR expr { $$ = ctx->node(PML_BITXOR, 2, $1, $3); }
- | expr PML_BITOR expr { $$ = ctx->node(PML_BITOR, 2, $1, $3); }
- | expr PML_GT expr { $$ = ctx->node(PML_GT, 2, $1, $3); }
- | expr PML_LT expr { $$ = ctx->node(PML_LT, 2, $1, $3); }
- | expr PML_GE expr { $$ = ctx->node(PML_GE, 2, $1, $3); }
- | expr PML_LE expr { $$ = ctx->node(PML_LE, 2, $1, $3); }
- | expr PML_EQ expr { $$ = ctx->node(PML_EQ, 2, $1, $3); }
- | expr PML_NE expr { $$ = ctx->node(PML_NE, 2, $1, $3); }
- | expr PML_AND expr { $$ = ctx->node(PML_AND, 2, $1, $3); }
- | expr PML_OR expr { $$ = ctx->node(PML_OR, 2, $1, $3); }
- | expr PML_LSHIFT expr { $$ = ctx->node(PML_LSHIFT, 2, $1, $3); }
- | expr PML_RSHIFT expr { $$ = ctx->node(PML_RSHIFT, 2, $1, $3); }
- | PML_NEG expr { $$ = ctx->node(PML_NEG, 1, $2); }
- | PML_MINUS expr %prec PML_MINUS { $$ = ctx->node(PML_MINUS, 1, $2); }
-
- | PML_LEN '(' varref ')' { $$ = ctx->node(PML_LEN, 1, $3); }
- | varref { $$ = $1; }
- | PML_CONST { $$ = ctx->value(PML_CONST, (void*)&(@1), $1); free($1); }
- | PML_STRING {
- /* Non standard promela for string literals */
- $$ = ctx->value(PML_STRING, (void*)&(@1), $1); free($1); }
- ;
-
-
-vis : /* empty */ { $$ = ctx->node(PML_SHOW, 0); }
- | PML_HIDDEN { $$ = ctx->node(PML_HIDDEN, 0); }
- | PML_SHOW { $$ = ctx->node(PML_SHOW, 0); }
- | PML_ISLOCAL { $$ = ctx->node(PML_ISLOCAL, 0); }
- ;
-
-one_decl: vis PML_TYPE var_list { $$ = ctx->node(PML_DECL, 3, $1, ctx->value(PML_TYPE, (void*)&(@2), $2), $3); free($2); }
- | vis PML_UNAME var_list { $$ = ctx->node(PML_UNAME, 2, $1, $3); }
- | vis PML_TYPE PML_ASGN '{' nlst '}' { $$ = ctx->node(PML_DECL, 3, $1, ctx->value(PML_TYPE, (void*)&(@2), $2), $5); free($2); }
- | vis utype { $$ = $2; }
- ;
-
-utype : PML_TYPEDEF PML_NAME '{' decl_lst '}' { $$ = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (void*)&(@2), $2), $4); }
- ;
-
-decl_lst: one_decl { $$ = $1; }
- | one_decl PML_SEMI { $$ = $1; }
- | one_decl PML_SEMI decl_lst {
- $$ = ctx->node(PML_DECLLIST, 1, $1);
- if($3->type == PML_DECLLIST) {
- $$->merge($3); delete $3;
- } else {
- $$->push($3);
- }
- }
- ;
-
-var_list: ivar { $$ = ctx->node(PML_VARLIST, 1, $1); }
- | ivar PML_COMMA var_list { $$ = ctx->node(PML_VARLIST, 1, $1); $$->merge($3); delete $3; }
- ;
-
-ivar : vardcl { $$ = $1; }
- | vardcl PML_ASGN expr { $$ = ctx->node(PML_ASGN, 2, $1, $3); }
- ;
-
-vardcl : PML_NAME { $$ = ctx->value(PML_NAME, (void*)&(@1), $1); free($1); }
- | PML_NAME PML_COLON PML_CONST { $$ = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (void*)&(@1), $1), ctx->value(PML_CONST, (void*)&(@3), $3)); free($1); free($3); }
- | PML_NAME '[' const_expr ']' { $$ = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&(@1), $1), $3); free($1); }
- ;
-
-const_expr: PML_CONST { $$ = ctx->value(PML_CONST, (void*)&(@1), $1); free($1); }
- | PML_MINUS const_expr %prec PML_MINUS { $$ = ctx->node(PML_MINUS, 1, $2); }
- | '(' const_expr ')' { $$ = $2; }
- | const_expr PML_PLUS const_expr { $$ = ctx->node(PML_PLUS, 2, $1, $3); }
- | const_expr PML_MINUS const_expr { $$ = ctx->node(PML_MINUS, 2, $1, $3); }
- | const_expr PML_TIMES const_expr { $$ = ctx->node(PML_TIMES, 2, $1, $3); }
- | const_expr PML_DIVIDE const_expr { $$ = ctx->node(PML_DIVIDE, 2, $1, $3); }
- | const_expr PML_MODULO const_expr { $$ = ctx->node(PML_MODULO, 2, $1, $3); }
- ;
-
-nlst : PML_NAME { $$ = ctx->value(PML_NAME, (void*)&(@1), $1); free($1); }
- | nlst PML_NAME {
- if ($1->type == PML_NAME) {
- $$ = ctx->node(PML_NAMELIST, 1, $1);
- $$->push(ctx->value(PML_NAME, (void*)&(@2), $2));
- } else {
- $1->push(ctx->value(PML_NAME, (void*)&(@2), $2));
- }
- free($2);
- }
- | nlst PML_COMMA { $$ = $1; }
- ;
-
-stmnt_lst: stmnt { $$ = $1; }
- | stmnt PML_SEMI { $$ = $1; }
- | stmnt PML_SEMI stmnt_lst { $$ = ctx->node(PML_STMNT, 2, $1, $3); }
- ;
-
-stmnt : Stmnt { $$ = $1; }
- ;
-
-Stmnt : varref PML_ASGN expr { $$ = ctx->node(PML_ASGN, 2, $1, $3); }
- | varref PML_INCR { $$ = ctx->node(PML_INCR, 1, $1); }
- | varref PML_DECR { $$ = ctx->node(PML_DECR, 1, $1); }
- | PML_PRINT '(' PML_STRING prargs ')' { $$ = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (void*)&(@3), $3), $4); free($3); }
- | PML_PRINT '(' varref ')' { $$ = ctx->node(PML_PRINT, 1, $3); }
- | PML_PRINT '(' PML_CONST ')' { $$ = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (void*)&(@3), $3)); free($3); }
- | PML_ASSERT expr { $$ = ctx->node(PML_ASSERT, 1, $2); }
- | expr { $$ = $1; }
- ;
-
-prargs : /* empty */ { $$ = ctx->value(0, NULL, ""); }
- | PML_COMMA arg { $$ = $2; }
- ;
-
-arg : expr { $$ = $1; }
- | expr PML_COMMA arg { $$ = ctx->node(0, 2, $1, $3); }
- ;
-
-
-%%
-
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
deleted file mode 100644
index 282e8c6..0000000
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
+++ /dev/null
@@ -1,876 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @author 2013 Enrico Papi (enrico.papi@ajile.it)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/Common.h"
-#include "XPathDataModel.h"
-
-#include "uscxml/Message.h"
-#include "uscxml/util/String.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-#include <boost/algorithm/string.hpp>
-
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-//#include <SAX/helpers/CatchErrorHandler.hpp>
-//#include <DOM/Events/EventTarget.hpp>
-//#include <DOM/Events/EventListener.hpp>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new XPathDataModelProvider() );
- return true;
-}
-#endif
-
-XPathDataModel::XPathDataModel() {
-}
-
-boost::shared_ptr<DataModelImpl> XPathDataModel::create(InterpreterInfo* interpreter) {
- boost::shared_ptr<XPathDataModel> dm = boost::shared_ptr<XPathDataModel>(new XPathDataModel());
- dm->_interpreter = interpreter;
-
-// dm->_xpath->setVariableCompileTimeResolver(_varCTResolver);
-// dm->_xpath->setNamespaceContext(interpreter->getNSContext());
-
- dm->_funcResolver.setInterpreter(interpreter);
- dm->_xpath.setNamespaceContext(*interpreter->getNameSpaceInfo().getNSContext());
- dm->_xpath.setFunctionResolver(dm->_funcResolver);
- dm->_xpath.setVariableResolver(dm->_varResolver);
-
- dm->_domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- dm->_doc = dm->_domFactory.createDocument("http://www.w3.org/2005/07/scxml", "", 0);
- dm->_datamodel = dm->_doc.createElement("datamodel");
- dm->_doc.appendChild(dm->_datamodel);
-
- Element<std::string> ioProcElem = dm->_doc.createElement("data");
- ioProcElem.setAttribute("id", "_ioprocessors");
- std::map<std::string, IOProcessor>::const_iterator ioProcIter = interpreter->getIOProcessors().begin();
- while(ioProcIter != interpreter->getIOProcessors().end()) {
- Element<std::string> ioProc = dm->_doc.createElement("processor");
- ioProc.setAttribute("name", ioProcIter->first);
-
- Data ioProcData = ioProcIter->second.getDataModelVariables();
- Element<std::string> ioProcLoc = dm->_doc.createElement("location");
- Text<std::string> ioProcLocText = dm->_doc.createTextNode(ioProcData.compound["location"].atom);
- ioProcLoc.appendChild(ioProcLocText);
- ioProc.appendChild(ioProcLoc);
- ioProcElem.appendChild(ioProc);
-
- ioProcIter++;
- }
- dm->_datamodel.appendChild(ioProcElem);
-
- NodeSet<std::string> ioProcNodeSet;
- ioProcNodeSet.push_back(ioProcElem);
- dm->_varResolver.setVariable("_ioprocessors", ioProcNodeSet);
-
- Element<std::string> sessIdElem = dm->_doc.createElement("data");
- sessIdElem.setAttribute("id", "_sessionid");
- Text<std::string> sessIdText = dm->_doc.createTextNode(interpreter->getSessionId());
- sessIdElem.appendChild(sessIdText);
- dm->_datamodel.appendChild(sessIdElem);
-
- NodeSet<std::string> sessIdNodeSet;
- sessIdNodeSet.push_back(sessIdText);
- dm->_varResolver.setVariable("_sessionid", sessIdNodeSet);
-
-
- Element<std::string> nameElem = dm->_doc.createElement("data");
- nameElem.setAttribute("id", "_name");
- Text<std::string> nameText = dm->_doc.createTextNode(interpreter->getName());
- nameElem.appendChild(nameText);
- dm->_datamodel.appendChild(nameElem);
-
- NodeSet<std::string> nameNodeSet;
- nameNodeSet.push_back(nameText);
- dm->_varResolver.setVariable("_name", nameNodeSet);
-
- return dm;
-}
-
-XPathDataModel::~XPathDataModel() {
-}
-
-void XPathDataModel::pushContext() {
-}
-
-void XPathDataModel::popContext() {
-}
-
-void XPathDataModel::initialize() {
-}
-
-void XPathDataModel::setEvent(const Event& event) {
- Element<std::string> eventElem = _doc.createElement("data");
- eventElem.setAttribute("id", "_event");
-
- Element<std::string> eventDataElem = _doc.createElement("data");
- NodeSet<std::string> eventNodeSet;
-
- {
- // -- name
- Element<std::string> eventNameElem = _doc.createElement("name");
- Text<std::string> eventName = _doc.createTextNode(event.name.c_str());
- eventNameElem.appendChild(eventName);
- eventElem.appendChild(eventNameElem);
- }
- {
- // -- origin
- Element<std::string> eventOriginElem = _doc.createElement("origin");
- Text<std::string> eventOrigin = _doc.createTextNode(event.origin.c_str());
- eventOriginElem.appendChild(eventOrigin);
- eventElem.appendChild(eventOriginElem);
- }
- {
- // -- type
- Element<std::string> eventTypeElem = _doc.createElement("type");
- Text<std::string> eventType;
- switch (event.eventType) {
- case Event::INTERNAL:
- eventType = _doc.createTextNode("internal");
- break;
- case Event::EXTERNAL:
- eventType = _doc.createTextNode("external");
- break;
- case Event::PLATFORM:
- eventType = _doc.createTextNode("platform");
- break;
- }
- eventTypeElem.appendChild(eventType);
- eventElem.appendChild(eventTypeElem);
- }
-
- if (event.params.size() > 0) {
- std::multimap<std::string, Data>::const_iterator paramIter = event.params.begin();
- while(paramIter != event.params.end()) {
- Element<std::string> eventParamElem = _doc.createElement("data");
- // this is simplified - Data might be more elaborate than a simple string atom
- Text<std::string> eventParamText = _doc.createTextNode(paramIter->second.atom);
-
- eventParamElem.setAttribute("id", paramIter->first);
- eventParamElem.appendChild(eventParamText);
- eventDataElem.appendChild(eventParamElem);
- paramIter++;
- }
- }
- if (event.namelist.size() > 0) {
- std::map<std::string, Data>::const_iterator namelistIter = event.namelist.begin();
- while(namelistIter != event.namelist.end()) {
- Element<std::string> eventNamelistElem = _doc.createElement("data");
- // this is simplified - Data might be more elaborate than a simple string atom
- Text<std::string> eventNamelistText = _doc.createTextNode(namelistIter->second.atom);
-
- eventNamelistElem.setAttribute("id", namelistIter->first);
- eventNamelistElem.appendChild(eventNamelistText);
- eventDataElem.appendChild(eventNamelistElem);
- namelistIter++;
- }
- }
- if (event.raw.size() > 0) {
- Element<std::string> eventRawElem = _doc.createElement("raw");
- Text<std::string> textNode = _doc.createTextNode(event.raw.c_str());
- eventRawElem.appendChild(textNode);
- eventElem.appendChild(eventRawElem);
- }
-
- if (event.content.size() > 0) {
- Text<std::string> textNode = _doc.createTextNode(spaceNormalize(event.content).c_str());
- eventDataElem.appendChild(textNode);
- }
- if (event.dom) {
- Node<std::string> importedNode = _doc.importNode(event.dom, true);
- eventDataElem.appendChild(importedNode);
- }
- if (event.data.array.size() == 1) {
- Text<std::string> textNode = _doc.createTextNode(event.data.array.front().atom.c_str());
- eventDataElem.appendChild(textNode);
- } else if (event.data.array.size() > 1) {
- std::list<uscxml::Data>::const_iterator ptr;
- unsigned int i;
-
- for( i = 0 , ptr = event.data.array.begin() ;
- ((i < event.data.array.size()) && (ptr != event.data.array.end()));
- i++ , ptr++ ) {
- Element<std::string> eventMESElem = _doc.createElement("data");
- Text<std::string> textNode = _doc.createTextNode(ptr->atom.c_str());
- std::stringstream ss;
- ss << i;
- eventMESElem.setAttribute("id", ss.str());
- eventMESElem.appendChild(textNode);
- eventDataElem.appendChild(eventMESElem);
- }
- }
-
- eventElem.appendChild(eventDataElem);
- eventNodeSet.push_back(eventElem);
-
- // do we need to replace an existing event?
- Node<std::string> oldEventElem = _datamodel.getFirstChild();
- while(oldEventElem) {
- if (oldEventElem.getNodeType() == Node_base::ELEMENT_NODE) {
- if (HAS_ATTR_CAST(oldEventElem, "id") && iequals(ATTR_CAST(oldEventElem, "id"), "_event"))
- break;
- }
- oldEventElem = oldEventElem.getNextSibling();
- }
-
- if (oldEventElem) {
- _datamodel.replaceChild(eventElem, oldEventElem);
- } else {
- _datamodel.appendChild(eventElem);
- }
- _varResolver.setVariable("_event", eventNodeSet);
-}
-
-Data XPathDataModel::getStringAsData(const std::string& content) {
- Data data;
- XPathValue<std::string> result = _xpath.evaluate_expr(content, _doc);
-
- std::stringstream ss;
-
- switch (result.type()) {
- case ANY:
- break;
- case Arabica::XPath::BOOL:
- ss << result.asBool();
- break;
- case NUMBER:
- ss << result.asNumber();
- break;
- case STRING:
- ss << result.asString();
- break;
- case NODE_SET:
- NodeSet<std::string> ns = result.asNodeSet();
- for (size_t i = 0; i < ns.size(); i++) {
- ss.str("");
- ss << i;
- std::string idx = ss.str();
- ss.str("");
- ss << ns[i];
- data.compound[idx] = Data(ss.str(), Data::INTERPRETED);
- }
- data.type = Data::INTERPRETED;
- return data;
- break;
- }
-
- data.atom = ss.str();
- data.type = Data::VERBATIM;
- return data;
-}
-
-bool XPathDataModel::validate(const std::string& location, const std::string& schema) {
- return true;
-}
-
-bool XPathDataModel::isLocation(const std::string& expr) {
- return true;
-}
-
-uint32_t XPathDataModel::getLength(const std::string& expr) {
-// std::cout << _datamodel << std::endl;
- XPathValue<std::string> result = _xpath.evaluate_expr(expr, _doc);
- switch(result.type()) {
- case NUMBER:
- return result.asNumber();
- break;
- case NODE_SET:
- return result.asNodeSet().size();
- break;
- default:
- ERROR_EXECUTION_THROW("'" + expr + "' does not evaluate to an array.");
- }
- return 0;
-}
-
-void XPathDataModel::setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration) {
-
- XPathValue<std::string> arrayResult = _xpath.evaluate_expr(array, _doc);
- assert(arrayResult.type() == NODE_SET);
-
-#if 0
- std::cout << "Array Size: " << arrayResult.asNodeSet().size() << std::endl;
- for (size_t i = 0; i < arrayResult.asNodeSet().size(); i++) {
- std::cout << arrayResult.asNodeSet()[i] << std::endl;
- }
-#endif
-
- assert(arrayResult.asNodeSet().size() >= iteration);
-
-
- NodeSet<std::string> arrayNodeSet;
- arrayNodeSet.push_back(arrayResult.asNodeSet()[iteration]);
-
- if (!isDeclared(item)) {
- if (!isValidIdentifier(item))
- ERROR_EXECUTION_THROW("Expression '" + item + "' not a valid identifier.");
- Element<std::string> container = _doc.createElement("data");
- container.setAttribute("id", item);
- container.appendChild(arrayResult.asNodeSet()[iteration].cloneNode(true));
- _datamodel.appendChild(container);
- _varResolver.setVariable(item, arrayNodeSet);
- }
- XPathValue<std::string> itemResult = _varResolver.resolveVariable("", item);
- assign(itemResult, arrayNodeSet, Element<std::string>());
-
- if (index.length() > 0) {
- NodeSet<std::string> indexNodeSet;
- Text<std::string> indexElem = _doc.createTextNode(toStr(iteration));
- indexNodeSet.push_back(indexElem);
-
- if (!isDeclared(index)) {
- Element<std::string> container = _doc.createElement("data");
- container.setAttribute("id", index);
- container.appendChild(indexElem);
- _datamodel.appendChild(container);
-
- NodeSet<std::string> indexVarNodeSet;
- indexVarNodeSet.push_back(container);
- _varResolver.setVariable(index, indexVarNodeSet);
- }
- XPathValue<std::string> indexResult = _varResolver.resolveVariable("", index);
- assign(indexResult, indexNodeSet, Element<std::string>());
- }
-
-
-#if 0
- std::cout << _datamodel << std::endl << std::endl;
- std::cout << "Index: " << indexResult.asNodeSet().size() << std::endl;
- for (size_t i = 0; i < indexResult.asNodeSet().size(); i++) {
- std::cout << indexResult.asNodeSet()[i] << std::endl;
- }
- std::cout << std::endl;
-#endif
-
-
-}
-
-bool XPathDataModel::isValidIdentifier(const std::string& identifier) {
- if(boost::starts_with(identifier, "."))
- return false;
-
- return true;
-}
-
-
-void XPathDataModel::eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr) {
- XPathValue<std::string> result = _xpath.evaluate_expr(expr, _doc);
-}
-
-bool XPathDataModel::isDeclared(const std::string& expr) {
- return true;
- try {
- return _varResolver.isDeclared(expr) || evalAsBool(expr);
- } catch(...) {
- return false;
- }
-}
-
-bool XPathDataModel::evalAsBool(const std::string& expr) {
- return evalAsBool(Arabica::DOM::Element<std::string>(), expr);
-}
-
-bool XPathDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
-// std::cout << std::endl << evalAsString(expr);
- XPathValue<std::string> result;
- try {
- result = _xpath.evaluate_expr(expr, _doc);
- } catch(SyntaxException e) {
- ERROR_EXECUTION_THROW(e.what());
- } catch(std::runtime_error e) {
- ERROR_EXECUTION_THROW(e.what());
- }
- return result.asBool();
-}
-
-std::string XPathDataModel::evalAsString(const std::string& expr) {
-
- XPathValue<std::string> result;
- try {
- result = _xpath.evaluate_expr(expr, _doc);
- } catch(SyntaxException e) {
- ERROR_EXECUTION_THROW(e.what());
- } catch(std::runtime_error e) {
- ERROR_EXECUTION_THROW(e.what());
- }
- switch (result.type()) {
- case STRING:
- return result.asString();
- break;
- case Arabica::XPath::BOOL: // MSVC croaks with ambiguous symbol without qualified name
- return (result.asBool() ? "true" : "false");
- break;
- case NUMBER:
- return toStr(result.asNumber());
- break;
- case NODE_SET: {
- NodeSet<std::string> nodeSet = result.asNodeSet();
- std::stringstream ss;
- for (size_t i = 0; i < nodeSet.size(); i++) {
- ss << nodeSet[i];
- if (nodeSet[i].getNodeType() != Node_base::TEXT_NODE) {
- ss << std::endl;
- }
- }
- return ss.str();
- break;
- }
- case ANY:
- ERROR_EXECUTION_THROW("Type ANY not supported to evaluate as string");
- break;
- }
- return "undefined";
-}
-
-double XPathDataModel::evalAsNumber(const std::string& expr) {
- XPathValue<std::string> result = _xpath.evaluate_expr(expr, _doc);
- return result.asNumber();
-}
-
-void XPathDataModel::assign(const Element<std::string>& assignElem,
- const Node<std::string>& node,
- const std::string& content) {
- std::string location;
- if (HAS_ATTR(assignElem, "id")) {
- location = ATTR(assignElem, "id");
- } else if (HAS_ATTR(assignElem, "location")) {
- location = ATTR(assignElem, "location");
- }
-
- // test 326ff
- XPathValue<std::string> key = _xpath.evaluate_expr(location, _doc);
-#ifdef VERBOSE
- LOG(INFO) << "Key XPath : " << key.asString();
-#endif
-#if 0
- if (key.type() == NODE_SET) {
- try {
- for (size_t i = 0; i < key.asNodeSet().size(); i++) {
- Node<std::string> node = key.asNodeSet()[i];
- if (node == _varResolver.resolveVariable("", "_ioprocessors").asNodeSet()[0])
- ERROR_EXECUTION_THROW("Cannot assign _ioProcessors");
- if (node == _varResolver.resolveVariable("", "_sessionid").asNodeSet()[0])
- ERROR_EXECUTION_THROW("Cannot assign _sessionid");
- if (node == _varResolver.resolveVariable("", "_name").asNodeSet()[0])
- ERROR_EXECUTION_THROW("Cannot assign _name");
- if (node == _varResolver.resolveVariable("", "_event").asNodeSet()[0])
- ERROR_EXECUTION_THROW("Cannot assign _event");
- }
- } catch (Event e) {}
- }
-#endif
- NodeSet<std::string> nodeSet;
- if (node) {
- Node<std::string> data = node;
- while (data) {
- // do not add empty text as a node
- if (data.getNodeType() == Node_base::TEXT_NODE) {
- std::string trimmed = data.getNodeValue();
- boost::trim(trimmed);
- if (trimmed.length() == 0) {
- data = data.getNextSibling();
- continue;
- }
- }
- nodeSet.push_back(data);
- data = data.getNextSibling();
- }
- assign(key, nodeSet, assignElem);
- } else if (content.length() > 0) {
- Text<std::string> textNode = _doc.createTextNode(spaceNormalize(content));
- nodeSet.push_back(textNode);
- assign(key, nodeSet, assignElem);
- } else if (HAS_ATTR(assignElem, "expr")) {
- XPathValue<std::string> value = _xpath.evaluate_expr(ATTR(assignElem, "expr"), _doc);
-#ifdef VERBOSE
- LOG(INFO) << "Value XPath : " << value.asString();
-#endif
- assign(key, value, assignElem);
- } else {
- LOG(ERROR) << "assign element has no content";
- }
-
-// std::cout << _datamodel << std::endl;
-}
-
-void XPathDataModel::assign(const std::string& location, const Data& data) {
- XPathValue<std::string> locationResult = _xpath.evaluate_expr(location, _doc);
- NodeSet<std::string> dataNodeSet = dataToNodeSet(data);
- assign(locationResult, dataNodeSet, Element<std::string>());
-// std::cout << _datamodel << std::endl;
-}
-
-NodeSet<std::string> XPathDataModel::dataToNodeSet(const Data& data) {
- NodeSet<std::string> dataNodeSet;
- if (data.atom.length() > 0) {
- dataNodeSet.push_back(_doc.createTextNode(data.atom));
- }
- return dataNodeSet;
-}
-
-void XPathDataModel::init(const Element<std::string>& dataElem,
- const Node<std::string>& node,
- const std::string& content) {
- std::string location;
- if (HAS_ATTR(dataElem, "id")) {
- location = ATTR(dataElem, "id");
- } else if (HAS_ATTR(dataElem, "location")) {
- location = ATTR(dataElem, "location");
- }
-
- NodeSet<std::string> nodeSet;
- if (node || (content.length() > 0)) {
- _datamodel.appendChild(_doc.importNode(dataElem, true));
- nodeSet.push_back(dataElem);
- } else if (HAS_ATTR(dataElem, "expr")) {
- try {
- Element<std::string> container = _doc.createElement("data");
- container.setAttribute("id", location);
- XPathValue<std::string> expr = _xpath.evaluate_expr(ATTR(dataElem, "expr"), _doc);
- switch (expr.type()) {
- case NODE_SET: {
- for (size_t i = 0; i < expr.asNodeSet().size(); i++) {
- container.appendChild(expr.asNodeSet()[i].cloneNode(true));
- nodeSet.push_back(expr.asNodeSet()[i].cloneNode(true));
- }
- break;
- }
- case STRING:
- container.appendChild(_doc.createTextNode(expr.asString()));
- nodeSet.push_back(_doc.createTextNode(expr.asString()));
- break;
- case NUMBER: {
- container.appendChild(_doc.createTextNode(toStr(expr.asNumber())));
- nodeSet.push_back(_doc.createTextNode(toStr(expr.asNumber())));
- break;
- }
- case Arabica::XPath::BOOL:
- case ANY:
- ERROR_EXECUTION_THROW("expr evaluates to type ANY");
- }
- _datamodel.appendChild(container);
- } catch (SyntaxException e) {
- ERROR_EXECUTION_THROW(e.what());
- }
- } else {
- LOG(ERROR) << "data element has no content";
- }
-
- _varResolver.setVariable(location, nodeSet);
-}
-
-void XPathDataModel::init(const std::string& location, const Data& data) {
- NodeSet<std::string> nodeSet;
- _varResolver.setVariable(location, nodeSet);
-}
-
-
-void XPathDataModel::assign(const XPathValue<std::string>& key,
- const XPathValue<std::string>& value,
- const Element<std::string>& assignElem) {
- switch (key.type()) {
- case NODE_SET:
- if (key.asNodeSet().size() == 0) {
- ERROR_EXECUTION_THROW("key for assign is empty nodeset");
- }
- switch (value.type()) {
- case STRING:
- assign(key.asNodeSet(), value.asString(), assignElem);
- break;
- case Arabica::XPath::BOOL:
- assign(key.asNodeSet(), value.asBool(), assignElem);
- break;
- case NUMBER:
- assign(key.asNodeSet(), value.asNumber(), assignElem);
- break;
- case NODE_SET:
- assign(key.asNodeSet(), value.asNodeSet(), assignElem);
- break;
- case ANY:
- ERROR_EXECUTION_THROW("Type ANY as key for assign not supported");
- }
- break;
- case STRING:
- case Arabica::XPath::BOOL:
- case NUMBER:
- case ANY:
- ERROR_EXECUTION_THROW("Type ANY as key for assign not supported")
- break;
- }
-}
-
-void XPathDataModel::assign(const XPathValue<std::string>& key,
- const NodeSet<std::string>& value,
- const Element<std::string>& assignElem) {
- if (value.size() == 0 || !value[0])
- return;
- switch (key.type()) {
- case NODE_SET: {
- assign(key.asNodeSet(), value, assignElem);
- break;
- }
- case STRING:
- case Arabica::XPath::BOOL:
- case NUMBER:
- case ANY:
- ERROR_EXECUTION_THROW("Type ANY as key for assign not supported")
- }
-}
-
-void XPathDataModel::assign(const NodeSet<std::string>& key,
- const std::string& value,
- const Element<std::string>& assignElem) {
- if (key.size() == 0)
- return;
- for (size_t i = 0; i < key.size(); i++) {
- Node<std::string> node = key[i];
- switch (node.getNodeType()) {
- case Node_base::ATTRIBUTE_NODE: {
- Attr<std::string> attr(node);
- attr.setValue(value);
- break;
- }
- case Node_base::TEXT_NODE: {
- Text<std::string> text(node);
- text.setNodeValue(value);
- break;
- }
- case Node_base::ELEMENT_NODE: {
- Element<std::string> element(node);
- if (HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "addattribute")) {
- // addattribute: Add an attribute with the name specified by 'attr'
- // and value specified by 'expr' to the node specified by 'location'.
- if (!HAS_ATTR(assignElem, "attr"))
- ERROR_EXECUTION_THROW("Assign element is missing 'attr'");
- element.setAttribute(ATTR(assignElem, "attr"), value);
- } else {
- /// test 547
- while(element.hasChildNodes())
- element.removeChild(element.getChildNodes().item(0));
- Text<std::string> text = _doc.createTextNode(value);
- element.appendChild(text);
- }
- break;
- }
- default:
- ERROR_EXECUTION_THROW("Unsupported node type with assign");
- break;
- }
- }
-}
-
-void XPathDataModel::assign(const NodeSet<std::string>& key,
- const double value,
- const Element<std::string>& assignElem) {
- assign(key, toStr(value), assignElem);
-}
-
-void XPathDataModel::assign(const NodeSet<std::string>& key,
- const bool value,
- const Element<std::string>& assignElem) {
-}
-
-void XPathDataModel::assign(const NodeSet<std::string>& key,
- const NodeSet<std::string>& value,
- const Element<std::string>& assignElem) {
- if (key.size() == 0)
- return;
- if (value.size() == 0 || !value[0])
- return;
-
- for (size_t i = 0; i < key.size(); i++) {
- switch (key[i].getNodeType())
- case Node_base::ELEMENT_NODE: {
- assign(Element<std::string>(key[i]), value, assignElem);
- break;
- default:
-// std::cout << key[i].getNodeType() << std::endl;
- ERROR_EXECUTION_THROW("Unsupported node type for assign");
- break;
- }
- }
-}
-
-void XPathDataModel::assign(const Element<std::string>& key,
- const NodeSet<std::string>& value,
- const Element<std::string>& assignElem) {
- Element<std::string> element(key);
- if (value.size() == 0 || !value[0])
- return;
-
- if (false) {
- } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "firstchild")) {
- // firstchild: Insert the value specified by 'expr' before all of the children at 'location'.
- for (size_t i = value.size(); i; i--) {
- Node<std::string> importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true));
- element.insertBefore(importedNode, element.getFirstChild());
- }
- } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "lastchild")) {
- // lastchild: Insert the value specified by 'expr' after all of the children at 'location'.
- for (size_t i = 0; i < value.size(); i++) {
- Node<std::string> importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true));
- element.appendChild(importedNode);
- }
- } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "previoussibling")) {
- // previoussibling: Insert the value specified by 'expr' before the
- // node specified by 'location', keeping the same parent.
- Node<std::string> parent = element.getParentNode();
- if (!parent)
- ERROR_EXECUTION_THROW("Node has no parent");
- for (size_t i = 0; i < value.size(); i++) {
- Node<std::string> importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true));
- parent.insertBefore(importedNode, element);
- }
- } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "nextsibling")) {
- // nextsibling: Insert the value specified by 'expr' after the node
- // specified by 'location', keeping the same parent.
- Node<std::string> parent = element.getParentNode();
- if (!parent)
- ERROR_EXECUTION_THROW("Node has no parent");
- for (size_t i = value.size(); i; i--) {
- Node<std::string> importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true));
- Node<std::string> nextSibling = element.getNextSibling();
- if (nextSibling) {
- parent.insertBefore(importedNode, element.getNextSibling());
- } else {
- parent.appendChild(importedNode);
- }
- }
- } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "replace")) {
- // replace: Replace the node specified by 'location' by the value specified by 'expr'.
- Node<std::string> parent = element.getParentNode();
- if (!parent)
- ERROR_EXECUTION_THROW("Node has no parent");
- if (value.size() != 1)
- ERROR_EXECUTION_THROW("Value not singular");
- Node<std::string> importedNode = (value[0].getOwnerDocument() == _doc ? value[0].cloneNode(true) : _doc.importNode(value[0], true));
- parent.replaceChild(importedNode, element);
- } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "delete")) {
- // delete: Delete the node specified by 'location'. ('expr' is ignored.).
- Node<std::string> parent = element.getParentNode();
- if (!parent)
- ERROR_EXECUTION_THROW("Node has no parent");
- parent.removeChild(element);
- } else {
- // replacechildren: Replace all the children at 'location' with the value specified by 'expr'.
- while(element.hasChildNodes())
- element.removeChild(element.getChildNodes().item(0));
- for (size_t i = 0; i < value.size(); i++) {
- Node<std::string> importedNode = element.getOwnerDocument().importNode(value[i], true);
- element.appendChild(importedNode);
- }
- }
-}
-
-XPathValue<std::string>
-NodeSetVariableResolver::resolveVariable(const std::string& namepaceUri,
- const std::string& name) const {
- std::map<std::string, NodeSet<std::string> >::const_iterator n = _variables.find(name);
- if(n == _variables.end()) {
- ERROR_EXECUTION_THROW("No variable named '" + name + "'");
- }
-#if VERBOSE
- std::cout << std::endl << "Getting " << name << ":" << std::endl;
- for (size_t i = 0; i < n->second.size(); i++) {
- std::cout << n->second[i].getNodeType() << " | " << n->second[i] << std::endl;
- }
- std::cout << std::endl;
-#endif
- return XPathValue<std::string>(new NodeSetValue<std::string>(n->second));
-}
-
-void NodeSetVariableResolver::setVariable(const std::string& name, const NodeSet<std::string>& value) {
-#if VERBOSE
- std::cout << std::endl << "Setting " << name << ":" << std::endl;
- for (size_t i = 0; i < value.size(); i++) {
- std::cout << value[i].getNodeType() << " | " << value[i] << std::endl;
- }
- std::cout << std::endl;
-#endif
- _variables[name] = value;
-#if 0
- std::map<std::string, Arabica::XPath::NodeSet<std::string> >::iterator varIter = _variables.begin();
- while (varIter != _variables.end()) {
- std::cout << varIter->first << ":" << std::endl;
- for (size_t i = 0; i < varIter->second.size(); i++) {
- std::cout << varIter->second[i].getNodeType() << " | " << varIter->second[i] << std::endl;
- }
- varIter++;
- }
-#endif
-}
-
-bool NodeSetVariableResolver::isDeclared(const std::string& name) {
-#if 0
- std::map<std::string, Arabica::XPath::NodeSet<std::string> >::iterator varIter = _variables.begin();
- while (varIter != _variables.end()) {
- std::cout << varIter->first << std::endl;
- varIter++;
- }
-#endif
- return _variables.find(name) != _variables.end();
-}
-
-XPathFunction<std::string>*
-XPathFunctionResolver::resolveFunction(const std::string& namespace_uri,
- const std::string& name,
- const std::vector<XPathExpression<std::string> >& argExprs) const {
- if (iequals(name, "in")) {
- return new XPathFunctionIn(1, -1, argExprs, _interpreter);
- }
- return _xpathFuncRes.resolveFunction(namespace_uri, name, argExprs);
-}
-
-std::vector<std::pair<std::string, std::string> > XPathFunctionResolver::validNames() const {
- std::vector<std::pair<std::string, std::string> > names = _xpathFuncRes.validNames();
- names.push_back(std::make_pair("", "In"));
- return names;
-}
-
-bool XPathFunctionIn::doEvaluate(const Node<std::string>& context,
- const ExecutionContext<std::string>& executionContext) const {
- for (size_t i = 0; i < argCount(); i++) {
- XPathValue<std::string> stateName = arg(i, context, executionContext);
- if (stateName.type() == STRING) {
- if (_interpreter->isInState(stateName.asString())) {
- continue;
- }
- }
- return false;
- }
- return true;
-}
-
-}
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h
deleted file mode 100644
index 7a085d2..0000000
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef XPATHDATAMODEL_H_KN8TWG0V
-#define XPATHDATAMODEL_H_KN8TWG0V
-
-#include "uscxml/InterpreterInfo.h"
-#include "uscxml/plugins/DataModel.h"
-
-#include <list>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-class Event;
-class Data;
-}
-
-namespace uscxml {
-
-class XPathFunctionIn : public Arabica::XPath::BooleanXPathFunction<std::string> {
-public:
- XPathFunctionIn(int minArgs,
- int maxArgs,
- const std::vector<Arabica::XPath::XPathExpression<std::string> >& args,
- InterpreterInfo* interpreter) :
- Arabica::XPath::BooleanXPathFunction<std::string>(minArgs, maxArgs, args),
- _interpreter(interpreter) {}
-
-protected:
- bool doEvaluate(const Arabica::DOM::Node<std::string>& context,
- const Arabica::XPath::ExecutionContext<std::string>& executionContext) const;
- InterpreterInfo* _interpreter;
-};
-
-class XPathFunctionResolver : public Arabica::XPath::FunctionResolver<std::string> {
-public:
- virtual ~XPathFunctionResolver() { }
-
- virtual Arabica::XPath::XPathFunction<std::string>*
- resolveFunction(const std::string& namespace_uri,
- const std::string& name,
- const std::vector<Arabica::XPath::XPathExpression<std::string> >& argExprs) const;
-
- virtual std::vector<std::pair<std::string, std::string> > validNames() const;
- void setInterpreter(InterpreterInfo* interpreter) {
- _interpreter = interpreter;
- }
-protected:
- Arabica::XPath::StandardXPathFunctionResolver<std::string> _xpathFuncRes;
- InterpreterInfo* _interpreter;
-};
-
-class NodeSetVariableResolver : public Arabica::XPath::VariableResolver<std::string> {
-public:
- Arabica::XPath::XPathValue<std::string> resolveVariable(const std::string& namepaceUri,
- const std::string& name) const;
- void setVariable(const std::string& name, const Arabica::XPath::NodeSet<std::string>& value);
- bool isDeclared(const std::string& name);
-
-private:
- std::map<std::string, Arabica::XPath::NodeSet<std::string> > _variables;
- friend class XPathDataModel;
-};
-
-class XPathDataModel : public DataModelImpl {
-public:
- XPathDataModel();
- virtual ~XPathDataModel();
- virtual boost::shared_ptr<DataModelImpl> create(InterpreterInfo* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("xpath");
- return names;
- }
-
- virtual void initialize();
- virtual void setEvent(const Event& event);
-
- virtual bool validate(const std::string& location, const std::string& schema);
- virtual bool isLocation(const std::string& expr);
-
- virtual uint32_t getLength(const std::string& expr);
- virtual void setForeach(const std::string& item,
- const std::string& array,
- const std::string& index,
- uint32_t iteration);
-
- virtual void pushContext();
- virtual void popContext();
-
- virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
- const std::string& expr);
- virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void assign(const std::string& location, const Data& data);
-
- virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
- const Arabica::DOM::Node<std::string>& node,
- const std::string& content);
- virtual void init(const std::string& location, const Data& data);
-
- virtual Data getStringAsData(const std::string& content);
- virtual bool isDeclared(const std::string& expr);
-
- virtual std::string evalAsString(const std::string& expr);
- virtual bool evalAsBool(const std::string& expr);
- virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr);
- virtual double evalAsNumber(const std::string& expr);
-
-protected:
- Arabica::XPath::XPath<std::string> _xpath;
- Arabica::DOM::DOMImplementation<std::string> _domFactory;
- Arabica::DOM::Element<std::string> _datamodel;
- Arabica::DOM::Document<std::string> _doc;
-
- bool isValidIdentifier(const std::string& identifier);
- Arabica::XPath::NodeSet<std::string> dataToNodeSet(const Data& data);
-
- // resolve value to its type
- void assign(const Arabica::XPath::XPathValue<std::string>& key,
- const Arabica::XPath::XPathValue<std::string>& value,
- const Arabica::DOM::Element<std::string>& assignElem);
- void assign(const Arabica::XPath::XPathValue<std::string>& key,
- const Arabica::XPath::NodeSet<std::string>& value,
- const Arabica::DOM::Element<std::string>& assignElem);
-
- // assign value to a nodeset key
- void assign(const Arabica::XPath::NodeSet<std::string>& key,
- const std::string& value,
- const Arabica::DOM::Element<std::string>& assignElem);
- void assign(const Arabica::XPath::NodeSet<std::string>& key,
- const double value,
- const Arabica::DOM::Element<std::string>& assignElem);
- void assign(const Arabica::XPath::NodeSet<std::string>& key,
- const bool value,
- const Arabica::DOM::Element<std::string>& assignElem);
- void assign(const Arabica::XPath::NodeSet<std::string>& key,
- const Arabica::XPath::NodeSet<std::string>& value,
- const Arabica::DOM::Element<std::string>& assignElem);
-
- // assign value to an element key (from nodeset)
- void assign(const Arabica::DOM::Element<std::string>& key,
- const Arabica::XPath::NodeSet<std::string>& value,
- const Arabica::DOM::Element<std::string>& assignElem);
-
-
- // assign value to a text node key (from nodeset)
- void assign(const Arabica::DOM::Text<std::string>& key,
- const Arabica::XPath::NodeSet<std::string>& value,
- const Arabica::DOM::Element<std::string>& assignElem);
-
-
- NodeSetVariableResolver _varResolver;
- XPathFunctionResolver _funcResolver;
-
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(XPathDataModel, DataModelImpl);
-#endif
-
-}
-
-#endif /* end of include guard: XPATHDATAMODEL_H_KN8TWG0V */
diff --git a/src/uscxml/plugins/element/CMakeLists.txt b/src/uscxml/plugins/element/CMakeLists.txt
deleted file mode 100644
index e2142ca..0000000
--- a/src/uscxml/plugins/element/CMakeLists.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-if (NOT BUILD_MINIMAL)
-
- # Fetch element
-
- set(USCXML_ELEMENTS "fetch ${USCXML_ELEMENTS}")
- file(GLOB_RECURSE FETCH_ELEMENT
- fetch/*.cpp
- fetch/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${FETCH_ELEMENT})
- add_library(
- element_fetch SHARED
- ${FETCH_ELEMENT}
- "../Plugins.cpp")
- target_link_libraries(element_fetch uscxml)
- set_target_properties(element_fetch PROPERTIES FOLDER "Plugin Element")
- set_target_properties(element_fetch PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(element_fetch PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${FETCH_ELEMENT})
- endif()
-
- # MMI elements
-
- # file(GLOB_RECURSE MMI_ELEMENT
- # mmi/*.cpp
- # mmi/*.h
- # )
- # if (BUILD_AS_PLUGINS)
- # source_group("" FILES ${MMI_ELEMENT})
- # add_library(
- # element_mmi SHARED
- # ${MMI_ELEMENT}
- # "../Plugins.cpp")
- # target_link_libraries(element_mmi uscxml)
- # set_target_properties(element_mmi PROPERTIES FOLDER "Plugin Element")
- # set_target_properties(element_mmi PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- # set_target_properties(element_mmi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- # else()
- # list (APPEND USCXML_FILES ${MMI_ELEMENT})
- # endif()
-
-
- # Postpone element
-
- set(USCXML_ELEMENTS "postpone ${USCXML_ELEMENTS}")
- file(GLOB_RECURSE POSTPONE_ELEMENT
- postpone/*.cpp
- postpone/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${POSTPONE_ELEMENT})
- add_library(
- element_postpone SHARED
- ${POSTPONE_ELEMENT}
- "../Plugins.cpp")
- target_link_libraries(element_postpone uscxml)
- set_target_properties(element_postpone PROPERTIES FOLDER "Plugin Element")
- set_target_properties(element_postpone PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(element_postpone PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${POSTPONE_ELEMENT})
- endif()
-
-
- # File element
-
- set(USCXML_ELEMENTS "file ${USCXML_ELEMENTS}")
- file(GLOB_RECURSE FILE_ELEMENT
- file/*.cpp
- file/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${FILE_ELEMENT})
- add_library(
- element_file SHARED
- ${FILE_ELEMENT}
- "../Plugins.cpp")
- target_link_libraries(element_file uscxml)
- set_target_properties(element_file PROPERTIES FOLDER "Plugin Element")
- set_target_properties(element_file PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(element_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${FILE_ELEMENT})
- endif()
-
-
- # Respond element
-
- set(USCXML_ELEMENTS "respond ${USCXML_ELEMENTS}")
- file(GLOB_RECURSE RESPOND_ELEMENT
- respond/*.cpp
- respond/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${RESPOND_ELEMENT})
- add_library(
- element_respond SHARED
- ${RESPOND_ELEMENT}
- "../Plugins.cpp")
- target_link_libraries(element_respond uscxml)
- set_target_properties(element_respond PROPERTIES FOLDER "Plugin Element")
- set_target_properties(element_respond PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(element_respond PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${RESPOND_ELEMENT})
- endif()
-
-endif() # BUILD_MINIMAL
-
-set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE)
-set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
-set(USCXML_ELEMENTS ${USCXML_ELEMENTS} PARENT_SCOPE)
diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp
deleted file mode 100644
index bf3129b..0000000
--- a/src/uscxml/plugins/element/fetch/FetchElement.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "FetchElement.h"
-#include "uscxml/dom/DOMUtils.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 pluginConnect(pluma::Host& host) {
- host.add( new FetchElementProvider() );
- return true;
-}
-#endif
-
-boost::shared_ptr<ExecutableContentImpl> FetchElement::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<FetchElement> element = boost::shared_ptr<FetchElement>(new FetchElement());
- element->_interpreter = interpreter;
- return element;
-}
-
-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 (iequals(_type, "text")) {
- event.data.atom = content;
- event.data.type = Data::VERBATIM;
- } else if (iequals(_type, "url")) {
- } else if (iequals(_type, "json")) {
- event.data = Data::fromJSON(content);
- } else if (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::Element<std::string>& node) {
- if (!HAS_ATTR(node, "src") && !HAS_ATTR(node, "srcexpr")) {
- LOG(ERROR) << "Fetch element requires src or srcexpr";
- return;
- }
- if (HAS_ATTR(node, "srcexpr") && !_interpreter->getDataModel()) {
- LOG(ERROR) << "Fetch element with srcexpr requires datamodel";
- return;
- }
- _source = (HAS_ATTR(node, "src") ? ATTR(node, "src") : _interpreter->getDataModel().evalAsString(ATTR(node, "srcexpr")));
-
- 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 (!iequals(_type, "text") &&
- !iequals(_type, "url") &&
- !iequals(_type, "json") &&
- !iequals(_type, "xml")) {
- LOG(ERROR) << "Fetch element type attribute not one of text, url, json, xml.";
- return;
- }
-
- _targetUrl = URL(_source);
- if (!_targetUrl.isAbsolute()) {
- if (!_targetUrl.toAbsolute(_interpreter->getBaseURL(node))) {
- LOG(ERROR) << "Cannot transform " << _source << " into absolute URL";
- return;
- }
- }
-
- _targetUrl.addMonitor(this);
- URLFetcher::fetchURL(_targetUrl);
-
-}
-
-void FetchElement::exitElement(const Arabica::DOM::Element<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
deleted file mode 100644
index 3b7628a..0000000
--- a/src/uscxml/plugins/element/fetch/FetchElement.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#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(InterpreterImpl* 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::Element<std::string>& node);
- void exitElement(const Arabica::DOM::Element<std::string>& node);
- void downloadCompleted(const URL& url);
- void downloadFailed(const URL& url, int errorCode);
-
-protected:
- URL _targetUrl;
- std::string _source;
- std::string _callback;
- std::string _type;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(FetchElement, ExecutableContentImpl);
-#endif
-
-}
-
-#endif /* end of include guard: FETCHELEMENT_H_R6GH94FV */
diff --git a/src/uscxml/plugins/element/file/FileElement.cpp b/src/uscxml/plugins/element/file/FileElement.cpp
deleted file mode 100644
index c2e4f55..0000000
--- a/src/uscxml/plugins/element/file/FileElement.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "FileElement.h"
-#include <glog/logging.h>
-#include <stdio.h>
-#include <vector>
-#include <boost/algorithm/string.hpp>
-#include "uscxml/messages/Blob.h"
-
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/dom/NameSpacingParser.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new FileElementProvider() );
- return true;
-}
-#endif
-
-boost::shared_ptr<ExecutableContentImpl> FileElement::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<FileElement> element = boost::shared_ptr<FileElement>(new FileElement());
- return element;
-}
-
-FileElement::~FileElement() {
-}
-
-void FileElement::enterElement(const Arabica::DOM::Element<std::string>& node) {
- if (!HAS_ATTR(node, "url") && !HAS_ATTR(node, "urlexpr")) {
- LOG(ERROR) << "File element requires url or urlexpr";
- return;
- }
- _givenUrl = (HAS_ATTR(node, "url") ? ATTR(node, "url") : _interpreter->getDataModel().evalAsString(ATTR(node, "urlexpr")));
-
- std::string sandBoxStr = (HAS_ATTR(node, "sandbox") ? ATTR(node, "sandbox") : "on");
- if (iequals(sandBoxStr, "off") || iequals(sandBoxStr, "false") || iequals(sandBoxStr, "no")) {
- _sandBoxed = false;
- }
-
- if (HAS_ATTR(node, "operation")) {
- std::string operation = ATTR(node, "operation");
- if (iequals(operation, "read") || iequals(operation, "load")) {
- _operation = READ;
- } else if(iequals(operation, "write")) {
- _operation = WRITE;
- } else if(iequals(operation, "append")) {
- _operation = APPEND;
- } else {
- LOG(ERROR) << "File element operation attribute not one of read, write or append.";
- return;
- }
- } else {
- _operation = READ;
- }
-
- // callback is only needed for reading
- std::string callback;
- if (_operation == READ) {
- if (!HAS_ATTR(node, "callback") && !HAS_ATTR(node, "callbackexpr")) {
- LOG(ERROR) << "File element requires callback or callbackexpr";
- return;
- }
- callback = (HAS_ATTR(node, "callback") ? ATTR(node, "callback") : _interpreter->getDataModel().evalAsString(ATTR(node, "callbackexpr")));
- }
-
- std::string contentStr;
- char* content = NULL;
- size_t contentSize = 0;
- if (_operation == WRITE || _operation == APPEND) {
- if (!HAS_ATTR(node, "content") && !HAS_ATTR(node, "contentexpr")) {
- LOG(ERROR) << "File element requires content or contentexpr";
- return;
- }
- if (HAS_ATTR(node, "content")) {
- contentStr = ATTR(node, "content");
- } else {
- Data data = _interpreter->getDataModel().getStringAsData(ATTR(node, "contentexpr"));
- if (data.binary) {
- content = data.binary.getData();
- contentSize = data.binary.getSize();
- } else if (data.atom.length() > 0) {
- contentStr = data.atom;
- }
- }
- }
-
- std::string type = "text";
- if (HAS_ATTR(node, "type")) {
- type = ATTR(node, "type");
- } else if(HAS_ATTR(node, "typeexpr")) {
- type = _interpreter->getDataModel().evalAsString(ATTR(node, "typeexpr"));
- }
- if (iequals(type, "text")) {
- _type = TEXT;
- } else if (iequals(type, "json")) {
- _type = JSON;
- } else if (iequals(type, "binary")) {
- _type = BINARY;
- } else if(iequals(type, "xml")) {
- _type = XML;
- } else {
- LOG(ERROR) << "File element type attribute not one of text, json, xml or binary.";
- return;
- }
-
- _actualUrl = URL(_givenUrl);
- if (_sandBoxed && _actualUrl.isAbsolute()) {
- LOG(ERROR) << "Given URL is absolute with sandboxing enabled.";
- return;
- }
-
- if (_sandBoxed)
- _actualUrl.toAbsolute(URL::getResourceDir());
-
- _filepath = _actualUrl.path();
-
-
- std::string writeMode;
- switch (_operation) {
- case APPEND:
- writeMode = "a+";
- case WRITE: {
- if (writeMode.length() == 0)
- writeMode = "w+";
-
- FILE *fp;
- fp = fopen(_filepath.c_str(), writeMode.c_str());
- if (fp == NULL) {
- LOG(ERROR) << "Error opening '" << _filepath << "' for writing: " << strerror(errno);
- }
-
- if (content && contentSize > 0) {
- size_t written = fwrite(content, 1, contentSize, fp);
- if (written != contentSize) {
- LOG(ERROR) << "Error writing to '" << _filepath << "': " << strerror(errno);
- return;
- }
- } else if (contentStr.length() > 0) {
- size_t written = fwrite(contentStr.c_str(), contentStr.length(), 1, fp);
- if (written < 1) {
- LOG(ERROR) << "Error writing to '" << _filepath << "': " << strerror(errno);
- }
- } else {
- LOG(WARNING) << "Nothing to write to '" << _filepath;
- }
- fclose(fp);
- break;
- }
- case READ: {
- struct stat fileStat;
- int err = stat(_filepath.c_str(), &fileStat);
- if (err < 0) {
- LOG(ERROR) << "Cannot stat file '" << _filepath << "': " << strerror(errno);
- return;
- }
-
- Event event;
- event.name = callback;
-
- std::string filename = _actualUrl.pathComponents()[_actualUrl.pathComponents().size() - 1];
-
- event.data.compound["file"].compound["name"] = Data(filename, Data::VERBATIM);
- event.data.compound["file"].compound["path"] = Data(_filepath, Data::VERBATIM);
- event.data.compound["file"].compound["mtime"] = Data(toStr(fileStat.st_mtime), Data::INTERPRETED);
- event.data.compound["file"].compound["ctime"] = Data(toStr(fileStat.st_ctime), Data::INTERPRETED);
- event.data.compound["file"].compound["atime"] = Data(toStr(fileStat.st_atime), Data::INTERPRETED);
- event.data.compound["file"].compound["size"] = Data(toStr(fileStat.st_size), Data::INTERPRETED);
-
-
- FILE *fp;
- fp = fopen(_filepath.c_str(), "r");
-
- fseek (fp, 0, SEEK_END);
- size_t filesize = ftell(fp);
- rewind (fp);
-
- char* fileContents = (char*)malloc(filesize);
- size_t read = fread(fileContents, 1, filesize, fp);
- fclose(fp);
- if (read != filesize) {
- LOG(ERROR) << "Error reading from '" << _filepath << "': " << strerror(errno);
- return;
- }
-
- switch (_type) {
- case BINARY: {
- std::string mimetype = "application/octet-stream";
- if (HAS_ATTR(node, "mimetype")) {
- mimetype = ATTR(node, "mimetype");
- } else if(HAS_ATTR(node, "mimetypeexpr")) {
- mimetype = _interpreter->getDataModel().evalAsString(ATTR(node, "mimetypeexpr"));
- }
-
- event.data.compound["content"] = Data(fileContents, fileStat.st_size, mimetype, true);
- break;
- }
- case TEXT:
- event.data.compound["content"] = Data(fileContents, Data::VERBATIM);
- free(fileContents);
- break;
- case JSON: {
- Data json = Data::fromJSON(fileContents);
- free(fileContents);
- if (json.empty()) {
- LOG(ERROR) << "Cannot parse contents of " << _filepath << " as JSON";
- return;
- }
- event.data.compound["content"] = json;
- break;
- }
- case XML: {
- NameSpacingParser parser = NameSpacingParser::fromXML(fileContents);
- if (parser.errorsReported()) {
- LOG(ERROR) << "Cannot parse contents of " << _filepath << " as XML";
- return;
- }
- event.dom = parser.getDocument().getDocumentElement();
- break;
- }
- }
- _interpreter->receive(event);
- break;
- }
- }
-
-
-
-
-}
-
-void FileElement::exitElement(const Arabica::DOM::Element<std::string>& node) {
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/file/FileElement.h b/src/uscxml/plugins/element/file/FileElement.h
deleted file mode 100644
index b1b3426..0000000
--- a/src/uscxml/plugins/element/file/FileElement.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef FILEELEMENT_H_VJ3JIMEJ
-#define FILEELEMENT_H_VJ3JIMEJ
-
-#include <uscxml/Interpreter.h>
-#include <sys/stat.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class FileElement : public ExecutableContentImpl {
-public:
- enum Operation {
- READ,
- WRITE,
- APPEND
- };
-
- enum Type {
- XML,
- JSON,
- TEXT,
- BINARY
- };
-
- FileElement() {
- _sandBoxed = true;
- }
- virtual ~FileElement();
- boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter);
-
- std::string getLocalName() {
- return "file";
- }
-
- std::string getNamespace() {
- return "http://www.w3.org/2005/07/scxml";
- }
-
- bool processChildren() {
- return false;
- }
-
- void enterElement(const Arabica::DOM::Element<std::string>& node);
- void exitElement(const Arabica::DOM::Element<std::string>& node);
-
-protected:
-
- bool _sandBoxed;
- std::string _givenUrl;
- URL _actualUrl;
- std::string _filepath;
- Operation _operation;
- Type _type;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(FileElement, ExecutableContentImpl);
-#endif
-
-}
-
-#endif /* end of include guard: FILEELEMENT_H_VJ3JIMEJ */
diff --git a/src/uscxml/plugins/element/mmi/MMIEvents.cpp b/src/uscxml/plugins/element/mmi/MMIEvents.cpp
deleted file mode 100644
index e6d6954..0000000
--- a/src/uscxml/plugins/element/mmi/MMIEvents.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "MMIEvents.h"
-
-namespace uscxml {
-
-void PrepareRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void StartRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void PauseRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void ResumeRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void CancelRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void ClearContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void StatusRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void NewContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void PrepareResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void StartResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void PauseResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void ResumeResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void CancelResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void ClearContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void StatusResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void DoneNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void NewContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-void ExtensionNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/mmi/MMIEvents.h b/src/uscxml/plugins/element/mmi/MMIEvents.h
deleted file mode 100644
index 74c66c0..0000000
--- a/src/uscxml/plugins/element/mmi/MMIEvents.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef MMIEVENTS_H_QHO6VT3M
-#define MMIEVENTS_H_QHO6VT3M
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-#define ELEMENT_CREATOR(elementName) \
-boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) { \
- boost::shared_ptr<elementName> element = boost::shared_ptr<elementName>(new elementName()); \
- element->_interpreter = interpreter; \
- return element; \
-}
-
-#define ELEMENT_MMI_CLASS(elementName) \
-class elementName##Element : public ExecutableContentImpl { \
-public:\
- elementName##Element () {}\
- virtual ~elementName##Element () {}\
- ELEMENT_CREATOR(elementName##Element);\
- std::string getLocalName() { return "elementName"; }\
- std::string getNamespace() { return "http://www.w3.org/2008/04/mmi-arch"; }\
- bool processChildren() { return false; }\
- void enterElement(const Arabica::DOM::Element<std::string>& node) {}\
- void exitElement(const Arabica::DOM::Element<std::string>& node) {}\
-};
-
-namespace uscxml {
-
-ELEMENT_MMI_CLASS(PrepareRequest);
-ELEMENT_MMI_CLASS(StartRequest);
-ELEMENT_MMI_CLASS(PauseRequest);
-ELEMENT_MMI_CLASS(ResumeRequest);
-ELEMENT_MMI_CLASS(CancelRequest);
-ELEMENT_MMI_CLASS(ClearContextRequest);
-ELEMENT_MMI_CLASS(StatusRequest);
-ELEMENT_MMI_CLASS(NewContextResponse);
-ELEMENT_MMI_CLASS(PrepareResponse);
-ELEMENT_MMI_CLASS(StartResponse);
-ELEMENT_MMI_CLASS(PauseResponse);
-ELEMENT_MMI_CLASS(ResumeResponse);
-ELEMENT_MMI_CLASS(CancelResponse);
-ELEMENT_MMI_CLASS(ClearContextResponse);
-ELEMENT_MMI_CLASS(StatusResponse);
-ELEMENT_MMI_CLASS(DoneNotification);
-ELEMENT_MMI_CLASS(NewContextRequest);
-ELEMENT_MMI_CLASS(ExtensionNotification);
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(FetchElement, ExecutableContentImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: MMIEVENTS_H_QHO6VT3M */
diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.cpp b/src/uscxml/plugins/element/postpone/PostponeElement.cpp
deleted file mode 100644
index 460cc88..0000000
--- a/src/uscxml/plugins/element/postpone/PostponeElement.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "PostponeElement.h"
-#include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new PostponeElementProvider() );
- return true;
-}
-#endif
-
-boost::shared_ptr<ExecutableContentImpl> PostponeElement::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<PostponeElement> invoker = boost::shared_ptr<PostponeElement>(new PostponeElement());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-void PostponeElement::enterElement(const Arabica::DOM::Element<std::string>& node) {
- if (!_interpreter->getDataModel()) {
- LOG(ERROR) << "Postpone element requires a datamodel";
- return;
- }
-
- // under which condition will we postpone the current event?
- if (HAS_ATTR(node, "cond")) {
- std::string cond = ATTR(node, "cond");
- try {
- if (!_interpreter->getDataModel().evalAsBool(cond))
- return;
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in cond attribute of postpone element:" << std::endl << e << std::endl;
- return;
- }
- }
-
- // chaining causes the event to fire if the condition was true since postponing
- bool chained = false;
- if (HAS_ATTR(node, "chaining")) {
- chained = iequals(ATTR(node, "chaining"), "true");
- }
-
- // when will we refire the event?
- std::string until;
- try {
- if (HAS_ATTR(node, "untilexpr")) {
- until = _interpreter->getDataModel().evalAsString(ATTR(node, "untilexpr"));
- } else if (HAS_ATTR(node, "until")) {
- until = ATTR(node, "until");
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in postpone element untilexpr:" << std::endl << e << std::endl;
- return;
- }
-
- if (until.length() == 0) {
- LOG(ERROR) << "Postpone element requires until or untilexpr attribute ";
- return;
- }
-
-// LOG(INFO) << until;
-
-#if 0
- std::string timeoutStr = "0s";
- try {
- if (HAS_ATTR(node, "timeoutexpr")) {
- timeoutStr = _interpreter->getDataModel().evalAsString(ATTR(node, "timeoutexpr"));
- } else if (HAS_ATTR(node, "timeout")) {
- timeoutStr = ATTR(node, "timeout");
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in postpone element timeoutexpr:" << std::endl << e << std::endl;
- return;
- }
-
- uint64_t timeout = 0;
- NumAttr timeoutAttr(timeoutStr);
- if (iequals(timeoutAttr.unit, "s")) {
- timeout = strTo<int>(timeoutAttr.value) * 1000;
- } else if (iequals(timeoutAttr.unit, "ms")) {
- timeout = strTo<int>(timeoutAttr.value);
- }
- if (timeout > 0) {
- timeout += tthread::chrono::system_clock::now();
- }
-#endif
- Event currEvent = _interpreter->getCurrentEvent();
- Resubmitter::postpone(currEvent, until, 0, chained, _interpreter);
-}
-
-void PostponeElement::exitElement(const Arabica::DOM::Element<std::string>& node) {
-}
-
-void PostponeElement::Resubmitter::postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter) {
- Resubmitter* resubmitter = getInstance(interpreter);
- resubmitter->_postponedEvents.push_back(Postponed(event, until, timeout, chained));
-}
-
-void PostponeElement::Resubmitter::onStableConfiguration(Interpreter interpreter) {
- std::list<Postponed>::iterator eventIter = _postponedEvents.begin();
- bool dispatched = false;
- while(eventIter != _postponedEvents.end()) {
- try {
-// LOG(INFO) << "Reevaluating: >> " << eventIter->first << " <<";
- if ((!dispatched || eventIter->chaining) && interpreter.getDataModel().evalAsBool(eventIter->until)) {
-// LOG(INFO) << " -> is TRUE";
- eventIter->event.name += ".postponed";
- interpreter.receive(eventIter->event, true);
- _postponedEvents.erase(eventIter++);
- dispatched = true;
- }
-// LOG(INFO) << " -> is FALSE";
- } catch (Event e) {
- LOG(ERROR) << "Syntax error while evaluating until attribute of postpone element:" << std::endl << e << std::endl;
- _postponedEvents.erase(eventIter++);
- continue;
- }
- eventIter++;
- }
-// LOG(ERROR) << _postponedEvents.size() << " Postponess remaining";
-
-}
-
-void PostponeElement::Resubmitter::afterCompletion(Interpreter interpreter) {
- tthread::lock_guard<tthread::recursive_mutex> lock(PostponeElement::Resubmitter::_accessLock);
- _instances.erase(interpreter);
- delete this; // committing suicide is ok if we are careful
-}
-
-std::map<Interpreter, PostponeElement::Resubmitter*> PostponeElement::Resubmitter::_instances;
-tthread::recursive_mutex PostponeElement::Resubmitter::_accessLock;
-
-PostponeElement::Resubmitter* PostponeElement::Resubmitter::getInstance(InterpreterImpl* interpreter) {
- tthread::lock_guard<tthread::recursive_mutex> lock(PostponeElement::Resubmitter::_accessLock);
- if (_instances.find(interpreter->shared_from_this()) == _instances.end()) {
- _instances[interpreter->shared_from_this()] = new Resubmitter(interpreter);
- }
- return _instances[interpreter->shared_from_this()];
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.h b/src/uscxml/plugins/element/postpone/PostponeElement.h
deleted file mode 100644
index 9840c75..0000000
--- a/src/uscxml/plugins/element/postpone/PostponeElement.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef POSTPONEELEMENT_H_WN8EIYYI
-#define POSTPONEELEMENT_H_WN8EIYYI
-
-#include <uscxml/Interpreter.h>
-#include <list>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class PostponeElement : public ExecutableContentImpl {
-public:
- struct Postponed {
- Postponed(const Event& event, const std::string& until, long timeout, bool chaining = false) :
- event(event), until(until), timeout(timeout), chaining(chaining) {}
- Event event;
- std::string until;
- uint64_t timeout;
- bool chaining;
- };
-
- PostponeElement() {}
- virtual ~PostponeElement() {}
- boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter);
-
- std::string getLocalName() {
- return "postpone";
- }
-
- std::string getNamespace() {
- return "http://www.w3.org/2005/07/scxml";
- }
-
- bool processChildren() {
- return false;
- }
-
- void enterElement(const Arabica::DOM::Element<std::string>& node);
- void exitElement(const Arabica::DOM::Element<std::string>& node);
-
-protected:
- // once per interpreter
- class Resubmitter : public InterpreterMonitor {
- public:
- Resubmitter(InterpreterImpl* interpreter) {
- interpreter->addMonitor(this);
- }
-
- static Resubmitter* getInstance(InterpreterImpl* interpreter);
- static void postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter);
-
- // InterpreterMonitor
- void onStableConfiguration(Interpreter interpreter);
- void afterCompletion(Interpreter interpreter);
-
- std::list<Postponed> _postponedEvents;
- static std::map<Interpreter, Resubmitter*> _instances;
- static tthread::recursive_mutex _accessLock;
-
- };
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(PostponeElement, ExecutableContentImpl);
-#endif
-
-}
-
-#endif /* end of include guard: POSTPONEELEMENT_H_WN8EIYYI */
diff --git a/src/uscxml/plugins/element/respond/RespondElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp
deleted file mode 100644
index 032f74e..0000000
--- a/src/uscxml/plugins/element/respond/RespondElement.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "RespondElement.h"
-#include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
-#include "uscxml/server/InterpreterServlet.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new RespondElementProvider() );
- return true;
-}
-#endif
-
-boost::shared_ptr<ExecutableContentImpl> RespondElement::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<RespondElement> invoker = boost::shared_ptr<RespondElement>(new RespondElement());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-void RespondElement::enterElement(const Arabica::DOM::Element<std::string>& node) {
- // try to get the request id
- if (!HAS_ATTR(node, "to")) {
- LOG(ERROR) << "Respond element requires to attribute";
- return;
- }
- if (HAS_ATTR(node, "to") && !_interpreter->getDataModel()) {
- LOG(ERROR) << "Respond element with to requires datamodel";
- return;
- }
- std::string requestId = _interpreter->getDataModel().evalAsString(ATTR(node, "to"));
-
- // try to get the request object
- InterpreterHTTPServlet* 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 respond element";
- return;
- }
-
- assert(servlet->getRequests().find(requestId) != servlet->getRequests().end());
- HTTPServer::Request httpReq = servlet->getRequests()[requestId];
- assert(httpReq.evhttpReq != NULL);
- HTTPServer::Reply httpReply(httpReq);
- servlet->getRequests().erase(requestId);
-
- // get the status or default to 200
- std::string statusStr = (HAS_ATTR(node, "status") ? ATTR(node, "status") : "200");
- if (!isNumeric(statusStr.c_str(), 10)) {
- LOG(ERROR) << "Respond element with non-numeric status " << statusStr;
- return;
- }
- httpReply.status = strTo<int>(statusStr);;
-
- // extract the content
- Arabica::XPath::NodeSet<std::string> contents = DOMUtils::filterChildElements(_interpreter->getNameSpaceInfo().getXMLPrefixForNS(getNamespace()) + "content", node);
- if (contents.size() > 0) {
- Arabica::DOM::Element<std::string> contentElem = Arabica::DOM::Element<std::string>(contents[0]);
- if (HAS_ATTR(contentElem, "expr")) { // -- content is evaluated string from datamodel ------
- if (_interpreter->getDataModel()) {
- try {
- Data contentData = _interpreter->getDataModel().getStringAsData(ATTR(contentElem, "expr"));
- if (contentData.atom.length() > 0) {
- httpReply.content = contentData.atom;
- httpReply.headers["Content-Type"] = "text/plain";
- } else if (contentData.binary) {
- httpReply.content = std::string(contentData.binary.getData(), contentData.binary.getSize());
- httpReply.headers["Content-Type"] = contentData.binary.getMimeType();
- } else if (contentData.node) {
- std::stringstream ss;
- ss << contentData.node;
- httpReply.content = ss.str();;
- httpReply.headers["Content-Type"] = "application/xml";
- } else {
- httpReply.content = Data::toJSON(contentData);
- httpReply.headers["Content-Type"] = "application/json";
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error with expr in content child of Respond element:" << std::endl << e << std::endl;
- return;
- }
- } else {
- LOG(ERROR) << "content element has expr attribute but no datamodel is specified.";
- return;
- }
- } else if (HAS_ATTR(contentElem, "file") || HAS_ATTR(contentElem, "fileexpr")) { // -- content is from file ------
- URL file;
- if (HAS_ATTR(contentElem, "fileexpr")) {
- if (_interpreter->getDataModel()) {
- try {
- file = "file://" + _interpreter->getDataModel().evalAsString(ATTR(contentElem, "fileexpr"));
- } catch (Event e) {
- LOG(ERROR) << "Syntax error with fileexpr in content child of Respond element:" << std::endl << e << std::endl;
- return;
- }
- }
- } else {
- file = "file://" + ATTR(contentElem, "fileexpr");
- }
- if (file) {
- httpReply.content = file.getInContent();
- size_t lastDot;
- if ((lastDot = file.path().find_last_of(".")) != std::string::npos) {
- std::string extension = file.path().substr(lastDot + 1);
- std::string mimeType = URL::getMimeType(extension);
- if (mimeType.length() > 0) {
- httpReply.headers["Content-Type"] = mimeType;
- }
- }
- }
- } else if (contents[0].hasChildNodes()) { // -- content embedded as child nodes ------
- httpReply.content = contents[0].getFirstChild().getNodeValue();
- } else {
- LOG(ERROR) << "content element does not specify any content.";
- return;
- }
- }
-
- // process headers
- Arabica::XPath::NodeSet<std::string> headers = DOMUtils::filterChildElements(_interpreter->getNameSpaceInfo().getXMLPrefixForNS(getNamespace()) + "header", node);
- for (size_t i = 0; i < headers.size(); i++) {
- Arabica::DOM::Element<std::string> headerElem = Arabica::DOM::Element<std::string>(headers[i]);
-
- std::string name;
- if (HAS_ATTR(headerElem, "name")) {
- name = ATTR(headerElem, "name");
- } else if(HAS_ATTR(headerElem, "nameexpr")) {
- if (_interpreter->getDataModel()) {
- try {
- name = _interpreter->getDataModel().evalAsString(ATTR(headerElem, "nameexpr"));
- } catch (Event e) {
- LOG(ERROR) << "Syntax error with nameexpr in header child of Respond element:" << std::endl << e << std::endl;
- return;
- }
- } else {
- LOG(ERROR) << "header element has nameexpr attribute but no datamodel is specified.";
- return;
- }
- } else {
- LOG(ERROR) << "header element has no name or nameexpr attribute.";
- return;
- }
-
- std::string value;
- if (HAS_ATTR(headerElem, "value")) {
- value = ATTR(headerElem, "value");
- } else if(HAS_ATTR(headerElem, "valueexpr")) {
- if (_interpreter->getDataModel()) {
- try {
- value = _interpreter->getDataModel().evalAsString(ATTR(headerElem, "valueexpr"));
- } catch (Event e) {
- LOG(ERROR) << "Syntax error with valueexpr in header child of Respond element:" << std::endl << e << std::endl;
- return;
- }
- } else {
- LOG(ERROR) << "header element has valueexpr attribute but no datamodel is specified.";
- return;
- }
- } else {
- LOG(ERROR) << "header element has no value or valueexpr attribute.";
- return;
- }
-
- httpReply.headers[name] = value;
- }
-
- // send the reply
- HTTPServer::reply(httpReply);
- servlet->getRequests().erase(requestId);
-}
-
-void RespondElement::exitElement(const Arabica::DOM::Element<std::string>& node) {
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/respond/RespondElement.h b/src/uscxml/plugins/element/respond/RespondElement.h
deleted file mode 100644
index 2e8cec7..0000000
--- a/src/uscxml/plugins/element/respond/RespondElement.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef RESPONDELEMENT_H_I11KQ39Q
-#define RESPONDELEMENT_H_I11KQ39Q
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class RespondElement : public ExecutableContentImpl {
-public:
- RespondElement() {}
- virtual ~RespondElement() {}
- boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter);
-
- std::string getLocalName() {
- return "respond";
- }
-
- std::string getNamespace() {
- return "http://www.w3.org/2005/07/scxml";
- }
-
- bool processChildren() {
- return false;
- }
-
- void enterElement(const Arabica::DOM::Element<std::string>& node);
- void exitElement(const Arabica::DOM::Element<std::string>& node);
-
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(RespondElement, ExecutableContentImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: RESPONDELEMENT_H_I11KQ39Q */
diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt
index 03f22a6..ec64899 100644
--- a/src/uscxml/plugins/invoker/CMakeLists.txt
+++ b/src/uscxml/plugins/invoker/CMakeLists.txt
@@ -4,572 +4,7 @@ set(USCXML_INVOKERS "scxml ${USCXML_INVOKERS}")
file(GLOB_RECURSE USCXML_INVOKER
scxml/*.cpp
scxml/*.h)
-if (BUILD_AS_PLUGINS)
- source_group("" FILES ${USCXML_INVOKER})
- add_library(
- invoker_uscxml SHARED
- ${USCXML_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_uscxml uscxml)
- set_target_properties(invoker_uscxml PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_uscxml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_uscxml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
-else()
list (APPEND USCXML_FILES ${USCXML_INVOKER})
-endif()
-
-if (NOT BUILD_MINIMAL)
- # sample invoker - include to make sure it compiles
- set(USCXML_INVOKERS "sample ${USCXML_INVOKERS}")
- file(GLOB_RECURSE SAMPLE_INVOKER
- sample/*.cpp
- sample/*.h
- )
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${SAMPLE_INVOKER})
- add_library(
- invoker_sample SHARED
- ${SAMPLE_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_sample uscxml)
- set_target_properties(invoker_sample PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_sample PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_sample PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SAMPLE_INVOKER})
- endif()
-
- # DirMon invoker to watch for filesystem changes
-
- set(USCXML_INVOKERS "dirmon ${USCXML_INVOKERS}")
- file(GLOB_RECURSE DIRMON_INVOKER
- filesystem/dirmon/*.cpp
- filesystem/dirmon/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${DIRMON_INVOKER})
- add_library(
- invoker_dirmon SHARED
- ${DIRMON_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_dirmon uscxml)
- set_target_properties(invoker_dirmon PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_dirmon PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_dirmon PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${DIRMON_INVOKER})
- endif()
-
-
- # Location invoker to watch for proximity to GPS coordinates
-
- # file(GLOB_RECURSE LOCATION_INVOKER
- # location/*.cpp
- # location/*.h
- # )
- # if (BUILD_AS_PLUGINS)
- # source_group("" FILES ${LOCATION_INVOKER})
- # add_library(
- # invoker_location SHARED
- # ${LOCATION_INVOKER}
- # "../Plugins.cpp")
- # target_link_libraries(invoker_location uscxml)
- # set_target_properties(invoker_location PROPERTIES FOLDER "Plugin Invoker")
- # else()
- # list (APPEND USCXML_FILES ${LOCATION_INVOKER})
- # endif()
-
-
- # XHTML invoker
-
- set(USCXML_INVOKERS "xhtml ${USCXML_INVOKERS}")
- file(GLOB_RECURSE XHTML_INVOKER
- xhtml/*.cpp
- xhtml/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${XHTML_INVOKER})
- add_library(
- invoker_xhtml SHARED
- ${XHTML_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_xhtml uscxml)
- set_target_properties(invoker_xhtml PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_xhtml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_xhtml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${XHTML_INVOKER})
- endif()
-
-
- # System invoker to open a native command
-
- file(GLOB_RECURSE SYSTEM_INVOKER
- system/*.cpp
- system/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${SYSTEM_INVOKER})
- add_library(
- invoker_system SHARED
- ${SYSTEM_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_system uscxml)
- set_target_properties(invoker_system PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_system PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_system PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SYSTEM_INVOKER})
- endif()
-
-
- # expect invoker
-
- if (EXPECT_FOUND AND TCL_FOUND)
- set(USCXML_INVOKERS "expect ${USCXML_INVOKERS}")
- file(GLOB_RECURSE EXPECT_INVOKER
- expect/*.cpp
- expect/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES EXPECT_INVOKER)
- add_library(
- invoker_expect SHARED
- ${EXPECT_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_expect uscxml ${EXPECT_LIBRARY} ${TCL_LIBRARY})
- set_target_properties(invoker_expect PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_expect PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_expect PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${EXPECT_INVOKER})
- endif()
- endif()
-
-
- # SMTP invoker via curl
-
- if (CURL_HAS_SMTP)
- set(USCXML_INVOKERS "smtp ${USCXML_INVOKERS}")
- file(GLOB_RECURSE SMTP_INVOKER
- smtp/*.cpp
- smtp/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES SMTP_INVOKER)
- add_library(
- invoker_smtp SHARED
- ${SMTP_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_smtp uscxml)
- set_target_properties(invoker_smtp PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_smtp PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_smtp PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SMTP_INVOKER})
- endif()
- endif()
-
-
- # IMAP invoker via curl
-
- set(USCXML_INVOKERS "imap ${USCXML_INVOKERS}")
- file(GLOB_RECURSE IMAP_INVOKER
- imap/*.cpp
- imap/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES IMAP_INVOKER)
- add_library(
- invoker_imap SHARED
- ${IMAP_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_imap uscxml)
- set_target_properties(invoker_imap PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_imap PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_imap PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${IMAP_INVOKER})
- endif()
-
-
- # SQLite3 SQL Invoker
-
- if (SQLITE3_FOUND)
- file(GLOB_RECURSE SQLITE3_INVOKER
- sqlite3/*.cpp
- sqlite3/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${SQLITE3_INVOKER})
- add_library(
- invoker_sqlite3 SHARED
- ${SQLITE3_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_sqlite3 uscxml)
- set_target_properties(invoker_sqlite3 PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_sqlite3 PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_sqlite3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SQLITE3_INVOKER})
- endif()
- endif()
-
-
- # ffmpeg invoker
-
- if (FFMPEG_FOUND)
- set(USCXML_INVOKERS "ffmpeg ${USCXML_INVOKERS}")
- file(GLOB_RECURSE FFMPEG_INVOKER
- ffmpeg/*.cpp
- ffmpeg/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${FFMPEG_INVOKER})
- add_library(
- invoker_ffmpeg SHARED
- ${FFMPEG_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_ffmpeg uscxml ${FFMPEG_LIBRARIES})
- set_target_properties(invoker_ffmpeg PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_ffmpeg PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_ffmpeg PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${FFMPEG_INVOKER})
- endif()
- endif()
-
-
- # instant messaging invoker
-
- if (LIBPURPLE_FOUND)
- set(USCXML_INVOKERS "im ${USCXML_INVOKERS}")
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/im/IMConfig.h.in ${CMAKE_BINARY_DIR}/uscxml/IMConfig.h)
-
- file(GLOB_RECURSE LIBPURPLE_INVOKER
- im/*.cpp
- im/*.h
- )
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${LIBPURPLE_INVOKER})
- add_library(
- invoker_im SHARED
- ${LIBPURPLE_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_im uscxml ${LIBPURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${ICONV_LIBRARIES})
- set_target_properties(invoker_im PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_im PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_im PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${LIBPURPLE_INVOKER})
- endif()
- endif()
-
-
- # calendar invoker
-
- if (LIBICAL_FOUND)
- set(USCXML_INVOKERS "calendar ${USCXML_INVOKERS}")
- file(GLOB_RECURSE CALENDAR_INVOKER
- calendar/*.cpp
- calendar/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${CALENDAR_INVOKER})
- add_library(
- invoker_calendar SHARED
- ${CALENDAR_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_calendar uscxml ${LIBICAL_LIBRARIES})
- set_target_properties(invoker_calendar PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_calendar PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_calendar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${CALENDAR_INVOKER})
- endif()
- endif()
-
-
- # webrtc invoker
-
- if (LIBJINGLE_FOUND)
- set(USCXML_INVOKERS "webrtc ${USCXML_INVOKERS}")
- file(GLOB_RECURSE WEBRTC_INVOKER
- webrtc/*.cpp
- webrtc/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${WEBRTC_INVOKER})
- add_library(
- invoker_webrtc SHARED
- ${WEBRTC_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_webrtc uscxml ${LIBJINGLE_LIBRARIES})
- set_target_properties(invoker_webrtc PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_webrtc PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_webrtc PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${WEBRTC_INVOKER})
- endif()
- endif()
-
-
- # location invoker
-
- if (CORELOCATION_LIBRARY AND OFF)
- set(USCXML_INVOKERS "location ${USCXML_INVOKERS}")
- file(GLOB_RECURSE LOCATION_INVOKER
- location/CoreLocation/*.cpp
- location/CoreLocation/*.mm
- location/CoreLocation/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${LOCATION_INVOKER})
- add_library(
- invoker_location SHARED
- ${LOCATION_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_location uscxml)
- set_target_properties(invoker_location PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_location PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_location PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${LOCATION_INVOKER})
- endif()
- endif()
-
-
- # UMUNDO invoker
-
- if (UMUNDO_FOUND AND PROTOBUF_FOUND)
- set(USCXML_INVOKERS "umundo ${USCXML_INVOKERS}")
- set(UMUNDO_INVOKER
- ${CMAKE_CURRENT_SOURCE_DIR}/umundo/UmundoInvoker.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/umundo/UmundoInvoker.h
- )
- if (PROTOBUF_FOUND)
- list(APPEND UMUNDO_INVOKER
- ${CMAKE_CURRENT_SOURCE_DIR}/umundo/JSON.pb.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/umundo/JSON.pb.h
- )
- endif()
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${UMUNDO_INVOKER})
- # message(FATAL_ERROR "UMUNDO_LIBRARIES: ${UMUNDO_LIBRARIES}")
- add_library(
- invoker_umundo SHARED
- ${UMUNDO_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_umundo uscxml
- ${UMUNDO_LIBRARIES})
- if (PROTOBUF_FOUND)
- target_link_libraries(invoker_umundo
- optimized ${PROTOBUF_LIBRARY}
- debug ${PROTOBUF_LIBRARY_DEBUG})
- endif()
- set_target_properties(invoker_umundo PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_umundo PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_umundo PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${UMUNDO_INVOKER})
- endif()
- endif()
-
-
- # HTTP server invoker
-
- set(USCXML_INVOKERS "httpservlet ${USCXML_INVOKERS}")
- file(GLOB_RECURSE HTTPSERVLET_INVOKER
- http/*.cpp
- http/*.h)
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${HTTPSERVLET_INVOKER})
- add_library(
- invoker_httpserver SHARED
- ${HTTPSERVLET_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_httpserver
- uscxml)
- set_target_properties(invoker_httpserver PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_httpserver PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_httpserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${HTTPSERVLET_INVOKER})
- endif()
-
-
- # Heartbeat invoker
-
- set(USCXML_INVOKERS "heartbeat ${USCXML_INVOKERS}")
- file(GLOB_RECURSE HEARTBEAT_INVOKER
- heartbeat/*.cpp
- heartbeat/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${HEARTBEAT_INVOKER})
- add_library(
- invoker_heartbeat SHARED
- ${HEARTBEAT_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_heartbeat uscxml)
- set_target_properties(invoker_heartbeat PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_heartbeat PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_heartbeat PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${HEARTBEAT_INVOKER})
- endif()
-
-
- # OpenSceneGraph invoker
- if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND)
- set(USCXML_INVOKERS "scenegraph ${USCXML_INVOKERS}")
- file(GLOB OPENSCENEGRAPH_INVOKER
- graphics/openscenegraph/*.cpp
- graphics/openscenegraph/*.h)
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${OPENSCENEGRAPH_INVOKER})
- add_library(
- invoker_openscenegraph SHARED
- ${OPENSCENEGRAPH_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_openscenegraph
- ${OPENSCENEGRAPH_LIBRARIES}
- ${OPENGL_LIBRARIES}
- uscxml)
- set_target_properties(invoker_openscenegraph PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_openscenegraph PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_openscenegraph PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${OPENSCENEGRAPH_INVOKER})
- endif()
-
- set(USCXML_INVOKERS "osgvonvert ${USCXML_INVOKERS}")
- file(GLOB OPENSCENEGRAPH_CONVERTER_INVOKER
- graphics/openscenegraph/converter/*.cpp
- graphics/openscenegraph/converter/*.h)
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER})
- add_library(
- invoker_openscenegraph_convert SHARED
- ${OPENSCENEGRAPH_CONVERTER_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_openscenegraph_convert
- ${OPENSCENEGRAPH_LIBRARIES}
- ${OPENGL_LIBRARIES}
- uscxml)
- set_target_properties(invoker_openscenegraph_convert PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_openscenegraph_convert PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_openscenegraph_convert PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER})
- endif()
- endif()
-
-
- # OpenAL modality components
-
- if (OPENAL_FOUND AND (LIBSNDFILE_FOUND OR AUDIOTOOLBOX_FOUND))
- set(USCXML_INVOKERS "openal ${USCXML_INVOKERS}")
- file(GLOB_RECURSE OPENAL_INVOKER
- audio/OpenAL*.cpp
- audio/OpenAL*.h)
- if (LIBSNDFILE_FOUND)
- file(GLOB_RECURSE LIBSNDFILE_WRAPPER
- audio/LibSoundFile*.cpp
- audio/LibSoundFile*.h)
- LIST(APPEND OPENAL_INVOKER ${LIBSNDFILE_WRAPPER})
- elseif(AUDIOTOOLBOX_FOUND)
- file(GLOB_RECURSE AUDIOTOOLBOX_WRAPPER
- audio/AudioToolbox*.mm
- audio/AudioToolbox*.h)
- LIST(APPEND OPENAL_INVOKER ${AUDIOTOOLBOX_WRAPPER})
- endif()
- # message("MILES_INVOKER ${MILES_INVOKER}")
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${OPENAL_INVOKER})
- add_library(
- invoker_openal SHARED
- ${OPENAL_INVOKER}
- "../Plugins.cpp")
- if (LIBSNDFILE_FOUND)
- target_link_libraries(invoker_openal
- ${OPENAL_LIBRARY}
- ${LIBSNDFILE_LIBRARY}
- uscxml)
- elseif(AUDIOTOOLBOX_FOUND)
- target_link_libraries(invoker_openal
- ${OPENAL_LIBRARY}
- ${AUDIOTOOLBOX}/AudioToolbox
- uscxml)
- endif()
- set_target_properties(invoker_openal PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_openal PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_openal PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${OPENAL_INVOKER})
- endif()
- endif()
-
-
- # MILES modality components
-
- if (MILES_FOUND)
- set(USCXML_INVOKERS "miles ${USCXML_INVOKERS}")
- file(GLOB_RECURSE MILES_INVOKER
- miles/*.cpp
- miles/*.h)
- # message("MILES_INVOKER ${MILES_INVOKER}")
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${MILES_INVOKER})
- add_library(
- invoker_miles SHARED
- ${MILES_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_miles
- ${MILES_LIBRARIES}
- ${JPEG_LIBRARIES}
- uscxml)
- if (ICONV_FOUND)
- target_link_libraries(invoker_miles ${ICONV_LIBRARIES})
- endif()
- if (OPENAL_FOUND)
- target_link_libraries(invoker_miles ${OPENAL_LIBRARY})
- endif()
- set_target_properties(invoker_miles PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_miles PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_miles PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${MILES_INVOKER})
- endif()
- endif()
-
-
- set(USCXML_INVOKERS "vxml ${USCXML_INVOKERS}")
- file(GLOB_RECURSE VXML_INVOKER
- vxml/*.cpp
- vxml/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${VXML_INVOKER})
- add_library(
- invoker_voicexml SHARED
- ${VXML_INVOKER}
- "../Plugins.cpp")
- target_link_libraries(invoker_voicexml uscxml)
- set_target_properties(invoker_voicexml PROPERTIES FOLDER "Plugin Invoker")
- set_target_properties(invoker_voicexml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(invoker_voicexml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${VXML_INVOKER})
- endif()
-
-endif() # BUILD_MINIMAL
set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE)
set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
diff --git a/src/uscxml/plugins/invoker/audio/AudioToolbox.h b/src/uscxml/plugins/invoker/audio/AudioToolbox.h
deleted file mode 100644
index 5834f34..0000000
--- a/src/uscxml/plugins/invoker/audio/AudioToolbox.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef AUDIOTOOLBOX_H_GX4SW17C
-#define AUDIOTOOLBOX_H_GX4SW17C
-
-#include "PCMConverter.h"
-#include <AudioToolbox/AudioToolbox.h>
-
-namespace uscxml {
-
-class AudioToolbox : public PCMConverter {
-public:
- AudioToolbox(const std::string filename);
- virtual ~AudioToolbox();
- virtual void seek(unsigned int pos);
- virtual int read(char* buffer, unsigned int size);
-
- virtual void setOutFormat(const PCMFormat& format);
- virtual PCMFormat getInFormat();
-
-protected:
- ExtAudioFileRef _afId;
- AudioStreamBasicDescription _outputFormat;
- AudioStreamBasicDescription _inputFormat;
-
- ALenum formatToALEnum(AudioStreamBasicDescription);
- bool alEnumToFormat(AudioStreamBasicDescription&, ALenum);
-};
-
-}
-
-#endif /* end of include guard: AUDIOTOOLBOX_H_GX4SW17C */
-
-
diff --git a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm
deleted file mode 100644
index ef99063..0000000
--- a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "AudioToolbox.h"
-#include <glog/logging.h>
-
-#import <Foundation/Foundation.h>
-#import <Foundation/NSURL.h>
-
-#ifdef __has_feature
-# if __has_feature(objc_arc)
-# define(HAS_AUTORELEASE_POOL)
-# endif
-#endif
-
-namespace uscxml {
-
-AudioToolbox::AudioToolbox(const std::string filename) {
-#if HAS_AUTORELEASE_POOL
- @autoreleasepool {
-#else
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-#endif
- _afId = 0;
- NSString* filePath = [NSString stringWithCString:filename.c_str() encoding:NSASCIIStringEncoding];
- NSURL* afUrl = [NSURL fileURLWithPath:filePath];
-
- OSStatus result = noErr;
-
- result = ExtAudioFileOpenURL((CFURLRef)afUrl, &_afId);
-
- if (result != noErr) {
- LOG(WARNING) << "Cannot open audio file " << filename;
- return;
- }
- UInt32 thePropertySize = sizeof(_inputFormat);
- result = ExtAudioFileGetProperty(_afId, kExtAudioFileProperty_FileDataFormat, &thePropertySize, &_inputFormat);
- if (result != noErr) {
- LOG(WARNING) << "Cannot determine input format of " << filename;
- return;
- }
-
- // output format is input format
- memcpy(&_outputFormat, &_inputFormat, sizeof(_inputFormat));
-
- // except for things that make no sense for open al
- _outputFormat.mFormatID = kAudioFormatLinearPCM;
- _outputFormat.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;
-
- ALenum bestFormat = formatToALEnum(_outputFormat);
- alEnumToFormat(_outputFormat, bestFormat);
-
- result = ExtAudioFileSetProperty(_afId, kExtAudioFileProperty_ClientDataFormat, sizeof(_outputFormat), &_outputFormat);
-
- if (result != noErr) {
- LOG(WARNING) << "Cannot set audio format file " << filename;
- return;
- }
-
-#if HAS_AUTORELEASE_POOL
- }
-#else
- [pool drain];
-#endif
-}
-
-AudioToolbox::~AudioToolbox() {
- if (_afId)
- ExtAudioFileDispose(_afId); //close the file
-}
-
-void AudioToolbox::seek(unsigned int pos) {
- ExtAudioFileSeek(_afId, pos);
-}
-
-int AudioToolbox::read(char* buffer, unsigned int size) {
- UInt32 read = size / _outputFormat.mBytesPerFrame;
- OSStatus result = noErr;
-
- SInt64 theFileLengthInFrames = 0;
- UInt32 thePropertySize = sizeof(theFileLengthInFrames);
- result = ExtAudioFileGetProperty(_afId, kExtAudioFileProperty_FileLengthFrames, &thePropertySize, &theFileLengthInFrames);
-
- read = (theFileLengthInFrames < read ? theFileLengthInFrames : read);
-
- AudioBufferList dataBuffer;
- dataBuffer.mNumberBuffers = 1;
- dataBuffer.mBuffers[0].mDataByteSize = size;
- dataBuffer.mBuffers[0].mNumberChannels = _outputFormat.mChannelsPerFrame;
- dataBuffer.mBuffers[0].mData = buffer;
-
- result = ExtAudioFileRead(_afId, &read, &dataBuffer);
- if (result != noErr) {
- LOG(WARNING) << "Cannot read data";
- return 0;
- }
-
- return read * _outputFormat.mBytesPerFrame;
-}
-
-ALenum AudioToolbox::formatToALEnum(AudioStreamBasicDescription asbd) {
- if (asbd.mBitsPerChannel < 16) {
- if (asbd.mChannelsPerFrame == 1) {
- return AL_FORMAT_MONO8;
- } else {
- return AL_FORMAT_STEREO8;
- }
- } else {
- if (asbd.mChannelsPerFrame == 1) {
- return AL_FORMAT_MONO16;
- } else {
- return AL_FORMAT_STEREO16;
- }
- }
-}
-
-bool AudioToolbox::alEnumToFormat(AudioStreamBasicDescription& asbd, ALenum format) {
- switch (format) {
- case AL_FORMAT_MONO8:
- asbd.mBitsPerChannel = 8;
- asbd.mBytesPerFrame = 1;
- asbd.mBytesPerPacket = 1;
- asbd.mChannelsPerFrame = 1;
- break;
- case AL_FORMAT_MONO16:
- asbd.mBitsPerChannel = 16;
- asbd.mBytesPerFrame = 2;
- asbd.mBytesPerPacket = 2;
- asbd.mChannelsPerFrame = 1;
- break;
- case AL_FORMAT_STEREO8:
- asbd.mBitsPerChannel = 8;
- asbd.mBytesPerFrame = 2;
- asbd.mBytesPerPacket = 2;
- asbd.mChannelsPerFrame = 2;
- break;
- case AL_FORMAT_STEREO16:
- asbd.mBitsPerChannel = 16;
- asbd.mBytesPerFrame = 4;
- asbd.mBytesPerPacket = 4;
- asbd.mChannelsPerFrame = 2;
- break;
- default:
- break;
- }
- return true;
-}
-
-void AudioToolbox::setOutFormat(const PCMFormat& format) {
-
- alEnumToFormat(_outputFormat, format.alFormat);
- _outputFormat.mSampleRate = format.sampleRate;
-
- OSStatus result = ExtAudioFileSetProperty(_afId, kExtAudioFileProperty_ClientDataFormat, sizeof(_outputFormat), &_outputFormat);
- if (result != noErr) {
- LOG(WARNING) << "Cannot set audio format";
- return;
- }
-
-}
-
-PCMFormat AudioToolbox::getInFormat() {
- PCMFormat format;
- format.sampleRate = _inputFormat.mSampleRate;
- format.alFormat = formatToALEnum(_inputFormat);
- return format;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp b/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp
deleted file mode 100644
index b881e41..0000000
--- a/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "LibSoundFile.h"
-
-namespace uscxml {
-
-LibSoundFile::LibSoundFile(const std::string filename) : PCMConverter() {
- _filename = filename;
- _handle = SndfileHandle(_filename, SFM_READ, SF_FORMAT_PCM_16, 1, 44100);
- _format.sampleRate = _handle.samplerate();
- _format.alFormat = AL_FORMAT_MONO16;
-
-}
-
-LibSoundFile::~LibSoundFile() {
-
-}
-
-void LibSoundFile::seek(unsigned int pos) {
- _handle.seek(pos, 0);
-}
-
-int LibSoundFile::read(char* buffer, unsigned int size) {
- return _handle.readRaw(buffer, size);
-}
-
-void LibSoundFile::setOutFormat(const PCMFormat& format) {
- _format = format;
- switch (_format.alFormat) {
- case AL_FORMAT_MONO8:
- _handle = SndfileHandle(_filename, SFM_READ, SF_FORMAT_PCM_S8, 1, _format.sampleRate);
- break;
- case AL_FORMAT_MONO16:
- _handle = SndfileHandle(_filename, SFM_READ, SF_FORMAT_PCM_16, 1, _format.sampleRate);
- break;
- case AL_FORMAT_STEREO8:
- _handle = SndfileHandle(_filename, SFM_READ, SF_FORMAT_PCM_S8, 2, _format.sampleRate);
- break;
- case AL_FORMAT_STEREO16:
- _handle = SndfileHandle(_filename, SFM_READ, SF_FORMAT_PCM_16, 2, _format.sampleRate);
- break;
-
- default:
- break;
- }
-}
-
-PCMFormat LibSoundFile::getInFormat() {
- return _format;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/audio/LibSoundFile.h b/src/uscxml/plugins/invoker/audio/LibSoundFile.h
deleted file mode 100644
index 0e0b304..0000000
--- a/src/uscxml/plugins/invoker/audio/LibSoundFile.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef LIBSOUNDFILE_H_Q97OEKGG
-#define LIBSOUNDFILE_H_Q97OEKGG
-
-#include "PCMConverter.h"
-#include <sndfile.hh>
-
-namespace uscxml {
-
-class LibSoundFile : public PCMConverter {
-public:
- LibSoundFile(const std::string filename);
- virtual ~LibSoundFile();
- void seek(unsigned int pos);
- int read(char* buffer, unsigned int size);
-
- virtual void setOutFormat(const PCMFormat& format);
- virtual PCMFormat getInFormat();
-
-protected:
- std::string _filename;
- SndfileHandle _handle;
- PCMFormat _format;
-};
-
-}
-
-#endif /* end of include guard: LIBSOUNDFILE_H_Q97OEKGG */
diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp
deleted file mode 100644
index e813f2f..0000000
--- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-// see http://stackoverflow.com/questions/6563810/m-pi-works-with-math-h-but-not-with-cmath-in-visual-studio
-#define _USE_MATH_DEFINES
-#include <cmath>
-
-#include <boost/algorithm/string.hpp>
-
-#include "OpenALInvoker.h"
-#include <uscxml/config.h>
-#include <glog/logging.h>
-#include <limits.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new OpenALInvokerProvider() );
- return true;
-}
-#endif
-
-// see http://stackoverflow.com/questions/1904635/warning-c4003-and-errors-c2589-and-c2059-on-x-stdnumeric-limitsintmax
-#undef max
-
-OpenALInvoker::OpenALInvoker() {
- _isStarted = false;
- _alContext = NULL;
- _alDevice = NULL;
- _thread = NULL;
- _listenerPos[0] = _listenerPos[1] = _listenerPos[2] = 0;
- _listenerVel[0] = _listenerVel[1] = _listenerVel[2] = 0;
- _maxPos[0] = _maxPos[1] = _maxPos[2] = 1;
-
- _listenerOrient[0] = _listenerOrient[1] = _listenerOrient[3] = _listenerOrient[5] = 0;
- _listenerOrient[2] = _listenerOrient[4] = 1.0;
-}
-
-OpenALInvoker::~OpenALInvoker() {
- if (_thread) {
- _isStarted = false;
- _sourcesAvailable.notify_all();
- _thread->join();
- delete(_thread);
- }
- if (_alContext) {
-// alcCloseDevice(alcGetContextsDevice(_alContext));
-// alcDestroyContext(_alContext);
- }
-};
-
-boost::shared_ptr<InvokerImpl> OpenALInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<OpenALInvoker> invoker = boost::shared_ptr<OpenALInvoker>(new OpenALInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data OpenALInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void OpenALInvoker::send(const SendRequest& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- if (!_isStarted)
- start();
-
- if (iequals(req.name, "play")) {
- if (req.params.find("src") == req.params.end()) {
- LOG(ERROR) << "Sent event play with no src URL";
- }
-
- URL srcURL = req.params.find("src")->second.atom;
- if (!srcURL.toAbsolute(_interpreter->getBaseURL(req.elem))) {
- LOG(ERROR) << "src URL " << req.params.find("src")->second << " is relative with no base URI set for interpreter";
- return;
- }
-
- _sources[req.sendid] = new OpenALSource();
- _sources[req.sendid]->loop = req.params.find("loop") != req.params.end() && iequals(req.params.find("loop")->second.atom, "true");
- _sources[req.sendid]->file = srcURL;
-#ifdef LIBSNDFILE_FOUND
- _sources[req.sendid]->transform = new LibSoundFile(srcURL.asLocalFile(".audio"));
-#else
-# ifdef AUDIOTOOLBOX_FOUND
- _sources[req.sendid]->transform = new AudioToolbox(srcURL.asLocalFile(".audio"));
-# endif
-#endif
- if (_sources[req.sendid]->transform == NULL) {
- LOG(ERROR) << "No transcoder for input file known - install libsndfile or AudioToolbox";
- _sources.erase(req.sendid);
- return;
- }
-
- // force mono format to ensure actual spatial audio
- PCMFormat format = _sources[req.sendid]->transform->getInFormat();
- format.alFormat = AL_FORMAT_MONO16;
- _sources[req.sendid]->transform->setOutFormat(format);
-
- try {
- _sources[req.sendid]->player = new OpenALPlayer(_alContext, NULL, format.alFormat, format.sampleRate);
- } catch (std::exception ex) {
- returnErrorExecution(ex.what());
- return;
- }
-
- getPosFromParams(req.params, _sources[req.sendid]->pos);
-
- _sources[req.sendid]->pos[0] -= _listenerPos[0];
- _sources[req.sendid]->pos[1] -= _listenerPos[1];
- _sources[req.sendid]->pos[2] -= _listenerPos[2];
- try {
- _sources[req.sendid]->player->setPosition(_sources[req.sendid]->pos);
-
- } catch (std::exception ex) {
- returnErrorExecution(ex.what());
- }
-
- _sourcesAvailable.notify_all();
- }
-
- if (iequals(req.name, "move.source")) {
- std::string sourceId;
- if (req.params.find("source") == req.params.end()) {
- LOG(WARNING) << "Cannot move source with no source given in parameters";
- return;
- }
- sourceId = req.params.find("source")->second.atom;
-
- if (_sources.find(sourceId) == _sources.end()) {
- LOG(WARNING) << "Given source '" << sourceId << "' not active or not existing";
- return;
- }
-
- getPosFromParams(req.params, _sources[sourceId]->pos);
- try {
- _sources[sourceId]->player->setPosition(_sources[sourceId]->pos);
- } catch (std::exception ex) {
- returnErrorExecution(ex.what());
- }
- }
-
- if (iequals(req.name, "move.listener")) {
- getPosFromParams(req.params, _listenerPos);
-
- try {
- alcMakeContextCurrent(_alContext);
- alListenerfv(AL_POSITION, _listenerPos);
- OpenALPlayer::checkOpenALError(__LINE__);
- } catch (std::exception ex) {
- returnErrorExecution(ex.what());
- }
- }
-
-}
-
-void OpenALInvoker::start() {
- _isStarted = true;
- _thread = new tthread::thread(&OpenALInvoker::fillBuffers, this);
-}
-
-void OpenALInvoker::fillBuffers(void* userdata) {
- OpenALInvoker* INST = (OpenALInvoker*)userdata;
- while(INST->_isStarted) {
- // do nothing until we have at least one source
- int waitMs = std::numeric_limits<int>::max();
- INST->_mutex.lock();
- while (INST->_sources.size() == 0 && INST->_isStarted) {
- INST->_sourcesAvailable.wait(INST->_mutex);
- }
-
- if (!INST->_isStarted)
- return;
-
- // here we are with at least one source and a locked mutex
- assert(INST->_sources.size() > 0);
-
- std::map<std::string, OpenALSource*>::iterator srcIter = INST->_sources.begin();
- while(srcIter != INST->_sources.end()) {
- OpenALSource* src = srcIter->second;
- int wait = std::numeric_limits<int>::max();
-
- if (src->finished) {
- // source has already finished playing, feed no more samples to it
- try {
- wait = src->player->isPlaying();
- if (wait == 0) {
- // source stopped playing, delete it
- INST->notifyOfEnd(src);
- delete src;
- INST->_sources.erase(srcIter++);
- continue;
- } else {
- // source returned time when to repoll
- assert(wait > 0);
- }
- } catch (std::exception ex) {
- INST->returnErrorExecution(ex.what());
- delete src;
- INST->_sources.erase(srcIter++);
- continue;
- }
- } else {
- // source still needs more samples or play existing buffer
- if (src->written == src->read) {
- // all read samples have been written, read some more
- src->written = 0;
- src->read = src->transform->read(src->buffer, ALPLAY_AUDIO_BUFFER_SIZE);
- if (src->read < ALPLAY_AUDIO_BUFFER_SIZE) {
- if (src->loop) {
- INST->notifyOfLoop(src);
- while (src->read < ALPLAY_AUDIO_BUFFER_SIZE) {
- src->transform->seek(0);
- src->read += src->transform->read(src->buffer + src->read, ALPLAY_AUDIO_BUFFER_SIZE - src->read);
- }
- } else {
- src->finished = true;
- memset(src->buffer + src->read, 0, ALPLAY_AUDIO_BUFFER_SIZE - src->read);
- }
- }
- }
-
- // there are unwritten samples in the buffer
- if (src->read != src->written) {
- try {
- int written = src->player->write(src->buffer, ALPLAY_AUDIO_BUFFER_SIZE, &wait);
- if (written >=0 ) {
- src->written += written;
- }
- } catch (std::exception ex) {
- INST->returnErrorExecution(ex.what());
- src->finished = true;
- }
- } else {
- assert(src->finished);
- }
- }
-
- waitMs = (wait < waitMs ? wait : waitMs);
- srcIter++;
- }
-
-// std::cout << "W" << waitMs << ".";
-
- INST->_mutex.unlock();
- if (waitMs < std::numeric_limits<int>::max())
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(waitMs));
- }
-}
-
-void OpenALInvoker::cancel(const std::string sendId) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
-}
-
-void OpenALInvoker::invoke(const InvokeRequest& req) {
- _alDevice = alcOpenDevice(NULL);
- if (_alDevice == NULL) {
- throw std::string("__FILE__ __LINE__ openal error opening device");
- }
-
- std::multimap<std::string, Data>::const_iterator paramIter = req.params.begin();
- while(paramIter != req.params.end()) {
- if (iequals(paramIter->first, "maxX"))
- _maxPos[0] = strTo<float>(paramIter->second.atom);
- if (iequals(paramIter->first, "maxY"))
- _maxPos[1] = strTo<float>(paramIter->second.atom);
- if (iequals(paramIter->first, "maxZ"))
- _maxPos[2] = strTo<float>(paramIter->second.atom);
- paramIter++;
- }
-
- // create new context with device
- _alContext = alcCreateContext (_alDevice, NULL);
- if (_alContext == NULL) {
- alcCloseDevice (_alDevice);
- throw std::string("openal error create context");
- }
-
-// std::cout << boost::lexical_cast<std::string>(_alContext);
-// std::cout << boost::lexical_cast<std::string>(_alDevice);
-
- alcMakeContextCurrent(_alContext);
-// float listener[3] = {0,0,0};
-// alListenerfv(AL_POSITION, listener);
-
- alcMakeContextCurrent(_alContext);
- alListenerfv(AL_POSITION, _listenerPos);
- alListenerfv(AL_VELOCITY, _listenerVel);
- alListenerfv(AL_ORIENTATION, _listenerOrient);
-
- alListenerf(AL_GAIN, 0.5);
-
- start();
-}
-
-void OpenALInvoker::notifyOfEnd(OpenALSource* src) {
- Event ev;
- ev.name = "audio.end";
- ev.data.compound["file"] = src->file;
- returnEvent(ev);
-}
-
-void OpenALInvoker::notifyOfLoop(OpenALSource* src) {
- Event ev;
- ev.name = "audio.loop";
- ev.data.compound["file"] = src->file;
- returnEvent(ev);
-}
-
-void OpenALInvoker::getPosFromParams(const std::multimap<std::string, Data>& params, float* position) {
- // vector explicitly given
- try {
- if (params.find("x") != params.end())
- position[0] = boost::lexical_cast<float>(params.find("x")->second);
- if (params.find("y") != params.end())
- position[1] = boost::lexical_cast<float>(params.find("y")->second);
- if (params.find("z") != params.end())
- position[2] = boost::lexical_cast<float>(params.find("z")->second);
- } catch (boost::bad_lexical_cast& e) {
- LOG(ERROR) << "Cannot interpret x, y or z as float value in params: " << e.what();
- }
-
- try {
- // right is an alias for x
- if (params.find("right") != params.end())
- position[0] = boost::lexical_cast<float>(params.find("right")->second);
- // height is an alias for y
- if (params.find("height") != params.end())
- position[1] = boost::lexical_cast<float>(params.find("height")->second);
- // front is an alias for z
- if (params.find("front") != params.end())
- position[2] = boost::lexical_cast<float>(params.find("front")->second);
- } catch (boost::bad_lexical_cast& e) {
- LOG(ERROR) << "Cannot interpret right, height or front as float value in params: " << e.what();
- }
-
- // do we have a position on a circle?
- try {
- if (params.find("circle") != params.end()) {
- float rad = posToRadian(params.find("circle")->second);
- position[0] = cosf(rad);
- position[2] = -1 * sinf(rad); // z axis increases to front
-// position[0] *= 150;
-// position[2] *= 150;
-
- }
- } catch (boost::bad_lexical_cast& e) {
- LOG(ERROR) << "Cannot interpret circle as float value in params: " << e.what();
- }
-
- position[0] = position[0] / _maxPos[0];
- position[1] = position[1] / _maxPos[1];
- position[2] = position[2] / _maxPos[2];
-// std::cout << position[0] << ":" << position[1] << ":" << position[2] << std::endl;
-
-}
-
-float OpenALInvoker::posToRadian(const std::string& pos) {
-
- std::string trimmedPos = boost::trim_copy(pos);
- float rad = 0;
-
- if (trimmedPos.size() > 3 && iequals("deg", trimmedPos.substr(trimmedPos.length() - 3, 3))) {
- rad = boost::lexical_cast<float>(trimmedPos.substr(0, trimmedPos.size() - 3));
- rad = fmodf(rad, 360); // into range [0-360]
- rad /= 180; // into range [0-2]
- rad *= M_PI; // into range [0-2PI]
- rad -= M_PI_2; // 0 to top;
- rad *= -1; // make clockwise
- rad += 2 * M_PI; // make positive
- } else if (trimmedPos.size() > 3 && iequals("rad", trimmedPos.substr(trimmedPos.length() - 3, 3))) {
- rad = boost::lexical_cast<float>(trimmedPos.substr(0, trimmedPos.size() - 3));
- rad = fmodf(rad, M_PI * 2); // into range [0-2*PI]
- } else {
- LOG(ERROR) << "Cannot make sense of position value " << trimmedPos << ": does not end in 'deg', 'rad'";
- }
- return rad;
-}
-
-OpenALSource::OpenALSource() {
- pos[0] = pos[1] = pos[2] = 0;
- player = NULL;
- loop = false;
- finished = false;
- transform = NULL;
- read = written = 0;
- memset(buffer, 0, ALPLAY_AUDIO_BUFFER_SIZE);
-}
-
-OpenALSource::~OpenALSource() {
- if (player)
- delete player;
- if (transform)
- delete transform;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
deleted file mode 100644
index 98524ed..0000000
--- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef OPENALINVOKER_H_W09J90F0
-#define OPENALINVOKER_H_W09J90F0
-
-#include "uscxml/config.h"
-#include <uscxml/Interpreter.h>
-#include "OpenALPlayer.h"
-
-#include "PCMConverter.h"
-#ifdef LIBSNDFILE_FOUND
-# include "LibSoundFile.h"
-#else
-# ifdef AUDIOTOOLBOX_FOUND
-# include "AudioToolbox.h"
-# endif
-#endif
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class OpenALSource {
-public:
- OpenALSource();
- ~OpenALSource();
-
- OpenALPlayer* player;
- char buffer[ALPLAY_AUDIO_BUFFER_SIZE];
- bool loop;
- bool finished;
- int read;
- int written;
- ALfloat pos[3];
- URL file;
- PCMConverter* transform;
-};
-
-class OpenALInvoker : public InvokerImpl {
-public:
- OpenALInvoker();
- virtual ~OpenALInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("openal");
- names.push_back("spatial-audio");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#openal");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
- std::map<std::string, OpenALSource*> _sources;
- ALCcontext* _alContext;
- ALCdevice* _alDevice;
-
- tthread::recursive_mutex _mutex;
- tthread::thread* _thread;
- tthread::condition_variable _sourcesAvailable;
-
- bool _isStarted;
- bool _isRunning;
- ALfloat _listenerPos[3];
- ALfloat _listenerVel[3];
- ALfloat _listenerOrient[6];
- float _maxPos[3];
-
- static void fillBuffers(void* userdata);
- void start();
-
- void notifyOfEnd(OpenALSource*);
- void notifyOfLoop(OpenALSource*);
-
- float posToRadian(const std::string& pos);
- void getPosFromParams(const std::multimap<std::string, Data>& params, float* position);
-
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(OpenALInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: OPENALINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp
deleted file mode 100644
index 3aaeddf..0000000
--- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp
+++ /dev/null
@@ -1,541 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "OpenALPlayer.h"
-#include <assert.h>
-#include <stdexcept>
-
-tthread::recursive_mutex OpenALPlayer::_alMutex;
-
-/**
-* Create a new OpenAL stream source
-*/
-OpenALPlayer::OpenALPlayer(ALCcontext* context, OpenALPlayerCallback* audioCallback, ALenum format, ALsizei freq) {
-
- _isInitialized = false;
- _audioCallback = audioCallback;
- _freq = freq;
- _format = format;
- _bufferSize = 0;
- _nrBuffers = 0;
- _thread = NULL;
- _alId = 0;
-
- _position[0] = _position[1] = _position[2] = 0;
- _velocity[0] = _velocity[1] = _velocity[2] = 0;
- _direction[0] = _direction[1] = _direction[2] = 0;
-
- tthread::lock_guard<tthread::recursive_mutex> lock(_alMutex);
- if (context == NULL) {
- // this is in essence alutInit() from freealut.
-
- // use the current context if there is one
- _context = alcGetCurrentContext();
-
- if (_context == NULL) {
-// std::cout << "\tnew context" << std::endl;
- // create a new context if none was given and no is current
-
- // get default device
- ALCdevice* device = alcOpenDevice(NULL);
- if (device == NULL) {
- throw std::runtime_error("__FILE__ __LINE__ openal error opening device");
- }
-
- // create new context with device
- _context = alcCreateContext (device, NULL);
- if (_context == NULL) {
- alcCloseDevice (device);
- throw std::runtime_error("openal error create context");
- }
-
- // make context current
- if (!alcMakeContextCurrent (_context)) {
- alcDestroyContext (_context);
- alcCloseDevice (device);
- throw std::runtime_error("openal error make context current");
- }
- } else {
-// std::cout << "\texisting context" << std::endl;
- }
- } else {
-// std::cout << "\tgiven context" << std::endl;
- _context = context;
- }
-}
-
-OpenALPlayer::~OpenALPlayer() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_alMutex);
- if (isPlaying()) {
- alSourceStop(_alId);
- }
- if (_thread) {
- stop();
- _thread->join();
- delete(_thread);
- }
-
- if (_isInitialized) {
- alDeleteSources(1, &_alId);
- if (alIsSource(_alId)) {
- throw std::runtime_error("openal source id still valid");
- }
- for (size_t i = 0; i < _nrBuffers; i++) {
- assert(alIsBuffer(_bufferIds[i]));
- free(_buffers[i]);
- }
- alDeleteBuffers(_nrBuffers, _bufferIds);
- for (size_t i = 0; i < _nrBuffers; i++) {
-// assert(!alIsBuffer(_bufferIds[i]));
- }
- free(_buffers);
- free(_bufferIds);
- }
- // clear errors and begone
- alGetError();
-
-}
-
-/**
-* Allocate; data and set defaults
-*/
-void OpenALPlayer::init() {
- _userData = NULL;
- _pitch = 0;
- _gain = 0;
- _referenceDistance = 1.0;
- _isLooping = false;
-
- // no one set a buffer size yet
- if (_bufferSize <= 0)
- _bufferSize = ALPLAY_AUDIO_BUFFER_SIZE;
-
- // no one set the number of buffers yet
- if (_nrBuffers <= 0)
- _nrBuffers = ALPLAY_NR_AUDIO_BUFFERS;
-
- _isInitialized = true;
-
- _buffers = (char**)malloc(_nrBuffers * sizeof(char*));
- _bufferIds = (ALuint*)malloc(_nrBuffers * sizeof(ALuint));
- for (size_t i = 0; i < _nrBuffers; i++) {
- _buffers[i] = 0; //(char*)malloc(_bufferSize);
- }
-
- // there are other formats as well and this will have to be extended
- int bytesPerSample = 2;
- switch(_format) {
- case AL_FORMAT_MONO8:
- case AL_FORMAT_STEREO8:
- bytesPerSample = 1;
- break;
-
- case AL_FORMAT_MONO16:
- case AL_FORMAT_STEREO16:
- bytesPerSample = 2;
- break;
- }
-
- // how many ms audio is in one buffer?
- _msForBuffer = (int)(((float)_bufferSize / (float)bytesPerSample) / ((float)_freq / 1000.0f));
- _initialSleep = (_msForBuffer - (int)(0.6 * _msForBuffer)) * _nrBuffers;
- _bufferSleep = _msForBuffer - (int)(0.4 * _msForBuffer);
- _repollSleep = _msForBuffer - (int)(0.7 * _msForBuffer);
-
-// std::cout << _msForBuffer << "ms in one buffer" << std::endl;
-
- // get available buffer ids
- tthread::lock_guard<tthread::recursive_mutex> lock(_alMutex);
-
- if (!alcMakeContextCurrent (_context)) {
- throw std::runtime_error("openal error make context current");
- }
-
- alGenBuffers(_nrBuffers, _bufferIds);
- checkOpenALError(__LINE__);
-
- // get new source id from openAL
- alGenSources(1, &_alId);
-
- checkOpenALError(__LINE__);
- if (!alIsSource(_alId)) {
- throw std::runtime_error("openal source id not valid");
- }
-
- // set our position and various flags to meaningful defaults
- alSourcei (_alId, AL_SOURCE_RELATIVE, AL_TRUE);
- checkOpenALError(__LINE__);
- alSourcei(_alId, AL_LOOPING, AL_FALSE);
- checkOpenALError(__LINE__);
- alSourcefv(_alId, AL_POSITION, _position);
- checkOpenALError(__LINE__);
-// alSourcef(_alId,AL_REFERENCE_DISTANCE, 5.0f);
-// checkOpenALError(__LINE__);
- alDistanceModel(AL_LINEAR_DISTANCE);
- checkOpenALError(__LINE__);
- alSourcefv(_alId, AL_VELOCITY, _velocity);
- checkOpenALError(__LINE__);
- alSourcefv(_alId, AL_DIRECTION, _direction);
- checkOpenALError(__LINE__);
-// alSourcef (_alId, AL_ROLLOFF_FACTOR, 1.0);
-// checkOpenALError(__LINE__);
-// alSourcef(_alId,AL_REFERENCE_DISTANCE, 5.0f);
-// checkOpenALError(__LINE__);
-// float listener[] = { 0.0, 0.0, 0.0 };
-// alListenerfv(AL_POSITION, listener);
-// checkOpenALError(__LINE__);
-}
-
-/**
-* Start the sound source.
-*
-* This will trigger continuous calls top the audio callback.
-*/
-void OpenALPlayer::start() {
- if (!_isInitialized)
- init();
-
- if (_audioCallback == NULL)
- throw std::runtime_error("cannot start without an audio callback");
-
- _isStarted = true;
-
- // prime the buffers with some initial data and register for buffer ids
- tthread::lock_guard<tthread::recursive_mutex> lock(_alMutex);
- for (ALuint i = 0; i < (unsigned int)_nrBuffers; i++) {
- _buffers[i] = (char*)malloc(_bufferSize);
- _audioCallback->getSamples(_buffers[i], _bufferSize, this);
- alBufferData(_bufferIds[i], _format, _buffers[i], _bufferSize, _freq);
- checkOpenALError(__LINE__);
- }
- // enqueue all buffers
- alSourceQueueBuffers(_alId, _nrBuffers, _bufferIds);
- checkOpenALError(__LINE__);
-
- // start thread
- if (_audioCallback != NULL) {
- _thread = new tthread::thread(&OpenALPlayer::updateBuffersWrapper, this);
- }
-
- // tell openAL to start rendering the buffers
- alSourcePlay(_alId);
- checkOpenALError(__LINE__);
-}
-
-// find bufferId in _bufferIds to get bufferIndex into _buffers - messy
-int OpenALPlayer::bufferIndex(int bufferId) {
- int bufferIndex = 0;
- for (; bufferIndex < _nrBuffers; bufferIndex++) {
- if (_bufferIds[bufferIndex] == (unsigned int)bufferId)
- break;
- }
- if (bufferIndex >= _nrBuffers)
- throw std::runtime_error("could not find dequeued bufferId in ids");
- return bufferIndex;
-}
-
-/**
-* Write a buffer (blocking).
-*
-* This allows for a pushing model, whereas the callback allows for a polling model.
-*/
-int OpenALPlayer::write(char* buffer, int size, int* repollAt, bool blocking) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_alMutex);
-
- if (!_isInitialized)
- init();
-
- if (_audioCallback != NULL) {
- throw std::runtime_error("you cannot use the write interface with an audio callback");
- }
-
- if (size != _bufferSize) {
- throw std::runtime_error("buffersize does not match");
- }
-
- if (!alcMakeContextCurrent (_context)) {
- throw std::runtime_error("openal error make context current");
- }
-
- // try to enqueue the given buffer data
- for (;;) {
- // do we have an empty buffer in the OpenAL queue?
- int processed;
- alGetSourcei(_alId, AL_BUFFERS_PROCESSED, &processed);
- checkOpenALError(__LINE__);
-
-// if (!isPlaying())
-// std::cout << "-";
-
- if (processed > 0) {
-// std::cout << "P" << processed;
- ALuint bufferId = 0;
- alSourceUnqueueBuffers(_alId, 1, &bufferId);
- checkOpenALError(__LINE__);
-
- int bufferIdx = bufferIndex(bufferId);
-
- // fill the buffer with the given data
- memcpy(_buffers[bufferIdx], buffer, _bufferSize);
- alBufferData(bufferId, _format, _buffers[bufferIdx], _bufferSize, _freq);
- checkOpenALError(__LINE__);
-
- // enqueue
- alSourceQueueBuffers(_alId, 1, &bufferId);
- checkOpenALError(__LINE__);
-
- // some buffers were processed
- if (repollAt)
- *repollAt = _repollSleep;
- break;
-
- } else {
- // no buffer processed - is there an uninitialized buffer left?
- int nextBuffer = 0;
- for(; nextBuffer < _nrBuffers; nextBuffer++) {
- if (_buffers[nextBuffer] == 0) {
- break;
- }
- }
- if (nextBuffer < _nrBuffers) {
-// std::cout << "N";
- _buffers[nextBuffer] = (char*)malloc(_bufferSize);
- memcpy(_buffers[nextBuffer], buffer, _bufferSize);
-
- alBufferData(_bufferIds[nextBuffer], _format, _buffers[nextBuffer], _bufferSize, _freq);
- checkOpenALError(__LINE__);
-
- alSourceQueueBuffers(_alId, 1, &_bufferIds[nextBuffer]);
- checkOpenALError(__LINE__);
- // there was a free buffer, repoll immediately to try to write more
- if (repollAt)
- *repollAt = 0;
-
- break;
- } else {
-// std::cout << "X";
- // no processed, no new buffer, wait until we processed one
- if (blocking) {
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(_repollSleep));
- } else {
- if (repollAt)
- *repollAt = _repollSleep;
- return -1;
- }
- }
- }
- }
-
- // we have at least one buffer queued, start playing
- if (!_isStarted || !isPlaying()) {
- alSourcePlay(_alId);
- checkOpenALError(__LINE__);
- _isStarted = true;
- }
-
- return size;
-}
-
-
-/**
-* Dequeue, refill and re-enqueue buffers.
-*/
-void OpenALPlayer::updateBuffers() {
- int processed;
-// int queued;
-
-// std::cout << "Initial sleep: " << initialSleep << "ms" << std::endl;
-// std::cout << "Buffer sleep: " << bufferSleep << "ms" << std::endl;
-// std::cout << "Repoll sleep: " << repollSleep << "ms" << std::endl;
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(_bufferSleep * _initialSleep));
-
-
- while(_isStarted) {
-
- // how many buffers have been rendered already?
- tthread::lock_guard<tthread::recursive_mutex> lock(_alMutex);
- alGetSourcei(_alId, AL_BUFFERS_PROCESSED, &processed);
- checkOpenALError(__LINE__);
- //std::cout << processed << std::flush;
-
- if (processed == 0) {
- // avoid busy wait by sleeping
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(_bufferSleep * _initialSleep));
- } else {
- // dequeue buffers and get ids
- // see http://stackoverflow.com/questions/1900665/c-compiler-differences-vs2008-and-g
- ALuint bufferIds[ALPLAY_NR_AUDIO_BUFFERS];
- alSourceUnqueueBuffers(_alId, processed, bufferIds);
- checkOpenALError(__LINE__);
-
- for (size_t id = 0; id < processed; id++) {
- int bufferIdx = bufferIndex(bufferIds[id]);
-
- // refill the buffer with data from the callback
- _audioCallback->getSamples(_buffers[bufferIdx], _bufferSize, this);
- alBufferData(bufferIds[id], _format, _buffers[bufferIdx], _bufferSize, _freq);
- checkOpenALError(__LINE__);
-
- }
- // re-enqueue
- alSourceQueueBuffers(_alId, processed, bufferIds);
- checkOpenALError(__LINE__);
-
- // restart if we are not running anymore
- if (!isPlaying()) {
- alSourcePlay(_alId);
- checkOpenALError(__LINE__);
- }
-
- // sleep a bit less than the duration of one buffer
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(_bufferSleep * processed));
- }
- }
-}
-
-/**
-* TODO
-*/
-void OpenALPlayer::stop() {
- _isStarted = false;
- _thread->join();
-}
-
-void OpenALPlayer::checkOpenALError(int line) {
- int error = alGetError();
- if(error != AL_NO_ERROR) {
- std::stringstream out;
- out << "OpenALError:" << line << ":";
-
- switch (error) {
- case AL_INVALID_NAME:
- out << "OpenAL invalid name.";
- break;
- case AL_INVALID_ENUM:
- out << "OpenAL invalid enum.";
- break;
- case AL_INVALID_VALUE:
- out << "OpenAL invalid value.";
- break;
- case AL_INVALID_OPERATION:
- out << "OpenAL invalid operation.";
- break;
- case AL_OUT_OF_MEMORY:
- out << "OpenAL out of memory.";
- break;
-
- default:
- out << "OpenAL unknown error.";
- break;
- }
- throw std::runtime_error(out.str());
- }
-}
-
-unsigned int OpenALPlayer::isPlaying() {
- ALint val;
- alGetSourcei(_alId, AL_SOURCE_STATE, &val);
- if(val != AL_PLAYING)
- return 0;
- return _repollSleep;
-}
-
-void OpenALPlayer::updateBuffersWrapper(void *obj) {
- try {
- reinterpret_cast<OpenALPlayer *>(obj)->updateBuffers();
- } catch(std::runtime_error& error) {
-// std::cout << "Terminating Thread: " << error << std::endl;
- } catch(...) {
-// std::cout << "Terminating Thread! " << std::endl;
- }
-}
-
-void OpenALPlayer::setNrBuffers(int nrBuffers) {
- if (_nrBuffers > 0)
- throw std::runtime_error("cannot modify number of buffers");
- _nrBuffers = nrBuffers;
-}
-
-int OpenALPlayer::getNrBuffers() {
- return _nrBuffers;
-}
-
-/**
-* Set position of sound source in coordinate system
-*/
-void OpenALPlayer::setPosition(ALfloat position[]) {
- memcpy(&_position, position, 3 * sizeof(ALfloat));
-// std::cout << _position[0] << ", " << _position[1] << ", " << _position[2] << std::endl;
- if (_isInitialized)
- alSourcefv(_alId, AL_POSITION, _position);
-}
-
-ALfloat* OpenALPlayer::getPosition() {
- return _position;
-}
-
-/**
-* Set velocity of sound source in coordinate system
-*/
-void OpenALPlayer::setVelocity(ALfloat velocity[]) {
- memcpy(&_velocity, velocity, 3 * sizeof(ALfloat));
- if (_isInitialized)
- alSourcefv(_alId, AL_VELOCITY, _velocity);
-}
-
-ALfloat* OpenALPlayer::getVelocity() {
- return _velocity;
-}
-
-/**
-* Set direction of sound source in coordinate system
-*/
-void OpenALPlayer::setDirection(ALfloat direction[]) {
- memcpy(&_direction, direction, 3 * sizeof(ALfloat));
- if (_isInitialized)
- alSourcefv(_alId, AL_DIRECTION, _direction);
-}
-
-ALfloat* OpenALPlayer::getDirection() {
- return _direction;
-}
-
-void OpenALPlayer::setBufferSize(int bufferSize) {
- if (_bufferSize > 0)
- throw std::runtime_error("cannot modify buffersize");
- _bufferSize = bufferSize;
-}
-
-int OpenALPlayer::getBufferSize() {
- return _bufferSize;
-}
-
-OpenALPlayerCallback* OpenALPlayer::getCallback() {
- return _audioCallback;
-}
-void OpenALPlayer::setCallback(OpenALPlayerCallback* callback) {
- _audioCallback = callback;
-}
-
-void* OpenALPlayer::getUserData() {
- return _userData;
-}
-void OpenALPlayer::setUserData(void* userData) {
- _userData = userData;
-}
diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.h b/src/uscxml/plugins/invoker/audio/OpenALPlayer.h
deleted file mode 100644
index db883a0..0000000
--- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef OPENALPLAYER_H_3PORVJDU
-#define OPENALPLAYER_H_3PORVJDU
-
-#include <iostream>
-#include <string.h>
-#include <stdlib.h>
-#include <sstream>
-#include <uscxml/concurrency/tinythread.h>
-
-#include <al.h>
-#include <alc.h>
-
-// sometimes the stream drops if this is less than 5000 bytes
-#define ALPLAY_NR_AUDIO_BUFFERS 3
-#define ALPLAY_AUDIO_BUFFER_SIZE 2048
-//#define ALPLAYER_FORMAT_MONO16 0x1101
-
-class OpenALPlayer;
-
-class OpenALPlayerCallback {
-public:
- virtual ~OpenALPlayerCallback() {}
- /*
- * Returning an OpenALPlayerCallback is a hack to be able to provide a typemap for SWIG.
- * We cannot use SWIG directors with byte arrays otherwise. Posted to swig-ML already.
- */
- virtual OpenALPlayerCallback* getSamples(char* buffer, int size, OpenALPlayer* player) = 0;
-};
-
-class OpenALPlayer {
-private:
- ALCcontext* _context;
-
- ALuint _alId;
- ALfloat _position[3];
- ALfloat _velocity[3];
- ALfloat _direction[3];
- ALfloat _pitch;
- ALfloat _gain;
- ALfloat _referenceDistance;
- ALboolean _isLooping;
-
- // OpenAL is not really thread safe
- static tthread::recursive_mutex _alMutex;
-
- ALenum _format;
- ALsizei _freq;
- int _msForBuffer;
- int _initialSleep;
- int _bufferSleep;
- int _repollSleep;
-
- int _bufferSize;
- int _nrBuffers;
- ALuint* _bufferIds;
- char** _buffers;
- OpenALPlayerCallback* _audioCallback;
- void* _userData;
-
- tthread::thread* _thread;
- bool _isStarted;
- bool _isInitialized;
-
- void updateBuffers();
- void init();
-
- // static wrapper as an entry point for pthreads
- static void updateBuffersWrapper(void *obj);
-
- // get the index in _buffers for a buffer ID
- int inline bufferIndex(int bufferId);
-
-public:
- OpenALPlayer(ALCcontext*, OpenALPlayerCallback*, ALenum, ALsizei);
- virtual ~OpenALPlayer();
-
- unsigned int isPlaying();
- static void checkOpenALError(int line);
-
- ALfloat* getPosition();
- void setPosition(ALfloat[3]);
- ALfloat* getVelocity();
- void setVelocity(ALfloat[3]);
- ALfloat* getDirection();
- void setDirection(ALfloat[3]);
-
- void setBufferSize(int bufferSize);
- int getBufferSize();
- void setNrBuffers(int nrBuffers);
- int getNrBuffers();
-
- // callback interface for pull
- OpenALPlayerCallback* getCallback();
- void setCallback(OpenALPlayerCallback* callback);
-
- // stream interface for push
- int write(char* buffer, int size, int* repollAt, bool blocking = false);
-
- void* getUserData();
- void setUserData(void* userData);
-
- void start();
- void stop();
-};
-
-#endif /* end of include guard: OPENALPLAYER_H_3PORVJDU */
diff --git a/src/uscxml/plugins/invoker/audio/PCMConverter.h b/src/uscxml/plugins/invoker/audio/PCMConverter.h
deleted file mode 100644
index 1984600..0000000
--- a/src/uscxml/plugins/invoker/audio/PCMConverter.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef PCMCONVERTER_H_97Z8U7PA
-#define PCMCONVERTER_H_97Z8U7PA
-
-#include <string>
-#include <al.h>
-#include <alc.h>
-
-namespace uscxml {
-
-struct PCMFormat {
- ALenum alFormat;
- unsigned int sampleRate;
-};
-
-class PCMConverter {
-public:
- PCMConverter(const std::string filename) {}
- virtual ~PCMConverter() {}
- virtual void seek(unsigned int pos) = 0;
- virtual int read(char* buffer, unsigned int size) = 0;
-
- virtual void setOutFormat(const PCMFormat& format) = 0;
- virtual PCMFormat getInFormat() = 0;
-protected:
- PCMConverter() {}
-};
-
-}
-
-#endif /* end of include guard: PCMCONVERTER_H_97Z8U7PA */
diff --git a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp
deleted file mode 100644
index 8a4ea3d..0000000
--- a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp
+++ /dev/null
@@ -1,651 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "CalendarInvoker.h"
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new CalendarInvokerProvider() );
- return true;
-}
-#endif
-
-CalendarInvoker::CalendarInvoker() {
- _icalSet = NULL;
- _icalComp = NULL;
-}
-
-CalendarInvoker::~CalendarInvoker() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::set<std::string>::iterator _eventIdIter = _eventIds.begin();
- while(_eventIdIter != _eventIds.end()) {
- _interpreter->getDelayQueue()->cancelEvent(*_eventIdIter);
- _eventIds.erase(_eventIdIter++);
-
- }
-
- std::map<std::string, CalendarEvent*>::iterator eventIter = _events.begin();
- while(eventIter != _events.end()) {
- delete eventIter->second;
- eventIter++;
- }
-
- if (_icalComp)
- icalcomponent_free(_icalComp);
-};
-
-boost::shared_ptr<InvokerImpl> CalendarInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<CalendarInvoker> invoker = boost::shared_ptr<CalendarInvoker>(new CalendarInvoker());
- invoker->_interpreter = interpreter;
-
- icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL);
-
-// invoker->_calFile = URL::tmpFile();
-// invoker->_icalSet = icalfileset_new(invoker->_calFile.c_str());
-
-// if (!invoker->_icalSet) {
-// LOG(WARNING) << "Could not create new ical fileset: " << icalerror_perror();
-// }
-
- return invoker;
-}
-
-Data CalendarInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void CalendarInvoker::send(const SendRequest& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-}
-
-void CalendarInvoker::cancel(const std::string sendId) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::set<std::string>::iterator _eventIdIter = _eventIds.begin();
- while(_eventIdIter != _eventIds.end()) {
- _interpreter->getDelayQueue()->cancelEvent(*_eventIdIter);
- _eventIds.erase(_eventIdIter++);
- }
-}
-
-void CalendarInvoker::invoke(const InvokeRequest& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- _icalComp = addIcal(req.content);
-// dumpComponent(_icalComp);
- setupEvents(_icalComp);
-
-}
-
-icalcomponent* CalendarInvoker::addIcal(const std::string& icalString) {
-
- icalcomponent* root = icalparser_parse_string(icalString.c_str());
- if (!root) {
- LOG(WARNING) << "Could not parse ical data: " << icalerror_perror();
- return NULL;
- }
-// icalerrorenum err;
-// err = icalset_add_component(_icalSet, root);
-// icalfileset_commit(_icalSet);
-
- return root;
-}
-
-void CalendarInvoker::setupEvents(icalcomponent* comp) {
-// dumpComponent(comp);
-
- switch (icalcomponent_isa(comp)) {
- case ICAL_VCALENDAR_COMPONENT:
- case ICAL_XROOT_COMPONENT:
- break;
- case ICAL_VALARM_COMPONENT: {
- break;
- }
- case ICAL_VEVENT_COMPONENT: {
- // event to map
- CalendarEvent* event = new CalendarEvent(comp);
- _events[toStr((uintptr_t)event)] = event;
- queueEvent(event);
- break;
- }
- default:
-// dumpComponent(comp);
- break;
- }
-
- icalcomponent* child = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
- while(child) {
- setupEvents(child);
- child = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT);
- }
-
-}
-
-void CalendarInvoker::queueEvent(CalendarEvent* event) {
- if (_events.find(toStr((uintptr_t)event)) == _events.end()) {
- _events[toStr((uintptr_t)event)] = event;
- }
- time_t now = time(NULL);
- struct icaltime_span span;
-
- if (event->_nextSpan.start > 0) {
- span = event->getNextDuration(event->_nextSpan.start + 1);
- } else {
- span = event->getNextDuration(now);
- }
-
-#if 0
- if (span.end > 0) {
- std::cout << "\t\t" << ctime(&span.start);
- std::cout << "\t\t" << ctime(&span.end);
- span = event->getNextDuration(span.end);
- }
-#endif
-
- if (span.start <= 0 || span.end <= 0) {
- event->_nextSpan.start = 0;
- event->_nextSpan.end = 0;
- return;
- }
-
- int beginSecs = span.start - now;
- int endSecs = span.end - now;
-
- if (beginSecs > endSecs) {
- LOG(WARNING) << "Event ends before it starts";
- return;
- }
-
- event->_nextSpan = span;
-
- std::string beginEventId = event->getId() + "." + toStr(span.start) + ".started";
- std::string endEventId = event->getId() + "." + toStr(span.end) + ".ended";
-
-#if 0
- beginSecs = 1;
- endSecs = 2;
-#endif
- if (beginSecs > 0) {
- _interpreter->getDelayQueue()->addEvent(beginEventId, CalendarInvoker::raiseEvent, beginSecs * 1000, this);
- _eventIds.insert(beginEventId);
- } else {
- raiseEvent(this, beginEventId);
- }
- _interpreter->getDelayQueue()->addEvent(endEventId, CalendarInvoker::raiseEvent, endSecs * 1000, this);
- _eventIds.insert(endEventId);
-
-}
-
-void CalendarInvoker::raiseEvent(void* userdata, const std::string eventId) {
- CalendarInvoker* INSTANCE = (CalendarInvoker*)userdata;
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
-
- std::string address = eventId.substr(0, eventId.find_first_of("."));
-
- if (INSTANCE->_events.find(address) == INSTANCE->_events.end()) {
- LOG(WARNING) << "No such event: " << eventId;
- return;
- }
-
- if(INSTANCE->_eventIds.find(eventId) != INSTANCE->_eventIds.end()) {
- INSTANCE->_eventIds.erase(eventId);
- }
-
- CalendarEvent* calEvent = INSTANCE->_events[address];
- Event event;
-
- event.data = *calEvent;
- if (boost::ends_with(eventId, ".started")) {
- event.name = "event.started." + calEvent->getId();
- assert(!calEvent->_active);
- calEvent->_active = true;
- } else {
- event.name = "event.ended." + calEvent->getId();
- assert(calEvent->_active);
- calEvent->_active = false;
- }
- INSTANCE->returnEvent(event);
-
- // event ended, reschedule next event
- if (boost::ends_with(eventId, ".ended"))
- INSTANCE->queueEvent(calEvent);
-}
-
-/**
- * Get the next duration for this event starting no earlier
- * than the given time.
- */
-icaltime_span CalendarEvent::getNextDuration(time_t time) {
- if (!_icalComp)
- return icaltime_span_new(icaltime_null_time(), icaltime_null_time(), 0);
-
- // see icalcomponent_foreach_recurrence
- icalproperty *rrule;
-
- icaltimetype calTime = icaltime_from_timet_with_zone(time, 0, 0);
-
- // actual occurence, without reocurrence
- if (!icalproperty_recurrence_is_excluded(_icalComp, &_dtstart, &_dtend)) {
- if (icaltime_compare(_dtstart, calTime) >= 0) {
- // start is still in the future
- return icaltime_span_new(_dtstart, _dtend, 0);
- }
- }
-
- icaltime_span recDur = icaltime_span_new(icaltime_null_time(), icaltime_null_time(), 0);
-
- // iterate all rrules
- for (rrule = icalcomponent_get_first_property(_icalComp, ICAL_RRULE_PROPERTY);
- rrule != NULL;
- rrule = icalcomponent_get_next_property(_icalComp, ICAL_RRULE_PROPERTY)) {
-
- struct icalrecurrencetype recurType = icalproperty_get_rrule(rrule);
- icalrecur_iterator *ritr;
- struct icaltimetype rtime;
-
- // do we have an old iterator that has not yet passed time?
- if (_recIters.find(rrule) != _recIters.end()) {
- if (_recIters[rrule].second > time) {
- icalrecur_iterator_free(_recIters[rrule].first);
- _recIters[rrule].first = icalrecur_iterator_new(recurType, _dtstart);
-
- // skip initial non-reoccurence
- if(_recIters[rrule].first)
- rtime = icalrecur_iterator_next(_recIters[rrule].first);
-
- }
- ritr = _recIters[rrule].first;
- } else {
- // create a new iterator for this rrule
- _recIters[rrule] = std::make_pair(icalrecur_iterator_new(recurType, _dtstart), 0);
- ritr = _recIters[rrule].first;
- }
-
-// std::cout << icalrecurrencetype_as_string(&recurType) << std::endl;
-
- while (ritr) {
- rtime = icalrecur_iterator_next(ritr);
-
-#if 0
- time_t tt = icaltime_as_timet(rtime);
- std::cout << "\t\t" << ctime(&tt);
-#endif
-
- if (icaltime_is_null_time(rtime)) {
- // remove iterator
- icalrecur_iterator_free(_recIters[rrule].first);
- _recIters.erase(rrule);
- break; // for next rule
- }
- _recIters[rrule].second = icaltime_as_timet(rtime);
-
- if (icaltime_compare(rtime, calTime) < 0)
- continue; // until we are after given time
-
- if (icalproperty_recurrence_is_excluded(_icalComp, &_dtstart, &rtime))
- continue;
-
- icaltime_span thisDur = icaltime_span_new(rtime, rtime, 1);
- thisDur.end += _dtduration;
-
- if (recDur.start == 0 || thisDur.start < recDur.start) {
- // update soonest reoccurence with the one from this rule
- recDur = thisDur;
- }
- break; // we are after the event
- }
- }
- return recDur;
-}
-
-CalendarEvent::~CalendarEvent() {
- std::map<icalproperty*, std::pair<icalrecur_iterator*, time_t> >::iterator recItersIter = _recIters.begin();
- while(recItersIter != _recIters.end()) {
- icalrecur_iterator_free(recItersIter->second.first);
- recItersIter++;
- }
-}
-
-CalendarEvent::CalendarEvent(icalcomponent* icalComp) {
- _nextSpan.start = 0;
- _nextSpan.end = 0;
- _icalComp = NULL;
- _active = false;
-
-
- _dtstart = icalcomponent_get_dtstart(icalComp);
- _dtend = icalcomponent_get_dtend(icalComp);
-
- if (!icaltime_is_valid_time(_dtstart)) {
- LOG(WARNING) << "Start of event not a valid time";
- return;
- }
-
- if (!icaltime_is_valid_time(_dtend)) {
- LOG(WARNING) << "End of event not a valid time";
- return;
- }
-
- _dtduration = icaldurationtype_as_int(icaltime_subtract(_dtend, _dtstart));
-
- if (_dtduration <= 0) {
- LOG(WARNING) << "Event has negative or zero duration";
- return;
- }
-
- _icalComp = icalComp;
-
- // initialize all iterators - not really needed anymore
- for (icalproperty* rrule = icalcomponent_get_first_property(_icalComp, ICAL_RRULE_PROPERTY);
- rrule != NULL;
- rrule = icalcomponent_get_next_property(_icalComp, ICAL_RRULE_PROPERTY)) {
-
- struct icalrecurrencetype recurType = icalproperty_get_rrule(rrule);
- icalrecur_iterator *ritr = icalrecur_iterator_new(recurType, _dtstart);
-
- _recIters[rrule] = std::make_pair(ritr, 0);
- }
-
-
-}
-
-CalendarEvent::operator Data() {
- Data data;
- data = CalendarInvoker::toData(_icalComp);
- return data;
-}
-
-Data CalendarInvoker::toData(icalcomponent* comp) {
- Data data;
- data.compound["kind"] = Data(icalcomponent_kind_to_string(icalcomponent_isa(comp)), Data::VERBATIM);
-
- // iterate all properties
- icalproperty* prop = icalcomponent_get_first_property(comp, ICAL_ANY_PROPERTY);
- while(prop) {
- std::string propName = icalproperty_kind_to_string(icalproperty_isa(prop));
- boost::to_lower(propName);
-
-#if 0
- // iterate all parameters
- icalparameter* para = icalproperty_get_first_parameter(prop, ICAL_ANY_PARAMETER);
- while(para) {
- std::string paraName = icalparameter_kind_to_string(icalparameter_isa(para));
-
- switch(icalparameter_get_value(para)) {
- case ICAL_VALUE_X:
- data.compound[propName].compound[paraName] = Data(icalparameter_get_x(para), Data::VERBATIM);
- break;
- case ICAL_VALUE_BOOLEAN:
- case ICAL_VALUE_BINARY:
- case ICAL_VALUE_DATE:
- case ICAL_VALUE_DURATION:
- case ICAL_VALUE_FLOAT:
- case ICAL_VALUE_INTEGER:
- case ICAL_VALUE_PERIOD:
- case ICAL_VALUE_RECUR:
- case ICAL_VALUE_TEXT:
- case ICAL_VALUE_URI:
- case ICAL_VALUE_ERROR:
- case ICAL_VALUE_DATETIME:
- case ICAL_VALUE_UTCOFFSET:
- case ICAL_VALUE_CALADDRESS:
- case ICAL_VALUE_NONE:
- data.compound[propName].compound[paraName] = Data("", Data::VERBATIM);
- break;
- }
-
- para = icalproperty_get_next_parameter(prop, ICAL_ANY_PARAMETER);
- }
- data.compound[propName].compound["value"] = Data(icalproperty_get_value_as_string(prop), Data::VERBATIM);
-#endif
-#if 0
- data.compound[propName] = Data(icalproperty_as_ical_string(prop), Data::VERBATIM);
-#endif
- data.compound[propName] = Data(icalproperty_get_value_as_string(prop), Data::VERBATIM);
-
- prop = icalcomponent_get_next_property(comp, ICAL_ANY_PROPERTY);
- }
-
-
- icalcomponent* child = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
- while(child) {
- data.compound["childs"].array.push_back(toData(child));
- child = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT);
- }
-
- return data;
-}
-
-#if 0
-void CalendarInvoker::dumpComponent(icalcomponent* comp) {
- std::cout << icalcomponent_kind_to_string(icalcomponent_isa(comp)) << std::endl;
-
- struct icaltimetype start, end;
- time_t tt;
-
- icalproperty *startProp = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
- if (startProp) {
- start = icalproperty_get_dtstart(startProp);
- }
-
- icalproperty *endProp = icalcomponent_get_first_property(comp, ICAL_DTEND_PROPERTY);
- if (endProp) {
- end = icalproperty_get_dtend(endProp);
- }
-
- icalproperty *prop = icalcomponent_get_first_property(comp, ICAL_ANY_PROPERTY);
-
- while(prop) {
- std::cout << "\t" << icalproperty_kind_to_string(icalproperty_isa(prop)) << std::endl;
- switch (icalproperty_isa(prop)) {
- case ICAL_ANY_PROPERTY:
- case ICAL_ACKNOWLEDGED_PROPERTY:
- case ICAL_ACTION_PROPERTY:
- case ICAL_ALLOWCONFLICT_PROPERTY:
- case ICAL_ATTACH_PROPERTY:
- case ICAL_ATTENDEE_PROPERTY:
- case ICAL_CALID_PROPERTY:
- case ICAL_CALMASTER_PROPERTY:
- case ICAL_CALSCALE_PROPERTY:
- case ICAL_CAPVERSION_PROPERTY:
- case ICAL_CARLEVEL_PROPERTY:
- case ICAL_CARID_PROPERTY:
- case ICAL_CATEGORIES_PROPERTY:
- case ICAL_CLASS_PROPERTY:
- case ICAL_CMD_PROPERTY:
- case ICAL_COMMENT_PROPERTY:
- case ICAL_COMPLETED_PROPERTY:
- case ICAL_COMPONENTS_PROPERTY:
- case ICAL_CONTACT_PROPERTY:
- case ICAL_CREATED_PROPERTY:
- case ICAL_CSID_PROPERTY:
- case ICAL_DATEMAX_PROPERTY:
- case ICAL_DATEMIN_PROPERTY:
- case ICAL_DECREED_PROPERTY:
- case ICAL_DEFAULTCHARSET_PROPERTY:
- case ICAL_DEFAULTLOCALE_PROPERTY:
- case ICAL_DEFAULTTZID_PROPERTY:
- case ICAL_DEFAULTVCARS_PROPERTY:
- case ICAL_DENY_PROPERTY:
- break;
- case ICAL_DESCRIPTION_PROPERTY:
- std::cout << "\t\t" << icalproperty_get_description(prop) << std::endl;
- break;
- case ICAL_DTEND_PROPERTY: {
- end = icalproperty_get_dtend(prop);
- tt = icaltime_as_timet(start);
- std::cout << "\t\t" << ctime(&tt) << std::endl;
- break;
- }
- case ICAL_DTSTAMP_PROPERTY:
- break;
- case ICAL_DTSTART_PROPERTY: {
- start = icalproperty_get_dtstart(prop);
- tt = icaltime_as_timet(start);
- std::cout << "\t\t" << ctime(&tt) << std::endl;
- break;
- }
- case ICAL_DUE_PROPERTY:
- case ICAL_DURATION_PROPERTY:
- case ICAL_EXDATE_PROPERTY:
- case ICAL_EXPAND_PROPERTY:
- case ICAL_EXRULE_PROPERTY:
- case ICAL_FREEBUSY_PROPERTY:
- case ICAL_GEO_PROPERTY:
- case ICAL_GRANT_PROPERTY:
- case ICAL_ITIPVERSION_PROPERTY:
- case ICAL_LASTMODIFIED_PROPERTY:
- case ICAL_LOCATION_PROPERTY:
- case ICAL_MAXCOMPONENTSIZE_PROPERTY:
- case ICAL_MAXDATE_PROPERTY:
- case ICAL_MAXRESULTS_PROPERTY:
- case ICAL_MAXRESULTSSIZE_PROPERTY:
- case ICAL_METHOD_PROPERTY:
- case ICAL_MINDATE_PROPERTY:
- case ICAL_MULTIPART_PROPERTY:
- case ICAL_NAME_PROPERTY:
- case ICAL_ORGANIZER_PROPERTY:
- case ICAL_OWNER_PROPERTY:
- case ICAL_PERCENTCOMPLETE_PROPERTY:
- case ICAL_PERMISSION_PROPERTY:
- case ICAL_PRIORITY_PROPERTY:
- case ICAL_PRODID_PROPERTY:
- case ICAL_QUERY_PROPERTY:
- case ICAL_QUERYLEVEL_PROPERTY:
- case ICAL_QUERYID_PROPERTY:
- case ICAL_QUERYNAME_PROPERTY:
- case ICAL_RDATE_PROPERTY:
- case ICAL_RECURACCEPTED_PROPERTY:
- case ICAL_RECUREXPAND_PROPERTY:
- case ICAL_RECURLIMIT_PROPERTY:
- case ICAL_RECURRENCEID_PROPERTY:
- case ICAL_RELATEDTO_PROPERTY:
- case ICAL_RELCALID_PROPERTY:
- case ICAL_REPEAT_PROPERTY:
- case ICAL_REQUESTSTATUS_PROPERTY:
- case ICAL_RESOURCES_PROPERTY:
- case ICAL_RESTRICTION_PROPERTY:
- break;
- case ICAL_RRULE_PROPERTY: {
- // struct icaltimetype start = icaltime_from_timet(1,0);
- // struct icaltimetype start = icalproperty_get_dtstart(icalcomponent_get_first_property(comp,ICAL_DTSTART_PROPERTY));
-
- // struct icaltimetype end = icaltime_today();
- struct icalrecurrencetype recur = icalproperty_get_rrule(prop);
- struct icaltimetype next;
-
- icalrecur_iterator* ritr;
- for(ritr = icalrecur_iterator_new(recur,start),
- next = icalrecur_iterator_next(ritr);
- !icaltime_is_null_time(next);
- next = icalrecur_iterator_next(ritr)) {
-
- tt = icaltime_as_timet(next);
- printf(" %s",ctime(&tt ));
-
- }
- icalrecur_iterator_free(ritr);
-
- break;
- }
- case ICAL_SCOPE_PROPERTY:
- case ICAL_SEQUENCE_PROPERTY:
- case ICAL_STATUS_PROPERTY:
- case ICAL_STORESEXPANDED_PROPERTY:
- case ICAL_SUMMARY_PROPERTY:
- case ICAL_TARGET_PROPERTY:
- case ICAL_TRANSP_PROPERTY:
- case ICAL_TRIGGER_PROPERTY:
- case ICAL_TZID_PROPERTY:
- case ICAL_TZNAME_PROPERTY:
- case ICAL_TZOFFSETFROM_PROPERTY:
- case ICAL_TZOFFSETTO_PROPERTY:
- case ICAL_TZURL_PROPERTY:
- case ICAL_UID_PROPERTY:
- case ICAL_URL_PROPERTY:
- case ICAL_VERSION_PROPERTY:
- case ICAL_X_PROPERTY:
- case ICAL_XLICCLASS_PROPERTY:
- case ICAL_XLICCLUSTERCOUNT_PROPERTY:
- case ICAL_XLICERROR_PROPERTY:
- case ICAL_XLICMIMECHARSET_PROPERTY:
- case ICAL_XLICMIMECID_PROPERTY:
- case ICAL_XLICMIMECONTENTTYPE_PROPERTY:
- case ICAL_XLICMIMEENCODING_PROPERTY:
- case ICAL_XLICMIMEFILENAME_PROPERTY:
- case ICAL_XLICMIMEOPTINFO_PROPERTY:
- case ICAL_NO_PROPERTY:
- break;
- }
- prop = icalcomponent_get_next_property(comp, ICAL_ANY_PROPERTY);
- }
-
- switch (icalcomponent_isa(comp)) {
- case ICAL_NO_COMPONENT:
- case ICAL_ANY_COMPONENT:
- break;
- case ICAL_XROOT_COMPONENT: {
- icalcomponent* child = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
- while(child) {
- dumpComponent(child);
- child = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT);
- }
- break;
- }
- case ICAL_XATTACH_COMPONENT:
- case ICAL_VEVENT_COMPONENT:
- case ICAL_VTODO_COMPONENT:
- case ICAL_VJOURNAL_COMPONENT:
- case ICAL_VCALENDAR_COMPONENT:
- case ICAL_VAGENDA_COMPONENT:
- case ICAL_VFREEBUSY_COMPONENT:
- case ICAL_VALARM_COMPONENT:
- case ICAL_XAUDIOALARM_COMPONENT:
- case ICAL_XDISPLAYALARM_COMPONENT:
- case ICAL_XEMAILALARM_COMPONENT:
- case ICAL_XPROCEDUREALARM_COMPONENT:
- case ICAL_VTIMEZONE_COMPONENT:
- case ICAL_XSTANDARD_COMPONENT:
- case ICAL_XDAYLIGHT_COMPONENT:
- case ICAL_X_COMPONENT:
- case ICAL_VSCHEDULE_COMPONENT:
- case ICAL_VQUERY_COMPONENT:
- case ICAL_VREPLY_COMPONENT:
- case ICAL_VCAR_COMPONENT:
- case ICAL_VCOMMAND_COMPONENT:
- case ICAL_XLICINVALID_COMPONENT:
- case ICAL_XLICMIMEPART_COMPONENT:
- break;
- }
-}
-#endif
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h
deleted file mode 100644
index be50575..0000000
--- a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CALENDARINVOKER_H_W09J90F0
-#define CALENDARINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-extern "C" {
-# include <libical/ical.h>
-# include <libical/icalss.h>
-}
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class CalendarEvent {
-public:
- CalendarEvent(icalcomponent* _icalComp);
- ~CalendarEvent();
- icalcomponent* _icalComp;
- icaltime_span _nextSpan;
- bool _active;
- struct icaltimetype _dtstart, _dtend;
- time_t _dtduration;
-
- icaltime_span getNextDuration(time_t time);
- std::string getId() {
- return toStr((uintptr_t)this);
- }
-
- std::map<icalproperty*, std::pair<icalrecur_iterator*, time_t> > _recIters;
- operator Data();
-};
-
-class CalendarInvoker : public InvokerImpl {
-public:
- CalendarInvoker();
- virtual ~CalendarInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("calendar");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#calendar");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
- static void raiseEvent(void* userdata, const std::string eventId);
- static Data toData(icalcomponent* comp);
-protected:
- icalcomponent* addIcal(const std::string& icalString);
- void setupEvents(icalcomponent* comp);
- void queueEvent(CalendarEvent* event);
-#if 0
- void dumpComponent(icalcomponent* comp);
-#endif
-
- tthread::recursive_mutex _mutex;
-
- std::string _calFile;
- icalset* _icalSet;
- icalcomponent* _icalComp;
-
- std::set<std::string> _eventIds;
- std::map<std::string, CalendarEvent*> _events;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(CalendarInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: CALENDARINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/expect/ExpectInvoker.cpp b/src/uscxml/plugins/invoker/expect/ExpectInvoker.cpp
deleted file mode 100644
index 69ad686..0000000
--- a/src/uscxml/plugins/invoker/expect/ExpectInvoker.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "ExpectInvoker.h"
-#include <glog/logging.h>
-
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#include "uscxml/UUID.h"
-
-#undef USE_TCL_STUBS
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new ExpectInvokerProvider() );
- return true;
-}
-#endif
-
-Tcl_Interp* ExpectInvoker::_tcl = NULL;
-
-ExpectInvoker::ExpectInvoker() : _eventQueue(NULL) {
-}
-
-ExpectInvoker::~ExpectInvoker() {
- _eventQueue->stop();
-// if (_tcl) {
-// Tcl_DeleteInterp(_tcl);
-// }
-};
-
-boost::shared_ptr<InvokerImpl> ExpectInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<ExpectInvoker> invoker = boost::shared_ptr<ExpectInvoker>(new ExpectInvoker());
- return invoker;
-}
-
-Data ExpectInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void ExpectInvoker::send(const SendRequest& req) {
- EventContext* ctx = new EventContext();
- ctx->sendReq = req;
- ctx->instance = this;
-
-// LOG(ERROR) << "################ " << req;
-
- std::string eventId = UUID::getUUID();
- _eventQueue->addEvent(eventId, ExpectInvoker::send, 0, ctx);
-
-// send(ctx, "");
-}
-
-void ExpectInvoker::send(void *userdata, const std::string event) {
-
- EventContext* ctx = (EventContext*)userdata;
- if (!ctx)
- return;
-
- if (!ctx->instance) {
- delete(ctx);
- return;
- }
-
- const SendRequest& req = ctx->sendReq;
-
- if (iequals(req.name, "expect.match")) {
- int nrCases = req.params.size();
- struct exp_case *cases = (struct exp_case*)malloc(sizeof(struct exp_case) * (nrCases + 1));
- memset(cases, 0, sizeof(exp_case) * (nrCases + 1));
-
- /**
- exp_end: indicates that no more patterns appear.
- exp_glob: indicates that the pattern is a glob-style string pattern.
- exp_exact: indicates that the pattern is an exact string.
- exp_regexp: indicates that the pattern is a regexp-style string pattern.
- exp_compiled: indicates that the pattern is a regexp-style string pattern, and that its compiled form is also provided.
- exp_null: indicates that the pattern is a null (for debugging purposes, a string pattern must also follow).
- */
-
- Event::params_t::const_iterator paramIter = req.params.begin();
- int index = 0;
- while (paramIter != req.params.end()) {
- struct exp_case* expCase = &cases[index];
- size_t colonPos = paramIter->first.find(":");
- if (colonPos != std::string::npos) {
- if (paramIter->first.substr(0, colonPos) == "regex") {
- expCase->type = exp_regexp;
- } else if(paramIter->first.substr(0, colonPos) == "glob") {
- expCase->type = exp_glob;
- } else if(paramIter->first.substr(0, colonPos) == "exact") {
- expCase->type = exp_exact;
- } else {
- // if we can't make sense of the type
- expCase->type = exp_exact;
- }
- } else {
- expCase->type = exp_regexp;
- }
-
- expCase->pattern = strdup(paramIter->second.atom.c_str());
-// LOG(ERROR) << "################ " << expCase->pattern;
-
- if (expCase->type == exp_regexp) {
- expCase->re = TclRegComp(expCase->pattern);
- if (expCase->re == NULL) {
- LOG(ERROR) << TclGetRegError();
- expCase->type = exp_null;
- }
- }
- expCase->value = index + 1;
- paramIter++;
- index++;
- }
-
- assert(index == nrCases);
-
- cases[nrCases].type = exp_end;
-
- /**
- * The functions wait until the output from a process matches one of the
- * patterns, a specified time period has passed, or an EOF is seen.
- */
-
- int rc = 0;
- // exp_fexpectv won't return on timeout when called in thread
-// rc = exp_fexpectv(ctx->instance->_cmdFP, cases);
- rc = exp_expectv(ctx->instance->_cmdFD, cases);
-
- if (rc == EXP_EOF) {
- Event ev;
- ev.name = "expect.match.eof";
- ev.data.compound["buffer"] = Data(exp_buffer, Data::VERBATIM);
- ctx->instance->returnEvent(ev);
- } else if (rc == EXP_TIMEOUT) {
- Event ev;
- ev.name = "expect.match.timeout";
- ev.data.compound["buffer"] = Data(exp_buffer, Data::VERBATIM);
- ctx->instance->returnEvent(ev);
- } else if (rc == EXP_FULLBUFFER) {
- Event ev;
- ev.name = "expect.match.fullbuffer";
- ev.data.compound["buffer"] = Data(exp_buffer, Data::VERBATIM);
- ctx->instance->returnEvent(ev);
- } else if (rc > 0) {
- rc--; // we started at 1
- paramIter = req.params.begin();
- while(rc > 0) {
- if (paramIter == req.params.end())
- break;
- paramIter++;
- rc--;
- }
- if (paramIter != req.params.end()) {
- Event event;
-
- size_t colonPos = paramIter->first.find(":");
- if (colonPos != std::string::npos) {
- std::string eventName = paramIter->first;
- event.name = std::string("expect.match.") + eventName.substr(colonPos + 1, eventName.length() - (colonPos + 1));
- event.data.compound["type"] = Data(paramIter->first.substr(0, colonPos), Data::VERBATIM);
-
- } else {
- event.name = std::string("expect.match.") + paramIter->first;
- event.data.compound["type"] = Data("regex", Data::VERBATIM);
- }
-
- event.data.compound["pattern"] = Data(paramIter->second.atom, Data::VERBATIM);
- event.data.compound["buffer"] = Data(exp_buffer, Data::VERBATIM);
- event.data.compound["start"] = Data((int)(exp_match - exp_buffer));
- event.data.compound["end"] = Data((int)(exp_match_end - exp_buffer));
- event.data.compound["match"] = Data(std::string(exp_buffer).substr(exp_match - exp_buffer, exp_match_end - exp_match), Data::VERBATIM);
- ctx->instance->returnEvent(event);
- } else {
- // exp_fexpectl returned gibberish
- assert(false);
- }
- } else {
- // exp_fexpectl returned gibberish
- assert(false);
- }
-
- // free our memory
- for (int i = 0; i < nrCases; i++) {
- if (cases[i].pattern != NULL)
- free(cases[i].pattern);
- if (cases[i].re != NULL)
- free(cases[i].re);
- }
- free(cases);
-
- } else if (iequals(req.name, "expect.send")) {
- std::string toSend = unescape(req.content);
- ctx->instance->_interpreter->getDataModel().replaceExpressions(toSend);
- fwrite(toSend.c_str(), toSend.length(), 1, ctx->instance->_cmdFP);
- }
-
- delete(ctx);
-}
-
-void ExpectInvoker::cancel(const std::string sendId) {
-}
-
-void ExpectInvoker::invoke(const InvokeRequest& req) {
- if (_eventQueue == NULL) {
- _eventQueue = new DelayedEventQueue();
- _eventQueue->start();
- }
-
- EventContext* ctx = new EventContext();
- ctx->invokeReq = req;
- ctx->instance = this;
-
- //_eventQueue->addEvent(req.sendid, ExpectInvoker::invoke, 0, ctx);
- invoke(ctx, "");
-
-}
-
-void ExpectInvoker::invoke(void *userdata, const std::string event) {
- EventContext* ctx = (EventContext*)userdata;
-
- if (!ctx)
- return;
-
- if (!ctx->instance) {
- delete(ctx);
- return;
- }
-
- const InvokeRequest& req = ctx->invokeReq;
-
- // moved here for thread local storage
- if (ctx->instance->_tcl == NULL) {
- ctx->instance->_tcl = Tcl_CreateInterp();
- if (ctx->instance->_tcl) {
- Tcl_Init(ctx->instance->_tcl);
- Expect_Init(ctx->instance->_tcl);
- }
- ctx->instance->_cmdFP = NULL;
-
- bool debug = false;
- Event::getParam(req.params, "debug", debug);
- if (debug) {
- exp_is_debugging = 1;
- } else {
- exp_is_debugging = 0;
- }
-
- int timeout = 20;
- Event::getParam(req.params, "timeout", timeout);
- exp_timeout = timeout;
-
- bool logUser = false;
- Event::getParam(req.params, "loguser", logUser);
- if (logUser) {
- exp_loguser = 1;
- } else {
- exp_loguser = 0;
- }
-
- // exp_interactive = 1;
- exp_logfile = 0;
- // exp_remove_nulls = 1;
- // exp_ttyinit = 1;
-
- } else {
-// assert(false);
- }
-
- char* cmd = NULL;
- char** args = NULL;
- int nrArgs = 0;
-
- if (req.params.count("spawn")) {
- // get command
- std::string command;
- Event::getParam(req.params, "spawn", command);
- cmd = strdup(command.c_str());
-
- // get arguments
- nrArgs = req.params.count("argument");
- args = (char**)malloc(sizeof(char*) * nrArgs + 2);
- args[0] = strdup(command.c_str());
-
- size_t index = 1;
- std::pair<Event::params_t::const_iterator, Event::params_t::const_iterator> argIterRange = req.params.equal_range("argument");
- Event::params_t::const_iterator argIter = argIterRange.first;
- while(argIter != argIterRange.second) {
- args[index] = strdup(argIter->second.atom.c_str());
- argIter++;
- index++;
- }
- args[index] = (char*)0;
- } else if(req.params.count("command")) {
-
- }
-
- // open socket
- ctx->instance->_cmdFD = exp_spawnv(cmd, args);
- if (ctx->instance->_cmdFD > 0) {
- ctx->instance->_cmdFP = fdopen(ctx->instance->_cmdFD, "r+");
-
- if (ctx->instance->_cmdFP) {
- // disable buffering
- setbuf(ctx->instance->_cmdFP,(char *)0);
- Event event;
- event.name = "spawn.success";
- ctx->instance->returnEvent(event);
- }
- }
-
- if (ctx->instance->_cmdFP == NULL || ctx->instance->_cmdFD <= 0) {
- Event event;
- event.name = "spawn.failed";
- event.data.compound["cause"] = Data(strerror(errno), Data::VERBATIM);
- Tcl_Obj *infoObj = Tcl_GetVar2Ex(_tcl, "errorInfo", NULL, TCL_GLOBAL_ONLY);
- if (infoObj) {
- event.data.compound["errorInfo"] = Data(Tcl_GetString(infoObj), Data::VERBATIM);
- }
-
- ctx->instance->returnEvent(event);
- }
-
- if (cmd)
- free(cmd);
-
- if (args) {
- for (int i = 0; i < nrArgs + 1; i++) {
- free(args[i]);
- }
- free(args);
- }
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/expect/ExpectInvoker.h b/src/uscxml/plugins/invoker/expect/ExpectInvoker.h
deleted file mode 100644
index 25a2517..0000000
--- a/src/uscxml/plugins/invoker/expect/ExpectInvoker.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef EXPECTINVOKER_H_W02590F0
-#define EXPECTINVOKER_H_W02590F0
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-#include <tcl.h>
-#include <expect_tcl.h>
-#include <expect.h>
-
-namespace uscxml {
-
-class ExpectInvoker : public InvokerImpl {
-public:
- struct EventContext {
- InvokeRequest invokeReq;
- SendRequest sendReq;
- ExpectInvoker* instance;
- };
-
- ExpectInvoker();
- virtual ~ExpectInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("expect");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#expect");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-
- static void send(void *userdata, const std::string event);
- static void invoke(void *userdata, const std::string event);
-
- static Tcl_Interp* _tcl;
- FILE* _cmdFP;
- int _cmdFD;
-
- DelayedEventQueue* _eventQueue;
-
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(ExpectInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: EXPECTINVOKER_H_W02590F0 */
diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
deleted file mode 100644
index f67e58f..0000000
--- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "FFMPEGInvoker.h"
-#include "uscxml/messages/Blob.h"
-
-#include <glog/logging.h>
-
-#include <libavutil/imgutils.h>
-#include <libavcodec/avcodec.h>
-#include <fstream>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#define STREAM_FRAME_RATE 25 /* 25 images/s */
-#define BMP_FORMAT PIX_FMT_BGR24
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new FFMPEGInvokerProvider() );
- return true;
-}
-#endif
-
-FFMPEGInvoker::FFMPEGInvoker() {
-}
-
-FFMPEGInvoker::~FFMPEGInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> FFMPEGInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<FFMPEGInvoker> invoker = boost::shared_ptr<FFMPEGInvoker>(new FFMPEGInvoker());
- // Register all formats and codecs - this ought to be done just once
- av_register_all();
- return invoker;
-}
-
-Data FFMPEGInvoker::getDataModelVariables() {
- Data data;
-
- AVCodec* codec = NULL;
- while((codec = av_codec_next(codec))) {
- AVCodec* codecInst = avcodec_find_encoder(codec->id);
- if (!codecInst)
- continue;
-
- switch (codec->type) {
- case AVMEDIA_TYPE_VIDEO: {
- Data codecData;
- codecData.compound["name"] = Data(codec->name, Data::VERBATIM);
- codecData.compound["longName"] = Data(codec->long_name, Data::VERBATIM);
- data.compound["video"].compound[codec->name] = codecData;
- break;
- }
- case AVMEDIA_TYPE_AUDIO: {
- Data codecData;
- codecData.compound["name"] = Data(codec->name, Data::VERBATIM);
- codecData.compound["longName"] = Data(codec->long_name, Data::VERBATIM);
- data.compound["audio"].compound[codec->name] = codecData;
- break;
- }
- default:
- break;
- }
- }
-
- return data;
-}
-
-void FFMPEGInvoker::invoke(const InvokeRequest& req) {
- int nrThreads = 1;
- Event::getParam(req.params, "threads", nrThreads);
-
- _isRunning = true;
- for (size_t i = 0; i < nrThreads; i++) {
- _threads.insert(new tthread::thread(FFMPEGInvoker::run, this));
- }
-}
-
-void FFMPEGInvoker::send(const SendRequest& req) {
- SendRequest reqCopy = req;
-
- if (iequals(req.name, "render.start")) {
- // create a new encoding context
- int ret;
- EncodingContext* ctx = new EncodingContext();
- tthread::lock_guard<tthread::recursive_mutex> lock(ctx->mutex);
-
- std::string context;
- Event::getParam(req.params, "context", context);
-
- ctx->extension = "mpeg";
- Event::getParam(req.params, "format", ctx->extension);
-
- Event::getParam(req.params, "width", ctx->width);
- Event::getParam(req.params, "height", ctx->height);
-
- if (!ctx->width || !ctx->height)
- return;
-
- ctx->filename = URL::getTmpFilename();
-
- /* allocate the output media context */
- avformat_alloc_output_context2(&ctx->formatCtx, NULL, ctx->extension.c_str(), ctx->filename.c_str());
- if (!ctx->formatCtx) {
- printf("Could not deduce output format from file extension: using MPEG.\n");
- avformat_alloc_output_context2(&ctx->formatCtx, NULL, "mpeg", ctx->filename.c_str());
- }
- if (!ctx->formatCtx) {
- return;
- }
- ctx->format = ctx->formatCtx->oformat;
-
- /* Add the audio and video streams using the default format codecs
- * and initialize the codecs. */
- ctx->videoStream = NULL;
-
- if (ctx->format->video_codec != AV_CODEC_ID_NONE) {
- ctx->videoStream = addStream(ctx, ctx->formatCtx, &ctx->videoCodec, ctx->format->video_codec);
- }
-
- /* Now that all the parameters are set, we can open the audio and
- * video codecs and allocate the necessary encode buffers. */
- if (ctx->videoStream)
- openVideo(ctx, ctx->formatCtx, ctx->videoCodec, ctx->videoStream);
-
- /* open the output file, if needed */
- if (!(ctx->format->flags & AVFMT_NOFILE)) {
- ret = avio_open(&ctx->formatCtx->pb, ctx->filename.c_str(), AVIO_FLAG_WRITE);
- if (ret < 0) {
- // fprintf(stderr, "Could not open '%s': %s\n", ctx->filename.c_str(),
- // av_err2str(ret));
- return;
- }
- }
-
- /* Write the stream header, if any. */
- ret = avformat_write_header(ctx->formatCtx, NULL);
- if (ret < 0) {
- // fprintf(stderr, "Error occurred when opening output file: %s\n",
- // av_err2str(ret));
- return;
- }
-
- if (ctx->frame)
- ctx->frame->pts = 0;
-
- _encoders[context] = ctx;
- } else if(iequals(req.name, "render.frame")) {
- _workQueue.push(req);
- } else if(iequals(req.name, "render.end")) {
- _workQueue.push(req);
- }
-}
-
-void FFMPEGInvoker::cancel(const std::string sendId) {
-}
-
-void FFMPEGInvoker::run(void* instance) {
- FFMPEGInvoker* INSTANCE = (FFMPEGInvoker*)instance;
- while(true) {
- SendRequest req = INSTANCE->_workQueue.pop();
- if (INSTANCE->_isRunning) {
- INSTANCE->process(req);
- } else {
- return;
- }
- }
-}
-
-void FFMPEGInvoker::finish(EncodingContext* ctx, const SendRequest& req) {
- av_write_trailer(ctx->formatCtx);
-
- /* Close each codec. */
- if (ctx->videoStream)
- closeVideo(ctx, ctx->formatCtx, ctx->videoStream);
-
- if (!(ctx->formatCtx->oformat->flags & AVFMT_NOFILE))
- /* Close the output file. */
- avio_close(ctx->formatCtx->pb);
-
- /* free the stream */
- avformat_free_context(ctx->formatCtx);
-
- // read file
- std::ifstream movieFile(ctx->filename.c_str());
- movieFile.seekg(0, std::ios::end);
- size_t length = movieFile.tellg();
- movieFile.seekg(0, std::ios::beg);
-
- char* movieBuffer = (char*)malloc(length);
- movieFile.read(movieBuffer, length);
-
- // move to desktop for checking
-// int err = rename(ctx->filename.c_str(), "/Users/sradomski/Desktop/foo.mpg");
-// if (err) {
-// printf("%s", strerror(errno));
-// }
-
- std::string context;
- Event::getParam(req.params, "context", context);
-
- Event event;
- event.name = "render.done";
- event.data.compound["context"] = Data(context, Data::INTERPRETED);
- event.data.compound["movie"] = Data(movieBuffer, length, "video/mpeg", true);
- event.data.compound["filename"] = Data(std::string("movie.") + ctx->extension, Data::VERBATIM);
-
- returnEvent(event);
-}
-
-void FFMPEGInvoker::process(const SendRequest& req) {
-
- std::string context;
- Event::getParam(req.params, "context", context);
- if (_encoders.find(context) == _encoders.end()) {
- return;
- }
-
- EncodingContext* ctx = _encoders[context];
- tthread::lock_guard<tthread::recursive_mutex> lock(ctx->mutex);
-
- // finish encoding and return
- if(iequals(req.name, "render.end")) {
- finish(ctx, req);
- delete _encoders[context];
- _encoders.erase(context);
- }
-
- Data image;
- Event::getParam(req.params, "frame", image);
- if (image.empty()) {
- return;
- }
-
- std::string format = "bmp";
- Event::getParam(req.params, "format", format);
-
- writeVideoFrame(ctx, ctx->formatCtx, ctx->videoStream, image.binary);
- ctx->frame->pts += av_rescale_q(1, ctx->videoStream->codec->time_base, ctx->videoStream->time_base);
-
-}
-
-AVStream* FFMPEGInvoker::addStream(EncodingContext* ctx, AVFormatContext *oc, AVCodec **codec,
- enum AVCodecID codec_id) {
- AVCodecContext *c;
- AVStream *st;
-
- /* find the encoder */
- *codec = avcodec_find_encoder(codec_id);
- if (!(*codec)) {
- fprintf(stderr, "Could not find encoder for '%s'\n",
- avcodec_get_name(codec_id));
- return NULL;
- }
-
- st = avformat_new_stream(oc, *codec);
- ctx->videoPixFmt = (*codec)->pix_fmts[0];
- if (!st) {
- fprintf(stderr, "Could not allocate stream\n");
- return NULL;
- }
- st->id = oc->nb_streams-1;
- c = st->codec;
-
- switch ((*codec)->type) {
- case AVMEDIA_TYPE_AUDIO:
- c->sample_fmt = AV_SAMPLE_FMT_FLTP;
- c->bit_rate = 64000;
- c->sample_rate = 44100;
- c->channels = 2;
- break;
-
- case AVMEDIA_TYPE_VIDEO:
- c->codec_id = codec_id;
-
- c->bit_rate = 800000;
- /* Resolution must be a multiple of two. */
- c->width = ctx->width;
- c->height = ctx->height;
- /* timebase: This is the fundamental unit of time (in seconds) in terms
- * of which frame timestamps are represented. For fixed-fps content,
- * timebase should be 1/framerate and timestamp increments should be
- * identical to 1. */
- c->time_base.den = STREAM_FRAME_RATE;
- c->time_base.num = 1;
- c->gop_size = 12; /* emit one intra frame every twelve frames at most */
- c->pix_fmt = ctx->videoPixFmt;
- if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
- /* just for testing, we also add B frames */
- c->max_b_frames = 2;
- }
- if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
- /* Needed to avoid using macroblocks in which some coeffs overflow.
- * This does not happen with normal video, it just happens here as
- * the motion of the chroma plane does not match the luma plane. */
- c->mb_decision = 2;
- }
- break;
-
- default:
- break;
- }
-
- /* Some formats want stream headers to be separate. */
- if (oc->oformat->flags & AVFMT_GLOBALHEADER)
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-
- return st;
-}
-
-void FFMPEGInvoker::openVideo(EncodingContext* ctx, AVFormatContext *oc, AVCodec *codec, AVStream *st) {
- int ret;
- AVCodecContext *c = st->codec;
-
- /* open the codec */
- ret = avcodec_open2(c, codec, NULL);
- if (ret < 0) {
- // fprintf(stderr, "Could not open video codec: %s\n", av_err2str(ret));
- return;
- }
-
- /* allocate and init a re-usable frame */
- ctx->frame = avcodec_alloc_frame();
- if (!ctx->frame) {
- fprintf(stderr, "Could not allocate video frame\n");
- return;
- }
-
- /* Allocate the encoded raw picture. */
- ret = avpicture_alloc(&ctx->dst_picture, c->pix_fmt, c->width, c->height);
- if (ret < 0) {
-// fprintf(stderr, "Could not allocate picture: %s\n", av_err2str(ret));
- return;
- }
-
- /* If the output format is not YUV420P, then a temporary YUV420P
- * picture is needed too. It is then converted to the required
- * output format. */
- if (c->pix_fmt != BMP_FORMAT) {
- ret = avpicture_alloc(&ctx->src_picture, BMP_FORMAT, c->width, c->height);
- if (ret < 0) {
- // fprintf(stderr, "Could not allocate temporary picture: %s\n",
- // av_err2str(ret));
- return;
- }
- }
-
- /* copy data and linesize picture pointers to frame */
- *((AVPicture *)ctx->frame) = ctx->dst_picture;
-}
-
-void FFMPEGInvoker::writeVideoFrame(EncodingContext* ctx, AVFormatContext *oc, AVStream *st, Blob image) {
- int ret;
- AVCodecContext *c = st->codec;
-
- if (c->pix_fmt != BMP_FORMAT) {
- /* as we only generate a YUV420P picture, we must convert it
- * to the codec pixel format if needed */
- if (!ctx->sws_ctx) {
- ctx->sws_ctx = sws_getContext(c->width, c->height, BMP_FORMAT,
- c->width, c->height, c->pix_fmt,
- ctx->sws_flags, NULL, NULL, NULL);
- if (!ctx->sws_ctx) {
- fprintf(stderr,
- "Could not initialize the conversion context\n");
- return;
- }
- }
-
- uint32_t headerOffset = 0;
- headerOffset += image._impl->data[10] << 0;
- headerOffset += image._impl->data[11] << 8;
- headerOffset += image._impl->data[12] << 16;
- headerOffset += image._impl->data[13] << 24;
-
-// std::cout << headerOffset + (c->width * c->height) << " / " << image->_size << std::endl;
-
- ret = avpicture_fill(&ctx->src_picture, (uint8_t*)(image._impl->data + headerOffset), BMP_FORMAT, c->width, c->height);
- if (ret < 0) {
- fprintf(stderr,
- "Could not fill image from given bitmap\n");
- }
- sws_scale(ctx->sws_ctx,
- (const uint8_t * const *)ctx->src_picture.data, ctx->src_picture.linesize,
- 0, c->height, ctx->dst_picture.data, ctx->dst_picture.linesize);
- } else {
- avpicture_fill(&ctx->dst_picture, (uint8_t*)image._impl->data, c->pix_fmt, c->width, c->height);
- }
-
- if (oc->oformat->flags & AVFMT_RAWPICTURE) {
- /* Raw video case - directly store the picture in the packet */
- AVPacket pkt;
- av_init_packet(&pkt);
-
- pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index = st->index;
- pkt.data = ctx->dst_picture.data[0];
- pkt.size = sizeof(AVPicture);
-
- ret = av_interleaved_write_frame(oc, &pkt);
- } else {
- AVPacket pkt = { 0 };
- int got_packet;
- av_init_packet(&pkt);
-
- /* encode the image */
- ret = avcodec_encode_video2(c, &pkt, ctx->frame, &got_packet);
- if (ret < 0) {
- // fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret));
- return;
- }
- /* If size is zero, it means the image was buffered. */
-
- if (!ret && got_packet && pkt.size) {
- pkt.stream_index = st->index;
-
- /* Write the compressed frame to the media file. */
-// ret = av_write_frame(oc, &pkt);
- ret = av_interleaved_write_frame(oc, &pkt);
- } else {
- ret = 0;
- }
- }
- if (ret != 0) {
-// fprintf(stderr, "Error while writing video frame: %s\n", av_err2str(ret));
- return;
- }
- ctx->frame_count++;
-}
-
-void FFMPEGInvoker::closeVideo(EncodingContext* ctx, AVFormatContext *oc, AVStream *st) {
- avcodec_close(st->codec);
-// av_free(ctx->src_picture.data[0]);
- av_free(ctx->dst_picture.data[0]);
- av_free(ctx->frame);
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
deleted file mode 100644
index 81589bb..0000000
--- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef FFMPEGINVOKER_H_VQD1V1C2
-#define FFMPEGINVOKER_H_VQD1V1C2
-
-#include <uscxml/Interpreter.h>
-
-extern "C" {
-#include <libavutil/avutil.h>
-#include <libavformat/avformat.h>
-#include <libswscale/swscale.h>
-}
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class FFMPEGInvoker : public InvokerImpl {
-public:
- FFMPEGInvoker();
- virtual ~FFMPEGInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("ffmpeg");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#ffmpeg");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
- class EncodingContext {
- public:
- EncodingContext() :
- format(NULL),
- formatCtx(NULL),
- audioStream(NULL), videoStream(NULL),
- audioCodec(NULL), videoCodec(NULL),
- audioTime(0), videoTime(0),
- frame(NULL),
- frame_count(0),
- width(0),
- height(0),
- sws_flags(SWS_BICUBIC),
- sws_ctx(NULL) {}
-
- virtual ~EncodingContext() {
- if (sws_ctx)
- sws_freeContext(sws_ctx);
- }
-
- tthread::recursive_mutex mutex;
- PixelFormat videoPixFmt;
- std::string filename;
- AVOutputFormat* format;
- AVFormatContext* formatCtx;
- AVStream *audioStream, *videoStream;
- AVCodec *audioCodec, *videoCodec, *imageCodec;
- double audioTime, videoTime;
- AVFrame *frame;
- AVPicture src_picture, dst_picture;
- int frame_count;
- size_t width, height;
- int sws_flags;
- SwsContext *sws_ctx;
- std::string extension;
- };
-
- AVStream* addStream(EncodingContext* ctx, AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id);
- void openVideo(EncodingContext* ctx, AVFormatContext *oc, AVCodec *codec, AVStream *st);
- void writeVideoFrame(EncodingContext* ctx, AVFormatContext *oc, AVStream *st, Blob image);
- void closeVideo(EncodingContext* ctx, AVFormatContext *oc, AVStream *st);
-
- static void run(void*);
- void finish(EncodingContext* ctx, const SendRequest& req);
- void process(const SendRequest& req);
-
- std::set<tthread::thread*> _threads;
- uscxml::concurrency::BlockingQueue<SendRequest> _workQueue;
- bool _isRunning;
- std::map<std::string, EncodingContext*> _encoders;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(FFMPEGInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: FFMPEGINVOKER_H_VQD1V1C2 */
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
deleted file mode 100644
index 63d1628..0000000
--- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
+++ /dev/null
@@ -1,443 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "DirMonInvoker.h"
-#include <glog/logging.h>
-
-#include "uscxml/config.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#include <sys/stat.h>
-#ifndef WIN32
-#include <dirent.h>
-#else
-#include <strsafe.h>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new DirMonInvokerProvider() );
- return true;
-}
-#endif
-
-DirMonInvoker::DirMonInvoker() :
- _reportExisting(true),
- _reportHidden(false),
- _recurse(false),
- _thread(NULL),
- _watcher(NULL) {
-}
-
-DirMonInvoker::~DirMonInvoker() {
- _isRunning = false;
- if (_thread) {
- _thread->join();
- delete _thread;
- }
- if (_watcher)
- delete(_watcher);
-};
-
-boost::shared_ptr<InvokerImpl> DirMonInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<DirMonInvoker> invoker = boost::shared_ptr<DirMonInvoker>(new DirMonInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data DirMonInvoker::getDataModelVariables() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- Data data;
- data.compound["dir"] = Data(_dir, Data::VERBATIM);
-
- std::set<std::string>::iterator suffixIter = _suffixes.begin();
- while(suffixIter != _suffixes.end()) {
- data.compound["suffixes"].array.push_back(Data(*suffixIter, Data::VERBATIM));
- suffixIter++;
- }
-
- std::map<std::string, struct stat> entries = _watcher->getAllEntries();
- std::map<std::string, struct stat>::iterator entryIter = entries.begin();
- while(entryIter != entries.end()) {
- data.compound["file"].compound[entryIter->first].compound["mtime"] = Data(toStr(entryIter->second.st_mtime), Data::INTERPRETED);
- data.compound["file"].compound[entryIter->first].compound["ctime"] = Data(toStr(entryIter->second.st_mtime), Data::INTERPRETED);
- data.compound["file"].compound[entryIter->first].compound["atime"] = Data(toStr(entryIter->second.st_mtime), Data::INTERPRETED);
- data.compound["file"].compound[entryIter->first].compound["size"] = Data(toStr(entryIter->second.st_mtime), Data::INTERPRETED);
- entryIter++;
- }
-
- return data;
-}
-
-void DirMonInvoker::send(const SendRequest& req) {
-}
-
-void DirMonInvoker::cancel(const std::string sendId) {
-}
-
-void DirMonInvoker::invoke(const InvokeRequest& req) {
- if (req.params.find("dir") == req.params.end()) {
- LOG(ERROR) << "No dir param given";
- return;
- }
-
- if (req.params.find("reportexisting") != req.params.end() &&
- iequals(req.params.find("reportexisting")->second.atom, "false"))
- _reportExisting = false;
- if (req.params.find("recurse") != req.params.end() &&
- iequals(req.params.find("recurse")->second.atom, "true"))
- _recurse = true;
- if (req.params.find("reporthidden") != req.params.end() &&
- iequals(req.params.find("reporthidden")->second.atom, "true"))
- _reportHidden = true;
-
- std::string suffixList;
- if (req.params.find("suffix") != req.params.end()) {
- suffixList = req.params.find("suffix")->second.atom;
- } else if (req.params.find("suffixes") != req.params.end()) {
- suffixList = req.params.find("suffixes")->second.atom;
- }
-
- if (suffixList.size() > 0) {
- // seperate path into components
- std::stringstream ss(suffixList);
- std::string item;
- while(std::getline(ss, item, ' ')) {
- if (item.length() == 0)
- continue;
- _suffixes.insert(item);
- }
- }
-
- std::multimap<std::string, Data>::const_iterator dirIter = req.params.find("dir");
- while(dirIter != req.params.upper_bound("dir")) {
- // this is simplified - Data might be more elaborate than a simple string atom
- URL url(dirIter->second.atom);
- if (!url.toAbsolute(_interpreter->getBaseURL(req.elem)) || !iequals(url.scheme(), "file")) {
- LOG(ERROR) << "Given directory '" << dirIter->second << "' cannot be transformed to absolute path";
- } else {
- _dir = url.path();
- }
- break;
- }
-
- _watcher = new DirectoryWatch(_dir, _recurse);
- _watcher->addMonitor(this);
- _watcher->updateEntries(true);
-
- _isRunning = true;
- _thread = new tthread::thread(DirMonInvoker::run, this);
-}
-
-void DirMonInvoker::run(void* instance) {
- while(((DirMonInvoker*)instance)->_isRunning) {
- {
- tthread::lock_guard<tthread::recursive_mutex> lock(((DirMonInvoker*)instance)->_mutex);
- ((DirMonInvoker*)instance)->_watcher->updateEntries();
- }
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(20));
- }
-}
-
-void DirMonInvoker::handleChanges(DirectoryWatch::Action action, const std::string reportedDir, const std::string reportedFilename, struct stat fileStat) {
-
-// std::cout << action << " on " << reportedFilename << std::endl;
-
- std::string path; // complete path to the file including filename
- std::string relPath; // path relative to monitored directory including filename
- std::string dir; // the name of the directory we monitor
- std::string relDir; // the directory from dir to the actual directory where we found a file
- std::string basename; // filename including suffix
- std::string strippedName; // filename without the suffix
- std::string extension; // the extension
-
- dir = reportedDir;
-
- path = dir + reportedFilename;
- boost::algorithm::replace_all(path, "\\", "/");
- boost::algorithm::replace_all(path, "//", "/");
-
- assert(boost::algorithm::starts_with(path, dir));
- relPath = path.substr(dir.length());
- assert(boost::equal(path, dir + relPath));
-
- size_t lastSep;
- if ((lastSep = path.find_last_of(PATH_SEPERATOR)) != std::string::npos) {
- lastSep++;
- basename = path.substr(lastSep, path.length() - lastSep);
- } else {
- assert(false);
- }
- assert(boost::algorithm::ends_with(relPath, basename));
-
- // extension is the suffix and strippedName the basename without the suffix
- size_t lastDot;
- if ((lastDot = basename.find_last_of(".")) != std::string::npos) {
- if (lastDot == 0) {
- // hidden file
- strippedName = basename;
- } else {
- extension = basename.substr(lastDot + 1);
- strippedName = basename.substr(0, lastDot);
- }
- } else {
- strippedName = basename;
- }
-
- relDir = relPath.substr(0, relPath.length() - basename.length());
- assert(boost::equal(path, dir + relDir + basename));
-
- // return if this is a hidden file
- if (boost::algorithm::starts_with(basename, ".") && !_reportHidden)
- return;
-
- // ilter suffixes
- if (_suffixes.size() > 0) {
- bool validSuffix = false;
- std::set<std::string>::iterator suffixIter = _suffixes.begin();
- while(suffixIter != _suffixes.end()) {
- if (boost::algorithm::ends_with(path, *suffixIter)) {
- validSuffix = true;
- break;
- }
- suffixIter++;
- }
- if (!validSuffix)
- return;
- }
-
- Event event;
- event.invokeid = _invokeId;
-
- switch (action) {
- case DirectoryWatch::EXISTING:
- event.name = "file.existing";
- break;
- case DirectoryWatch::ADDED:
- event.name = "file.added";
- break;
- case DirectoryWatch::DELETED:
- event.name = "file.deleted";
- break;
- case DirectoryWatch::MODIFIED:
- event.name = "file.modified";
- break;
- default:
- break;
- }
-
- if (action != DirectoryWatch::DELETED) {
- event.data.compound["file"].compound["mtime"] = Data(toStr(fileStat.st_mtime), Data::INTERPRETED);
- event.data.compound["file"].compound["ctime"] = Data(toStr(fileStat.st_ctime), Data::INTERPRETED);
- event.data.compound["file"].compound["atime"] = Data(toStr(fileStat.st_atime), Data::INTERPRETED);
- event.data.compound["file"].compound["size"] = Data(toStr(fileStat.st_size), Data::INTERPRETED);
- }
-
- event.data.compound["file"].compound["name"] = Data(basename, Data::VERBATIM);
- event.data.compound["file"].compound["extension"] = Data(extension, Data::VERBATIM);
- event.data.compound["file"].compound["strippedName"] = Data(strippedName, Data::VERBATIM);
- event.data.compound["file"].compound["relPath"] = Data(relPath, Data::VERBATIM);
- event.data.compound["file"].compound["relDir"] = Data(relDir, Data::VERBATIM);
- event.data.compound["file"].compound["path"] = Data(path, Data::VERBATIM);
- event.data.compound["file"].compound["dir"] = Data(dir, Data::VERBATIM);
-
- returnEvent(event);
-}
-
-DirectoryWatch::~DirectoryWatch() {
- std::map<std::string, DirectoryWatch*>::iterator dirIter = _knownDirs.begin();
- while(dirIter != _knownDirs.end()) {
- delete(dirIter->second);
- dirIter++;
- }
-
-}
-
-void DirectoryWatch::reportAsDeleted() {
- std::map<std::string, struct stat>::iterator fileIter = _knownEntries.begin();
- while(fileIter != _knownEntries.end()) {
- if (fileIter->second.st_mode & S_IFDIR) {
- _knownDirs[fileIter->first]->reportAsDeleted();
- delete _knownDirs[fileIter->first];
- _knownDirs.erase(fileIter->first);
- } else {
- _monitors_t::iterator monIter = _monitors.begin();
- while(monIter != _monitors.end()) {
- (*monIter)->handleChanges(DELETED, _dir, _relDir + PATH_SEPERATOR + fileIter->first, fileIter->second);
- monIter++;
- }
- }
- _knownEntries.erase(fileIter++);
-// fileIter++;
- }
- assert(_knownDirs.size() == 0);
- assert(_knownEntries.size() == 0);
-}
-
-void DirectoryWatch::updateEntries(bool reportAsExisting) {
- _monitors_t::iterator monIter;
- if (_dir[_dir.length() - 1] == PATH_SEPERATOR)
- _dir = _dir.substr(0, _dir.length() - 1);
-
- // stat directory for modification date
- struct stat dirStat;
- if (stat((_dir + _relDir).c_str(), &dirStat) != 0) {
- LOG(ERROR) << "Error with stat on directory " << _dir << ": " << strerror(errno);
- return;
- }
-
- if ((unsigned)dirStat.st_mtime >= (unsigned)_lastChecked) {
-// std::cout << "dirStat.st_mtime: " << dirStat.st_mtime << " / _lastChecked: " << _lastChecked << std::endl;
-
- // there are changes in the directory
- std::set<std::string> currEntries;
-
-#ifndef WIN32
- DIR *dp;
- dp = opendir((_dir + _relDir).c_str());
- if (dp == NULL) {
- LOG(ERROR) << "Error opening directory " << _dir + _relDir << ": " << strerror(errno);
- return;
- }
- // iterate all entries and see what changed
- struct dirent* entry;
- while((entry = readdir(dp))) {
- std::string dname = entry->d_name;
-#else
- WIN32_FIND_DATA ffd;
- HANDLE hFind = INVALID_HANDLE_VALUE;
- TCHAR szDir[MAX_PATH];
- StringCchCopy(szDir, MAX_PATH, _dir.c_str());
- StringCchCat(szDir, MAX_PATH, TEXT("\\*"));
-
- hFind = FindFirstFile(szDir, &ffd);
- do {
- std::string dname = ffd.cFileName;
-#endif
-
- // see if the file was changed
- std::string filename = _dir + _relDir + "/" + dname;
-// asprintf(&filename, "%s/%s", (_dir + _relDir).c_str(), dname.c_str());
-
- struct stat fileStat;
- if (stat(filename.c_str(), &fileStat) != 0) {
- LOG(ERROR) << "Error with stat on directory entry: " << filename << ": " << strerror(errno);
- continue;
- }
-
- if (fileStat.st_mode & S_IFDIR) {
- if (boost::equals(dname, ".") || boost::equals(dname, "..")) {
- continue; // do not report . or ..
- }
- }
-
- currEntries.insert(dname);
-
- if (_knownEntries.find(dname) != _knownEntries.end()) {
- // we have seen this entry before
- struct stat oldStat = _knownEntries[dname];
- if (oldStat.st_mtime < fileStat.st_mtime) {
- monIter = _monitors.begin();
- while(monIter != _monitors.end()) {
- (*monIter)->handleChanges(MODIFIED, _dir, _relDir + PATH_SEPERATOR + dname, fileStat);
- monIter++;
- }
- }
- } else {
- // we have not yet seen this entry
- if (fileStat.st_mode & S_IFDIR) {
- _knownDirs[dname] = new DirectoryWatch(_dir, _relDir + PATH_SEPERATOR + dname);
- monIter = _monitors.begin();
- while(monIter != _monitors.end()) {
- _knownDirs[dname]->addMonitor(*monIter);
- monIter++;
- }
- } else {
- monIter = _monitors.begin();
- while(monIter != _monitors.end()) {
- if (reportAsExisting) {
- (*monIter)->handleChanges(EXISTING, _dir, _relDir + PATH_SEPERATOR + dname, fileStat);
- } else {
- (*monIter)->handleChanges(ADDED, _dir, _relDir + PATH_SEPERATOR + dname, fileStat);
- }
- monIter++;
- }
- }
- }
-
- _knownEntries[dname] = fileStat; // gets copied on insertion
-#ifndef WIN32
- }
- closedir(dp);
-#else
- }
- while (FindNextFile(hFind, &ffd) != 0);
- FindClose(hFind);
-#endif
- // are there any known entries we have not seen this time around?
- std::map<std::string, struct stat>::iterator fileIter = _knownEntries.begin();
- while(fileIter != _knownEntries.end()) {
- if (currEntries.find(fileIter->first) == currEntries.end()) {
- // we used to know this file
- if (fileIter->second.st_mode & S_IFDIR) {
- if (_recurse) {
- _knownDirs[fileIter->first]->reportAsDeleted();
- delete _knownDirs[fileIter->first];
- _knownDirs.erase(fileIter->first);
- }
- } else {
- monIter = _monitors.begin();
- while(monIter != _monitors.end()) {
- (*monIter)->handleChanges(DELETED, _dir, _relDir + PATH_SEPERATOR + fileIter->first, fileIter->second);
- monIter++;
- }
- }
- _knownEntries.erase(fileIter++);
- } else {
- fileIter++;
- }
- }
- // remember when we last checked the directory for modifications
-#ifndef WIN32
- time(&_lastChecked);
-#else
- // TODO: this will fail with sub-millisecond updates to the directory
- _lastChecked = dirStat.st_mtime + 1;
-#endif
- // update all directories
- }
- if (_recurse) {
- std::map<std::string, DirectoryWatch*>::iterator dirIter = _knownDirs.begin();
- while(dirIter != _knownDirs.end()) {
- dirIter->second->updateEntries();
- dirIter++;
- }
- }
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
deleted file mode 100644
index 85f5174..0000000
--- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef DIRMONINVOKER_H_W09J90F0
-#define DIRMONINVOKER_H_W09J90F0
-
-#include <uscxml/config.h>
-#include <uscxml/Interpreter.h>
-#include <map>
-#include <sys/stat.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class DirectoryWatchMonitor;
-
-class DirectoryWatch {
-public:
- enum Action {
- ADDED = 1,
- MODIFIED = 2,
- DELETED = 4,
- EXISTING = 8
- };
-
- DirectoryWatch(const std::string& dir, bool recurse = false) : _dir(dir), _recurse(recurse), _lastChecked(0) {}
- ~DirectoryWatch();
-
- void addMonitor(DirectoryWatchMonitor* monitor) {
- _monitors.insert(monitor);
- }
- void removeMonitor(DirectoryWatchMonitor* monitor) {
- _monitors.erase(monitor);
- }
- void updateEntries(bool reportAsExisting = false);
- void reportAsDeleted();
-
- std::map<std::string, struct stat> getAllEntries() {
- std::map<std::string, struct stat> entries;
- entries.insert(_knownEntries.begin(), _knownEntries.end());
-
- std::map<std::string, DirectoryWatch*>::iterator dirIter = _knownDirs.begin();
- while(dirIter != _knownDirs.end()) {
- std::map<std::string, struct stat> dirEntries = dirIter->second->getAllEntries();
- std::map<std::string, struct stat>::iterator dirEntryIter = dirEntries.begin();
- while(dirEntryIter != dirEntries.end()) {
- entries[dirIter->first + '/' + dirEntryIter->first] = dirEntryIter->second;
- dirEntryIter++;
- }
- dirIter++;
- }
-
- return entries;
- }
-
-protected:
- DirectoryWatch(const std::string& dir, const std::string& relDir) : _dir(dir), _relDir(relDir), _recurse(true), _lastChecked(0) {}
-
- std::string _dir;
- std::string _relDir;
-
- bool _recurse;
- std::map<std::string, struct stat> _knownEntries;
- std::map<std::string, DirectoryWatch*> _knownDirs;
- std::set<DirectoryWatchMonitor*> _monitors;
- typedef std::set<DirectoryWatchMonitor*> _monitors_t;
- time_t _lastChecked;
-};
-
-class DirectoryWatchMonitor {
-public:
- virtual void handleChanges(DirectoryWatch::Action action, const std::string dir, const std::string file, struct stat fileStat) = 0;
-};
-
-class DirMonInvoker : public InvokerImpl, public DirectoryWatchMonitor {
-public:
- DirMonInvoker();
- virtual ~DirMonInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("dirmon");
- names.push_back("DirectoryMonitor");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#dirmon");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
- virtual void handleChanges(DirectoryWatch::Action action, const std::string dir, const std::string file, struct stat fileStat);
-
- static void run(void* instance);
-
-protected:
- bool _reportExisting;
- bool _reportHidden;
- bool _recurse;
-
- std::string _dir;
- std::set<std::string> _suffixes;
-
- bool _isRunning;
- tthread::thread* _thread;
- tthread::recursive_mutex _mutex;
-
- DirectoryWatch* _watcher;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(DirMonInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: DIRMONINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp
deleted file mode 100644
index bf4fac7..0000000
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "CompositeDisplay.h"
-#if 0
-#ifdef MACOSX
-USE_GRAPICSWINDOW_IMPLEMENTATION(Cocoa)
-#else
-USE_GRAPHICSWINDOW()
-#endif
-#endif
-
-CompositeDisplay::CompositeDisplay(unsigned int x,
- unsigned int y,
- unsigned int width,
- unsigned int height,
- int screenId) {
- _waitForViewOp = false;
- unsigned int tWidth = 0;
- unsigned int tHeight = 0;
- getResolution(tWidth, tHeight, screenId);
-
- osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
- traits->doubleBuffer = true;
- traits->sharedContext = 0;
- traits->screenNum = screenId;
-
- if (width == 0 || height == 0 || (width == tWidth && height == tHeight)) {
- // fullscreen
- traits->windowDecoration = false;
- traits->width = tWidth;
- traits->height = tHeight;
- traits->x = 0;
- traits->y = 0;
- } else {
- // Start with given resolution
- traits->windowDecoration = true;
- traits->x = x;
- traits->y = y;
- traits->width = width;
- traits->height = height;
- }
-
- _gc = osg::GraphicsContext::createGraphicsContext(traits.get());
- if (_gc.valid()) {
- _gc->setClearColor(osg::Vec4f(1.0f,1.0f,1.0f,1.0f));
- _gc->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
-
- _width = traits->width;
- _height = traits->height;
-
- setRunMaxFrameRate(30);
-// setRunFrameScheme(osgViewer::ViewerBase::ON_DEMAND);
- setThreadingModel(osgViewer::Viewer::AutomaticSelection);
-}
-
-CompositeDisplay::~CompositeDisplay() {}
-
-void CompositeDisplay::frame(double simulationTime) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- CompositeViewer::frame();
-}
-
-bool CompositeDisplay::checkNeedToDoFrame() {
- return CompositeViewer::checkNeedToDoFrame();
-}
-
-void CompositeDisplay::addView(const std::string& name, osg::Viewport* v, osgViewer::View* view) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- _viewports[name] = v;
-
- _views[name] = view;
- _views[name]->setName(name);
- _views[name]->getCamera()->setName(name);
- _views[name]->setCameraManipulator(new osgGA::TrackballManipulator);
-
- // add the state manipulator
- osg::ref_ptr<osgGA::StateSetManipulator> statesetManipulator = new osgGA::StateSetManipulator;
- statesetManipulator->setStateSet(_views[name]->getCamera()->getOrCreateStateSet());
- _views[name]->addEventHandler( statesetManipulator.get() );
-
- _views[name]->addEventHandler( new osgViewer::StatsHandler );
- _views[name]->addEventHandler( new osgViewer::HelpHandler );
- _views[name]->addEventHandler( new osgViewer::WindowSizeHandler );
- _views[name]->addEventHandler( new osgViewer::ThreadingHandler );
-
- _views[name]->getCamera()->setViewport(v);
-
- // set graphic context
- _views[name]->getCamera()->setGraphicsContext(_gc.get());
- CompositeViewer::addView(_views[name]);
-
-}
-
-void CompositeDisplay::moveView(const std::string& name, osg::Viewport* v) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- const osg::GraphicsContext::Traits* traits = _gc->getTraits();
- osg::Viewport* absoluteVp = new osg::Viewport(v->x() * (traits->width/100.0),
- v->y() * (traits->height/100.0),
- v->width() * (traits->width/100.0),
- v->height() * (traits->height/100.0));
- _views[name]->getCamera()->setViewport(absoluteVp);
-}
-
-void CompositeDisplay::removeView(const std::string& name) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- _views[name]->getCamera()->setGraphicsContext(NULL);
- _views[name]->getCamera()->setViewport(NULL);
-
- CompositeViewer::removeView(_views[name]);
-
- if (_views.find(name) != _views.end()) {
- _views.erase(name);
- }
- if (_viewports.find(name) != _viewports.end())
- _viewports.erase(name);
-}
-
-osg::GraphicsContext::WindowingSystemInterface* CompositeDisplay::wsi = NULL;
-void CompositeDisplay::getResolution(unsigned int& width, unsigned int& height, int screenId) {
- if (!wsi)
- wsi = osg::GraphicsContext::getWindowingSystemInterface();
- if (wsi) {
- wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(screenId), width, height);
- } else {
- width = 800;
- height = 600;
- }
-}
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h
deleted file mode 100644
index 6c2adac..0000000
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef COMPOSITEDISPLAY_H_W2MX9CXP
-#define COMPOSITEDISPLAY_H_W2MX9CXP
-
-#include "uscxml/concurrency/tinythread.h"
-#include <osgGA/TrackballManipulator>
-#include <osgViewer/Viewer>
-#include <osgViewer/CompositeViewer>
-#include <osgViewer/ViewerEventHandlers>
-#include <osgGA/StateSetManipulator>
-#include <assert.h>
-#include <iostream>
-
-class CompositeDisplay : public osgViewer::CompositeViewer {
-public:
- CompositeDisplay(unsigned int x,
- unsigned int y,
- unsigned int width,
- unsigned int height,
- int screenId);
- virtual ~CompositeDisplay();
-
- virtual void addView(const std::string& name, osg::Viewport* v, osgViewer::View* view);
- virtual void moveView(const std::string& name, osg::Viewport* v);
- virtual void removeView(const std::string& name);
-
- virtual void frame(double simulationTime);
- virtual bool checkNeedToDoFrame();
-
- int getWidth() {
- return _width;
- }
- int getHeight() {
- return _height;
- }
-
- static void getResolution(unsigned int& width, unsigned int& height, int screenId);
-
-protected:
- tthread::recursive_mutex _mutex;
- tthread::condition_variable _monitor;
- bool _waitForViewOp;
- std::map<std::string, osgViewer::View*> _views;
- std::map<std::string, osg::Viewport*> _viewports;
- osg::ref_ptr<osg::GraphicsContext> _gc;
-
- static osg::GraphicsContext::WindowingSystemInterface* wsi;
- int _width, _height;
-};
-
-
-#endif /* end of include guard: COMPOSITEDISPLAY_H_W2MX9CXP */
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp
deleted file mode 100644
index d2bf74d..0000000
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp
+++ /dev/null
@@ -1,722 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "OSGInvoker.h"
-#include "uscxml/URL.h"
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-
-#include <osg/Shape>
-#include <osg/ShapeDrawable>
-#include <osg/Material>
-#include <osg/Depth>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#define OSG_SET_MATERIAL \
-osg::ref_ptr<osg::Material> mat = getMaterial(element); \
-if (mat) { \
- osg::ref_ptr<osg::StateSet> nodeSS = geode->getOrCreateStateSet(); \
-\
- nodeSS->setAttribute(mat.get()); \
- nodeSS->setMode( GL_BLEND, osg::StateAttribute::ON ); \
-/* nodeSS->setRenderingHint( osg::StateSet::TRANSPARENT_BIN ); \
- nodeSS->setMode( GL_DEPTH_TEST, osg::StateAttribute::ON ); \
- osg::Depth* depth = new osg::Depth; \
- depth->setWriteMask( false ); \
- nodeSS->setAttributeAndModes( depth, osg::StateAttribute::ON ); \
- nodeSS->setMode( GL_LIGHTING, osg::StateAttribute::OFF );*/ \
-}
-
-#define OSG_SET_COLOR \
-bool validColor = true; \
-osg::Vec4 color = getColor(element, "color", validColor); \
-if (validColor) \
-drawable->setColor(color);
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new OSGInvokerProvider() );
- return true;
-}
-#endif
-
-#define OSG_TAG_HANDLE(tagName, procFunc) \
-} else if (iequals(LOCALNAME(childElem), tagName) && \
- validChildren.find(tagName) != validChildren.end()) { \
- procFunc(childElem);\
-
-
-OSGInvoker::OSGInvoker() {
-}
-
-OSGInvoker::~OSGInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> OSGInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<OSGInvoker> invoker = boost::shared_ptr<OSGInvoker> (new OSGInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data OSGInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void OSGInvoker::send(const SendRequest& req) {
- if (iequals(req.name, "intersect")) {
-
- }
-}
-
-void OSGInvoker::cancel(const std::string sendId) {
-}
-
-void OSGInvoker::invoke(const InvokeRequest& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- setupColors();
-
-// std::cout << req.dom;
-
- // register default event handlers
- Arabica::DOM::Events::EventTarget<std::string> evTarget = Arabica::DOM::Events::EventTarget<std::string>(req.dom);
- evTarget.addEventListener("DOMSubtreeModified", *this, false);
- evTarget.addEventListener("DOMNodeInserted", *this, false);
- evTarget.addEventListener("DOMNodeRemoved", *this, false);
- evTarget.addEventListener("DOMAttrModified", *this, false);
-
- std::set<std::string> validChilds;
- validChilds.insert("display");
-
- // this is somewhat unfortunate, if content contains a single child, we will get that, otherwise its parent (<content>)
- if (iequals(LOCALNAME(req.dom), "display")) {
- processChildren(validChilds, req.dom.getParentNode());
- } else {
- processChildren(validChilds, req.dom);
- }
-}
-
-void OSGInvoker::setupColors() {
- _colors["red"] = osg::Vec4(1.0, 0.0, 0.0, 1.0);
- _colors["cyan"] = osg::Vec4(0.0, 1.0, 1.0, 1.0);
- _colors["blue"] = osg::Vec4(0.0, 0.0, 1.0, 1.0);
- _colors["darkblue"] = osg::Vec4(0.0, 0.0, 0.625, 1.0);
- _colors["lightblue"] = osg::Vec4(0.675, 0.84375,0.89844,1.0);
- _colors["purple"] = osg::Vec4(0.5, 0.0, 0.5, 1.0);
- _colors["yellow"] = osg::Vec4(1.0, 1.0, 0.0, 1.0);
- _colors["lime"] = osg::Vec4(0.0, 1.0, 0.0, 1.0);
- _colors["magenta"] = osg::Vec4(1.0, 0.0, 1.0, 1.0);
- _colors["white"] = osg::Vec4(1.0, 1.0, 1.0, 1.0);
- _colors["silver"] = osg::Vec4(0.75, 0.75, 0.75, 1.0);
- _colors["grey"] = osg::Vec4(0.5, 0.5, 0.5, 1.0);
- _colors["gray"] = osg::Vec4(0.5, 0.5, 0.5, 1.0);
- _colors["black"] = osg::Vec4(0.0, 0.0, 0.0, 1.0);
- _colors["orange"] = osg::Vec4(1.0, 0.644, 0.0, 1.0);
- _colors["brown"] = osg::Vec4(0.644, 0.164, 0.164, 1.0);
- _colors["maroon"] = osg::Vec4(0.5, 0.0, 0.0, 1.0);
- _colors["green"] = osg::Vec4(0.0, 0.5, 0.0, 1.0);
- _colors["olive"] = osg::Vec4(0.5, 0.5, 0.0, 1.0);
-}
-
-void OSGInvoker::runOnMainThread() {
- _displays_t::iterator dispIter = _displays.begin();
- if (_mutex.try_lock()) {
- while(dispIter != _displays.end()) {
- dispIter->second->osgViewer::ViewerBase::frame();
- dispIter++;
- }
- _mutex.unlock();
- }
-}
-
-void OSGInvoker::handleEvent(Arabica::DOM::Events::Event<std::string>& event) {
-// std::cout << "Handling Event!" << std::endl;
- Arabica::DOM::Node<std::string> node(event.getTarget());
- if (_nodes.find(node) != _nodes.end()) {
- osg::ref_ptr<osg::Node> osgNode = _nodes[node];
- if (false) {
- } else if (iequals(LOCALNAME(node), "rotation")) {
- updateRotation(osgNode, event);
- }
- }
-}
-
-void OSGInvoker::processDisplay(const Arabica::DOM::Element<std::string>& element) {
-// std::cout << element << std::endl;
-
- if (_displays.find(element) == _displays.end()) {
-
- int screenId = 0;
- unsigned int actualX = 0;
- unsigned int actualY = 0;
- unsigned int actualWidth = 0;
- unsigned int actualHeight = 0;
- getViewport(element, actualX, actualY, actualWidth, actualHeight, screenId);
-
- CompositeDisplay* compDisp = new CompositeDisplay(actualX, actualY, actualWidth, actualHeight, screenId);
- _displays[element] = compDisp;
-
- std::set<std::string> validChilds;
- validChilds.insert("viewport");
- processChildren(validChilds, element);
- }
-}
-
-void OSGInvoker::processViewport(const Arabica::DOM::Element<std::string>& element) {
- if (_displays.find(element.getParentNode()) == _displays.end())
- return;
-
- CompositeDisplay* compDisp = _displays[element.getParentNode()];
- osgViewer::View* sceneView = new osgViewer::View();
- _views[element] = sceneView;
-
- osg::Group* group = new osg::Group();
- _nodes[element] = group;
- sceneView->setSceneData(group);
-
- std::string name = (HAS_ATTR(element, "id") ? ATTR(element, "id") : UUID::getUUID());
-
- unsigned int actualX = 0;
- unsigned int actualY = 0;
- unsigned int actualWidth = 0;
- unsigned int actualHeight = 0;
-
- getViewport(element, actualX, actualY, actualWidth, actualHeight, compDisp);
- osg::Viewport* viewPort = new osg::Viewport(actualX, actualY, actualWidth, actualHeight);
- compDisp->addView(name, viewPort, sceneView);
-
- bool hasBGColor;
- osg::Vec4 bgColor = getColor(element, "bgcolor", hasBGColor);
- if (hasBGColor) {
- sceneView->getCamera()->setClearColor(bgColor);
- } else {
- sceneView->getCamera()->setClearColor(_colors["white"]);
- }
-
- std::set<std::string> validChilds;
- validChilds.insert("camera");
- validChilds.insert("translation");
- validChilds.insert("rotation");
- validChilds.insert("scale");
- validChilds.insert("node");
- validChilds.insert("sphere");
- validChilds.insert("box");
- validChilds.insert("capsule");
- validChilds.insert("cone");
- validChilds.insert("cylinder");
- processChildren(validChilds, element);
-}
-
-void OSGInvoker::processCamera(const Arabica::DOM::Node<std::string>& element) {}
-void OSGInvoker::updateCamera(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {}
-
-void OSGInvoker::processTranslation(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> node = _nodes[element.getParentNode()];
-
- double x = 0, y = 0, z = 0;
- if (HAS_ATTR(element, "x"))
- x = strTo<float>(ATTR(element, "x"));
- if (HAS_ATTR(element, "y"))
- y = strTo<float>(ATTR(element, "y"));
- if (HAS_ATTR(element, "z"))
- z = strTo<float>(ATTR(element, "z"));
-
- osg::Matrix translate;
- translate.makeTranslate(x, y, z);
-
- osg::MatrixTransform* transform = new osg::MatrixTransform();
- transform->setMatrix(translate);
- node->asGroup()->addChild(transform);
- _nodes[element] = transform;
-
- std::set<std::string> validChilds;
- validChilds.insert("translation");
- validChilds.insert("rotation");
- validChilds.insert("scale");
- validChilds.insert("node");
- validChilds.insert("sphere");
- validChilds.insert("box");
- validChilds.insert("capsule");
- validChilds.insert("cone");
- validChilds.insert("cylinder");
- processChildren(validChilds, element);
-}
-
-void OSGInvoker::processRotation(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> node = _nodes[element.getParentNode()];
-
- osg::Matrix rotation = rotationFromElement(element);
- osg::MatrixTransform* transform = new osg::MatrixTransform();
- transform->setMatrix(rotation);
- node->asGroup()->addChild(transform);
- _nodes[element] = transform;
-
- std::set<std::string> validChilds;
- validChilds.insert("translation");
- validChilds.insert("rotation");
- validChilds.insert("scale");
- validChilds.insert("node");
- validChilds.insert("sphere");
- validChilds.insert("box");
- validChilds.insert("capsule");
- validChilds.insert("cone");
- validChilds.insert("cylinder");
- processChildren(validChilds, element);
-}
-
-void OSGInvoker::updateRotation(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {
- osg::ref_ptr<osg::MatrixTransform> transform = static_cast<osg::MatrixTransform*>(node->asTransform());
- if (false) {
- } else if (iequals(event.getType(), "DOMAttrModified")) {
- osg::Matrix rotation = rotationFromElement(Arabica::DOM::Element<std::string>(Arabica::DOM::Node<std::string>(event.getTarget())));
- transform->setMatrix(rotation);
- }
-}
-
-osg::Matrix OSGInvoker::rotationFromElement(const Arabica::DOM::Element<std::string>& element) {
- double pitch = 0, roll = 0, yaw = 0;
- if (HAS_ATTR(element, "pitch")) {
- NumAttr pitchAttr = NumAttr(ATTR(element, "pitch"));
- if (iequals(pitchAttr.unit, "deg")) {
- pitch = osg::DegreesToRadians(strTo<float>(pitchAttr.value));
- } else if (iequals(pitchAttr.unit, "%")) {
- pitch = osg::DegreesToRadians((strTo<float>(pitchAttr.value) * 360) / 100);
- } else {
- pitch = strTo<float>(pitchAttr.value);
- }
- }
- if (HAS_ATTR(element, "roll")) {
- NumAttr rollAttr = NumAttr(ATTR(element, "roll"));
- if (iequals(rollAttr.unit, "deg")) {
- roll = osg::DegreesToRadians(strTo<float>(rollAttr.value));
- } else if (iequals(rollAttr.unit, "%")) {
- roll = osg::DegreesToRadians((strTo<float>(rollAttr.value) * 360) / 100);
- } else {
- roll = strTo<float>(rollAttr.value);
- }
- }
- if (HAS_ATTR(element, "yaw")) {
- NumAttr yawAttr = NumAttr(ATTR(element, "yaw"));
- if (iequals(yawAttr.unit, "deg")) {
- yaw = osg::DegreesToRadians(strTo<float>(yawAttr.value));
- } else if (iequals(yawAttr.unit, "%")) {
- yaw = osg::DegreesToRadians((strTo<float>(yawAttr.value) * 360) / 100);
- } else {
- yaw = strTo<float>(yawAttr.value);
- }
- }
-
- osg::Matrix rotation;
- rotation.makeRotate(roll, osg::Vec3(0,1,0), // roll
- pitch, osg::Vec3(1,0,0) , // pitch
- yaw, osg::Vec3(0,0,1) ); // heading
-
- return rotation;
-}
-
-void OSGInvoker::processScale(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> node = _nodes[element.getParentNode()];
-
- double x = 1, y = 1, z = 1;
- if (HAS_ATTR(element, "x"))
- x = strTo<float>(ATTR(element, "x"));
- if (HAS_ATTR(element, "y"))
- y = strTo<float>(ATTR(element, "y"));
- if (HAS_ATTR(element, "z"))
- z = strTo<float>(ATTR(element, "z"));
-
- osg::Matrix scale;
- scale.makeScale(x, y, z);
-
- osg::MatrixTransform* transform = new osg::MatrixTransform();
- transform->setMatrix(scale);
- node->asGroup()->addChild(transform);
- _nodes[element] = transform;
-
- std::set<std::string> validChilds;
- validChilds.insert("translation");
- validChilds.insert("rotation");
- validChilds.insert("scale");
- validChilds.insert("node");
- validChilds.insert("sphere");
- validChilds.insert("box");
- validChilds.insert("capsule");
- validChilds.insert("cone");
- validChilds.insert("cylinder");
- processChildren(validChilds, element);
-}
-
-void OSGInvoker::processNode(const Arabica::DOM::Element<std::string>& element) {
- _nodes_t::iterator nodeIter = _nodes.find(element.getParentNode());
- assert(nodeIter != _nodes.end());
-
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()];
-
- std::string filename;
- if (HAS_ATTR(element, "src")) {
- filename = ATTR(element, "src");
-
- if (filename.length() > 0) {
- std::string extension;
- size_t extensionStart = filename.find_last_of(".");
- if (extensionStart != std::string::npos) {
- extension = filename.substr(extensionStart);
- }
-
- URL srcURI(filename);
- if (!srcURI.toAbsolute(_interpreter->getBaseURL(element))) {
- LOG(ERROR) << "invoke element has relative src URI with no baseURI set.";
- return;
- }
- filename = srcURI.asLocalFile(extension);
- osg::ref_ptr<osg::Node> model = osgDB::readNodeFile(filename);
- if (model.get())
- parent->asGroup()->addChild(model);
-
- }
- }
-}
-
-void OSGInvoker::processSphere(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()];
-
- float radius = 1;
- osg::Vec3 center(0,0,0);
-
- if (HAS_ATTR(element, "radius")) {
- radius = strTo<float>(ATTR(element, "radius"));
- }
-
- osg::ref_ptr<osg::Sphere> sphere = new osg::Sphere(center, radius);
- osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(sphere);
- osg::ref_ptr<osg::Geode> geode = new osg::Geode();
- geode->addDrawable(drawable);
-
- OSG_SET_COLOR;
- OSG_SET_MATERIAL;
-
- _nodes[element] = geode;
-
- parent->asGroup()->addChild(geode);
-}
-
-void OSGInvoker::updateSphere(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {
-}
-
-void OSGInvoker::processBox(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()];
-
- float x = 1;
- float y = 1;
- float z = 1;
- osg::Vec3 center(0,0,0);
-
- if (HAS_ATTR(element, "x")) x = strTo<float>(ATTR(element, "x"));
- if (HAS_ATTR(element, "y")) y = strTo<float>(ATTR(element, "y"));
- if (HAS_ATTR(element, "z")) z = strTo<float>(ATTR(element, "z"));
-
- osg::ref_ptr<osg::Box> box = new osg::Box(center, x, y, z);
- osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(box);
- osg::ref_ptr<osg::Geode> geode = new osg::Geode();
- geode->addDrawable(drawable);
-
- OSG_SET_COLOR;
- OSG_SET_MATERIAL;
-
- _nodes[element] = geode;
-
- parent->asGroup()->addChild(geode);
-
-}
-void OSGInvoker::updateBox(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {
-}
-void OSGInvoker::processCapsule(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()];
-
- float radius = 1;
- float height = 1;
- osg::Vec3 center(0,0,0);
-
- if (HAS_ATTR(element, "radius")) radius = strTo<float>(ATTR(element, "radius"));
- if (HAS_ATTR(element, "height")) height = strTo<float>(ATTR(element, "height"));
-
- osg::ref_ptr<osg::Capsule> capsule = new osg::Capsule(center, radius, height);
- osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(capsule);
- osg::ref_ptr<osg::Geode> geode = new osg::Geode();
- geode->addDrawable(drawable);
-
- OSG_SET_COLOR;
- OSG_SET_MATERIAL;
-
- _nodes[element] = geode;
- parent->asGroup()->addChild(geode);
-}
-void OSGInvoker::updateCapsule(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {
-}
-
-void OSGInvoker::processCone(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()];
-
- float radius = 1;
- float height = 1;
- osg::Vec3 center(0,0,0);
-
- if (HAS_ATTR(element, "radius")) radius = strTo<float>(ATTR(element, "radius"));
- if (HAS_ATTR(element, "height")) height = strTo<float>(ATTR(element, "height"));
-
- osg::ref_ptr<osg::Cone> cone = new osg::Cone(center, radius, height);
- osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(cone);
- osg::ref_ptr<osg::Geode> geode = new osg::Geode();
- geode->addDrawable(drawable);
-
- OSG_SET_COLOR;
- OSG_SET_MATERIAL;
-
- _nodes[element] = geode;
-
- parent->asGroup()->addChild(geode);
-
-}
-void OSGInvoker::updateCone(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {
-}
-
-void OSGInvoker::processCylinder(const Arabica::DOM::Element<std::string>& element) {
- assert(_nodes.find(element.getParentNode()) != _nodes.end());
- osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()];
-
- float radius = 1;
- float height = 1;
- osg::Vec3 center(0,0,0);
-
- if (HAS_ATTR(element, "radius")) radius = strTo<float>(ATTR(element, "radius"));
- if (HAS_ATTR(element, "height")) height = strTo<float>(ATTR(element, "height"));
-
- osg::ref_ptr<osg::Cylinder> cylinder = new osg::Cylinder(center, radius, height);
- osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(cylinder);
- osg::ref_ptr<osg::Geode> geode = new osg::Geode();
- geode->addDrawable(drawable);
-
- OSG_SET_COLOR;
- OSG_SET_MATERIAL;
-
- _nodes[element] = geode;
-
- parent->asGroup()->addChild(geode);
-
-}
-void OSGInvoker::updateCylinder(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) {
-}
-
-osg::Vec4 OSGInvoker::getColor(const Arabica::DOM::Element<std::string>& element, const std::string& attr, bool& valid) {
- if (HAS_ATTR(element, attr)) {
- std::string color = ATTR(element, attr);
-
- // is this one of the predefined colors?
- if (_colors.find(color) != _colors.end()) {
- valid = true;
- return _colors[color];
- }
-
- // otherwise try to parse as rgba values
- int i;
- osg::Vec4 colorVec = parseVec4(color, i);
-
- if (i == 1) {
- // only a single value was given, interpret as grey value
- colorVec[1] = colorVec[2] = colorVec[0];
- colorVec[3] = 1.0;
- valid = true;
- return colorVec;
- }
-
- if (i == 3) {
- // three values were given, set opacity to max
- colorVec[3] = 1.0;
- valid = true;
- return colorVec;
- }
- }
-
- // return empty reference
- valid = false;
- return osg::Vec4();
-}
-
-osg::ref_ptr<osg::Material> OSGInvoker::getMaterial(const Arabica::DOM::Element<std::string>& element) {
-
- osg::ref_ptr<osg::Material> nodeMat;
-
- // material color
- bool hasMatColor;
- osg::Vec4 matColor = getColor(element, "materialcolor", hasMatColor);
- if (hasMatColor) {
- if (!nodeMat)
- nodeMat = new osg::Material;
- nodeMat->setDiffuse(osg::Material::FRONT, matColor);
- nodeMat->setDiffuse(osg::Material::BACK, matColor);
- }
-
- // translucency
- if (HAS_ATTR(element, "transparency")) {
- std::string transparency = ATTR(element, "transparency");
- float trans = strTo<float>(transparency);
- if (!nodeMat)
- nodeMat = new osg::Material;
- nodeMat->setTransparency(osg::Material::FRONT, trans);
- nodeMat->setTransparency(osg::Material::BACK, trans);
- }
-
- return nodeMat;
-}
-
-osg::Vec4 OSGInvoker::parseVec4(const std::string& coeffs, int& i) {
-
- // otherwise try to parse as rgba values
- std::string coeff;
- std::stringstream coeffSS(coeffs);
-
- osg::Vec4 vec;
-
- i = 0;
- while(std::getline(coeffSS, coeff, ',')) {
- boost::trim(coeff);
- if (coeff.length() == 0)
- continue;
- if (!isNumeric(coeff.c_str(), 10))
- continue;
-
- vec[i] = strTo<float>(coeff);
- i++;
- }
- return vec;
-}
-
-void OSGInvoker::processChildren(const std::set<std::string>& validChildren, const Arabica::DOM::Node<std::string>& element) {
- Arabica::DOM::NodeList<std::string> childs = element.getChildNodes();
- for (int i = 0; i < childs.getLength(); ++i) {
- if (childs.item(i).getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE)
- continue;
- Arabica::DOM::Element<std::string> childElem = Arabica::DOM::Element<std::string>(childs.item(i));
- if (false) {
- OSG_TAG_HANDLE("node", processNode);
- OSG_TAG_HANDLE("translation", processTranslation);
- OSG_TAG_HANDLE("rotation", processRotation);
- OSG_TAG_HANDLE("scale", processScale);
- OSG_TAG_HANDLE("viewport", processViewport);
- OSG_TAG_HANDLE("camera", processCamera);
- OSG_TAG_HANDLE("display", processDisplay);
- OSG_TAG_HANDLE("sphere", processSphere);
- OSG_TAG_HANDLE("box", processBox);
- OSG_TAG_HANDLE("cone", processCone);
- OSG_TAG_HANDLE("capsule", processCapsule);
- OSG_TAG_HANDLE("cylinder", processCylinder);
- } else {
- LOG(INFO) << "Unknown XML element " << TAGNAME(childElem);
- }
- }
-}
-
-void OSGInvoker::getViewport(const Arabica::DOM::Element<std::string>& element,
- unsigned int& x,
- unsigned int& y,
- unsigned int& width,
- unsigned int& height,
- CompositeDisplay* display) {
- getViewport(element, x, y, width, height, display->getWidth(), display->getHeight());
-
-}
-
-void OSGInvoker::getViewport(const Arabica::DOM::Element<std::string>& element,
- unsigned int& x,
- unsigned int& y,
- unsigned int& width,
- unsigned int& height,
- int& screenId) {
-
- screenId = (HAS_ATTR(element, "screenId") ? strTo<int>(ATTR(element, "screenId")) : 0);
-
- unsigned int fullWidth = 0;
- unsigned int fullHeight = 0;
- CompositeDisplay::getResolution(fullWidth, fullHeight, screenId);
- getViewport(element, x, y, width, height, fullWidth, fullHeight);
-}
-
-void OSGInvoker::getViewport(const Arabica::DOM::Element<std::string>& element,
- unsigned int& x,
- unsigned int& y,
- unsigned int& width,
- unsigned int& height,
- unsigned int fullWidth,
- unsigned int fullHeight) {
- if (HAS_ATTR(element, "x")) {
- NumAttr xAttr = NumAttr(ATTR(element, "x"));
- x = strTo<float>(xAttr.value);
- if (iequals(xAttr.unit, "%"))
- x = (x * fullWidth) / 100;
- }
- if (HAS_ATTR(element, "y")) {
- NumAttr yAttr = NumAttr(ATTR(element, "y"));
- y = strTo<float>(yAttr.value);
- if (iequals(yAttr.unit, "%"))
- y = (y * fullHeight) / 100;
- }
- if (HAS_ATTR(element, "width")) {
- NumAttr widthAttr = NumAttr(ATTR(element, "width"));
- width = strTo<float>(widthAttr.value);
- if (iequals(widthAttr.unit, "%"))
- width = (width * fullWidth) / 100;
- }
- if (HAS_ATTR(element, "height")) {
- NumAttr heightAttr = NumAttr(ATTR(element, "height"));
- height = strTo<float>(heightAttr.value);
- if (iequals(heightAttr.unit, "%"))
- height = (height * fullHeight) / 100;
- }
-}
-
-osgViewer::View* OSGInvoker::getView(const Arabica::DOM::Node<std::string>& element) {
- Arabica::DOM::Node<std::string> curr = element;
- while(curr && !iequals(LOCALNAME(curr), "viewport")) {
- curr = curr.getParentNode();
- }
- if (curr && _views.find(curr) != _views.end())
- return _views[curr];
- return NULL;
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
deleted file mode 100644
index 30be8ca..0000000
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef OSGINVOKER_H_H6T4R8HU
-#define OSGINVOKER_H_H6T4R8HU
-
-#include <uscxml/Interpreter.h>
-#include <DOM/Events/MutationEvent.hpp>
-#include <DOM/Events/EventListener.hpp>
-#include <DOM/Events/Event.hpp>
-
-#include "CompositeDisplay.h"
-#include <osg/MatrixTransform>
-#include <osg/Material>
-#include <osgDB/ReadFile>
-
-#include <set>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class OSGInvoker : public InvokerImpl, public Arabica::DOM::Events::EventListener<std::string> {
-public:
- OSGInvoker();
- virtual ~OSGInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("3d");
- names.push_back("scenegraph");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#3d");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
- virtual void handleEvent(Arabica::DOM::Events::Event<std::string>& event);
-
- virtual void runOnMainThread();
-
-protected:
- void processDisplay(const Arabica::DOM::Element<std::string>& element);
- void updateDisplay(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- void processViewport(const Arabica::DOM::Element<std::string>& element);
- void updateViewport(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- void processCamera(const Arabica::DOM::Node<std::string>& element);
- void updateCamera(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
-
- void processTranslation(const Arabica::DOM::Element<std::string>& element);
- void updateTranslation(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
-
- void processRotation(const Arabica::DOM::Element<std::string>& element);
- void updateRotation(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- static osg::Matrix rotationFromElement(const Arabica::DOM::Element<std::string>& element);
-
- void processScale(const Arabica::DOM::Element<std::string>& element);
- void updateScale(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
-
- void processNode(const Arabica::DOM::Element<std::string>& element);
- void updateNode(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
-
- void processSphere(const Arabica::DOM::Element<std::string>& element);
- void updateSphere(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- void processBox(const Arabica::DOM::Element<std::string>& element);
- void updateBox(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- void processCapsule(const Arabica::DOM::Element<std::string>& element);
- void updateCapsule(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- void processCone(const Arabica::DOM::Element<std::string>& element);
- void updateCone(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
- void processCylinder(const Arabica::DOM::Element<std::string>& element);
- void updateCylinder(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event);
-
- osg::Vec4 getColor(const Arabica::DOM::Element<std::string>& element, const std::string& attr, bool& valid);
- osg::ref_ptr<osg::Material> getMaterial(const Arabica::DOM::Element<std::string>& element);
- osg::Vec4 parseVec4(const std::string& coeffs, int& number);
-
- void processChildren(const std::set<std::string>& validChildren, const Arabica::DOM::Node<std::string>& element);
-
- void getViewport(const Arabica::DOM::Element<std::string>& element,
- unsigned int& x,
- unsigned int& y,
- unsigned int& width,
- unsigned int& height,
- int& screenId);
-
- void getViewport(const Arabica::DOM::Element<std::string>& element,
- unsigned int& x,
- unsigned int& y,
- unsigned int& width,
- unsigned int& height,
- CompositeDisplay* display);
-
- void getViewport(const Arabica::DOM::Element<std::string>& element,
- unsigned int& x,
- unsigned int& y,
- unsigned int& width,
- unsigned int& height,
- unsigned int fullWidth,
- unsigned int fullHeight);
-
- osgViewer::View* getView(const Arabica::DOM::Node<std::string>& element);
-
- std::map<Arabica::DOM::Node<std::string>, CompositeDisplay*> _displays;
- typedef std::map<Arabica::DOM::Node<std::string>, CompositeDisplay*> _displays_t;
-
- std::map<Arabica::DOM::Node<std::string>, osgViewer::View*> _views;
- typedef std::map<Arabica::DOM::Node<std::string>, osgViewer::View*> _views_t;
-
- std::map<Arabica::DOM::Node<std::string>, osg::ref_ptr<osg::Node> > _nodes;
- typedef std::map<Arabica::DOM::Node<std::string>, osg::ref_ptr<osg::Node> > _nodes_t;
-
- void setupColors();
- std::map<std::string, osg::Vec4> _colors;
- typedef std::map<std::string, osg::Vec4> _colors_t;
-
- tthread::recursive_mutex _mutex;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(OSGInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: OSGINVOKER_H_H6T4R8HU */
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp
deleted file mode 100644
index 2a68be7..0000000
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp
+++ /dev/null
@@ -1,611 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "OSGConverter.h"
-#include <glog/logging.h>
-#include "uscxml/config.h"
-
-#include <osg/MatrixTransform>
-#include <osg/Node>
-#include <osg/Group>
-#include <osg/ComputeBoundsVisitor>
-#include <osgUtil/Optimizer>
-#include <osgDB/ReadFile>
-#include <osgDB/WriteFile>
-#include <osgDB/Registry>
-#include <osgGA/TrackballManipulator>
-#include <osgGA/AnimationPathManipulator>
-#include <osg/ShapeDrawable>
-
-#include <boost/lexical_cast.hpp>
-#include <boost/algorithm/string.hpp>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#define EVAL_PARAM_EXPR(param, expr, key) \
-if (param.find(key) == param.end() && param.find(expr) != param.end() && _interpreter->getDataModel()) \
- param.insert(std::make_pair(key, Data(_interpreter->getDataModel().evalAsString(param.find(expr)->second.atom), Data::INTERPRETED)));
-
-#define CAST_PARAM(param, var, key, type) \
-if (param.find(key) != param.end()) { \
- try { var = boost::lexical_cast<type>(param.find(key)->second.atom); } \
- catch(...) { LOG(ERROR) << "Attribute " key " of sendrequest to osgconverter is of invalid format: " << param.find(key)->second.atom; } \
-}
-
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new OSGConverterProvider() );
- return true;
-}
-#endif
-
-OSGConverter::OSGConverter() : _isRunning(false) {
-// osg::setNotifyLevel(osg::DEBUG_FP);
- osg::setNotifyLevel(osg::FATAL);
-}
-
-OSGConverter::~OSGConverter() {
- _isRunning = false;
- std::set<tthread::thread*>::iterator threadIter = _threads.begin();
- while(threadIter != _threads.end()) {
- (*threadIter)->join();
- }
-};
-
-boost::shared_ptr<InvokerImpl> OSGConverter::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<OSGConverter> invoker = boost::shared_ptr<OSGConverter>(new OSGConverter());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data OSGConverter::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void OSGConverter::send(const SendRequest& req) {
-
- /**
- * we have to resolve all datamodel dependent strings first as
- * we cannot access the datamodel from within another thread without locking
- */
-
- // make a copy
- SendRequest actualReq(req);
-
- if (actualReq.params.find("source") == actualReq.params.end()) {
- // no explicit source
- if (actualReq.params.find("sourceexpr") != actualReq.params.end() && _interpreter->getDataModel()) {
- actualReq.params.insert(std::make_pair("source", _interpreter->getDataModel().getStringAsData(actualReq.params.find("sourceexpr")->second)));
- } else {
- LOG(ERROR) << "SendRequests for osginvoker missing source or sourceExpr and datamodel";
- reportFailure(req);
- return;
- }
- }
-
- if (actualReq.params.find("dest") == actualReq.params.end()) {
- // no explicit destination
- if (actualReq.params.find("destexpr") != actualReq.params.end() && _interpreter->getDataModel()) {
- actualReq.params.insert(std::make_pair("dest", _interpreter->getDataModel().getStringAsData(actualReq.params.find("destexpr")->second)));
- boost::algorithm::replace_all(actualReq.params.find("dest")->second.atom, "//", "/");
- boost::algorithm::replace_all(actualReq.params.find("dest")->second.atom, "\\\\", "\\");
- }
- }
-
- if (actualReq.params.find("autorotate") == actualReq.params.end()) {
- if (actualReq.params.find("autorotateexpr") != actualReq.params.end()) {
- if (_interpreter->getDataModel()) {
- actualReq.params.insert(std::make_pair("autorotate", _interpreter->getDataModel().getStringAsData(actualReq.params.find("autorotateexpr")->second)));
- } else {
- LOG(ERROR) << "SendRequests for osginvoker ncludes autorotateexpr but no datamodel is specified";
- reportFailure(req);
- return;
- }
- }
- }
-
- // support for multiple formats at the same time
- std::list<Data> formats;
- Event::getParam(req.params, "format", formats);
- for (std::list<Data>::const_iterator formatIter = formats.begin(); formatIter != formats.end(); formatIter++) {
- actualReq.params.insert(std::make_pair("format", *formatIter));
- }
-
- // format given as expression
- std::list<Data> formatExprs;
- Event::getParam(req.params, "formatexpr", formatExprs);
- for (std::list<Data>::const_iterator formatIter = formatExprs.begin(); formatIter != formatExprs.end(); formatIter++) {
- actualReq.params.insert(std::make_pair("format", _interpreter->getDataModel().getStringAsData(*formatIter)));
- }
-
- if (actualReq.params.find("format") == actualReq.params.end()) {
- // no explicit format, try to get from destination
- std::string dest;
- if (Event::getParam(actualReq.params, "dest", dest)) {
- std::string format;
- size_t lastDot;
- if ((lastDot = dest.find_last_of(".")) != std::string::npos) {
- lastDot++;
- format = dest.substr(lastDot, dest.length() - lastDot);
- actualReq.params.insert(std::make_pair("format", Data(format, Data::VERBATIM)));
- }
- }
- }
-
- if (actualReq.params.find("format") == actualReq.params.end()) {
- LOG(ERROR) << "missing format";
- reportFailure(req);
- return;
- }
-
- EVAL_PARAM_EXPR(actualReq.params, "heightexpr", "height");
- EVAL_PARAM_EXPR(actualReq.params, "widthexpr", "width");
- EVAL_PARAM_EXPR(actualReq.params, "pitchexpr", "pitch");
- EVAL_PARAM_EXPR(actualReq.params, "rollexpr", "roll");
- EVAL_PARAM_EXPR(actualReq.params, "yawexpr", "yaw");
- EVAL_PARAM_EXPR(actualReq.params, "zoomexpr", "zoom");
- EVAL_PARAM_EXPR(actualReq.params, "xexpr", "x");
- EVAL_PARAM_EXPR(actualReq.params, "yexpr", "y");
- EVAL_PARAM_EXPR(actualReq.params, "zexpr", "z");
-
-// process(actualReq);
- _workQueue.push(actualReq);
-}
-
-void OSGConverter::cancel(const std::string sendId) {
-}
-
-void OSGConverter::invoke(const InvokeRequest& req) {
- int nrThreads = 1;
-
- if (req.params.find("threads") != req.params.end() && isNumeric(req.params.find("threads")->second.atom.c_str(), 10)) {
- nrThreads = strTo<int>(req.params.find("threads")->second);
- }
-
- _isRunning = true;
- for (int i = 0; i < nrThreads; i++) {
- _threads.insert(new tthread::thread(OSGConverter::run, this));
- }
-}
-
-void OSGConverter::run(void* instance) {
- OSGConverter* INSTANCE = (OSGConverter*)instance;
- while(true) {
- SendRequest req = INSTANCE->_workQueue.pop();
- if (INSTANCE->_isRunning) {
- INSTANCE->process(req);
- } else {
- return;
- }
- }
-}
-
-void OSGConverter::process(const SendRequest& req) {
-
-// std::cout << req;
-
- int width = 640;
- int height = 480;
- Event::getParam(req.params, "width", width);
- Event::getParam(req.params, "height", height);
-
- assert(req.params.find("source") != req.params.end());
- assert(req.params.find("format") != req.params.end());
-
- std::string source;
- if (!Event::getParam(req.params, "source", source)) {
- reportFailure(req);
- LOG(ERROR) << "No source given for convert request";
- return;
- }
-
- std::string dest;
- Event::getParam(req.params, "dest", dest);
-
- std::list<Data> formats;
- if (!Event::getParam(req.params, "format", formats)) {
- reportFailure(req);
- LOG(ERROR) << "No format given for convert request";
- return;
- }
-
- bool autoRotate = true;
- if (req.params.find("autorotate") != req.params.end()) {
- if (iequals(req.params.find("autorotate")->second.atom, "off") ||
- iequals(req.params.find("autorotate")->second.atom, "0") ||
- iequals(req.params.find("autorotate")->second.atom, "false")) {
- autoRotate = false;
- }
- }
-
- bool optimizeGeometry = false;
- if (req.params.find("optimizegeometry") != req.params.end()) {
- if (iequals(req.params.find("optimizegeometry")->second.atom, "on") ||
- iequals(req.params.find("optimizegeometry")->second.atom, "1") ||
- iequals(req.params.find("optimizegeometry")->second.atom, "true")) {
- optimizeGeometry = true;
- }
- }
-
- bool antiAliased = true;
- if (req.params.find("antialiased") != req.params.end()) {
- if (iequals(req.params.find("antialiased")->second.atom, "off") ||
- iequals(req.params.find("antialiased")->second.atom, "0") ||
- iequals(req.params.find("antialiased")->second.atom, "false")) {
- antiAliased = false;
- }
- }
-
- // get the 3D scene
- osg::ref_ptr<osg::Node> model = setupGraph(source, autoRotate);
- if (model->asGroup()->getNumChildren() == 0) {
- reportFailure(req);
- LOG(ERROR) << "Could not setup scenegraph";
- return;
- }
-
- if (optimizeGeometry) {
- osgUtil::Optimizer optimizer;
- optimizer.optimize(model, osgUtil::Optimizer::ALL_OPTIMIZATIONS);
- }
-
- Data retContent;
-
- // setup scenegraph
- osg::ref_ptr<osg::Group> sceneGraph = new osg::Group();
- sceneGraph->addChild(model);
- ((osg::MatrixTransform*)model.get())->setMatrix(requestToModelPose(req));
- osg::BoundingSphere bs = model->getBound();
-
- for (std::list<Data>::iterator formatIter = formats.begin(); formatIter != formats.end(); formatIter++) {
- std::string format = *formatIter;
-
- osg::ref_ptr<osgDB::ReaderWriter> writer = osgDB::Registry::instance()->getReaderWriterForExtension(format);
-
- if (writer.valid()) {
- // conversion from 3d model to 3d model
- std::stringstream ss;
- osgDB::ReaderWriter::WriteResult result;
- osgDB::ReaderWriter::Options* rwOptions = new osgDB::ReaderWriter::Options();
-
- // pass option to disable tristrips when writing osgjs files
- if (strcmp(format.c_str(), "osgjs") == 0)
- rwOptions->setOptionString("disableTriStrip");
-
- result = writer->writeNode(*sceneGraph, ss, rwOptions);
- if (result.success()) {
- if (dest.length() > 0) {
- std::ofstream outFile(dest.c_str());
- outFile << ss.str();
- }
- retContent.compound[format] = Data(ss.str().c_str(), ss.str().size(), URL::getMimeType(format), false);
- continue;
- }
- }
-
- // conversion from 3d model to image
- tthread::lock_guard<tthread::recursive_mutex> lock(_viewerMutex);
- osgViewer::Viewer viewer;
- osg::Camera *camera = viewer.getCamera();
-
- osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
- osg::GraphicsContext::Traits;
- traits->width = width;
- traits->height = height;
- traits->pbuffer = true;
-
- traits->readDISPLAY();
- if (antiAliased) {
- traits->samples = 4; // to make anti-aliased.
- osg::DisplaySettings* ds = osg::DisplaySettings::instance();
- ds->setNumMultiSamples(4);
- viewer.setDisplaySettings(ds);
- }
- osg::GraphicsContext *gc =
- osg::GraphicsContext::createGraphicsContext(traits.get());
-
- camera->setGraphicsContext(gc);
- camera->setDrawBuffer(GL_FRONT);
- camera->setViewport(new osg::Viewport(0, 0, width, height));
-
- viewer.setSceneData(sceneGraph);
-
- viewer.setCameraManipulator(new osgGA::TrackballManipulator());
- viewer.getCamera()->setClearColor(osg::Vec4f(1.0f,1.0f,1.0f,1.0f));
- viewer.getCamera()->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- double zoom = 1;
- CAST_PARAM(req.params, zoom, "zoom", double);
-
- viewer.getCameraManipulator()->setByMatrix(osg::Matrix::lookAt(osg::Vec3d(0,0,bs.radius() * (-3.4 * zoom)), // eye
- (osg::Vec3d)bs.center(), // center
- osg::Vec3d(0,0,1))); // up
-
- osg::Image *image = new osg::Image();
- camera->attach(osg::Camera::COLOR_BUFFER0, image);
-
- viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
- viewer.realize();
- viewer.frame();
-
- std::string tempFile = URL::getTmpFilename(format);
-
- if (!osgDB::writeImageFile(*image, tempFile)) {
- LOG(ERROR) << "Could write image file at " << tempFile;
- return;
- }
-
- // read file into buffer
- char* buffer = NULL;
- size_t length = 0;
- {
- std::ifstream file(tempFile.c_str());
-
- file.seekg(0, std::ios::end);
- length = file.tellg();
- file.seekg(0, std::ios::beg);
- buffer = (char*)malloc(length);
- file.read(buffer, length);
- }
-
- retContent.compound[format] = Data(buffer, length, URL::getMimeType(format), false);
- }
-
- if (retContent.compound.size()) {
- reportSuccess(req, retContent);
- } else {
- reportFailure(req);
- }
- return;
-}
-
-void OSGConverter::reportSuccess(const SendRequest& req, const Data& content) {
- Event event(req);
-
-// for (Event::params_t::const_iterator paramIter = req.params.begin(); paramIter != req.params.end(); paramIter++) {
-// Data foo = paramIter->second;
-// std::cout << paramIter->first << " = " << foo << std::endl;
-// }
-
- if (event.name.length() == 0)
- event.name = "convert";
- event.name += ".success";
-
- if (!content.empty())
- event.data.compound["content"] = content;
- returnEvent(event);
-}
-
-void OSGConverter::reportFailure(const SendRequest& req) {
- Event event(req);
- if (event.name.length() == 0)
- event.name = "convert";
- event.name += ".failure";
- returnEvent(event);
-}
-
-osg::Matrix OSGConverter::requestToModelPose(const SendRequest& req) {
- double pitch = 0;
- double roll = 0;
- double yaw = 0;
- double x = 0;
- double y = 0;
- double z = 0;
- CAST_PARAM(req.params, pitch, "pitch", double);
- CAST_PARAM(req.params, roll, "roll", double);
- CAST_PARAM(req.params, yaw, "yaw", double);
- CAST_PARAM(req.params, x, "x", double);
- CAST_PARAM(req.params, y, "y", double);
- CAST_PARAM(req.params, z, "z", double);
-
- osg::Matrix m = eulerToMatrix(pitch, roll, yaw) * osg::Matrix::translate(-1 * x, -1 * y, -1 * z);
-#if 0
- dumpMatrix(m);
-#endif
- return m;
-}
-
-osg::Matrix OSGConverter::requestToCamPose(const SendRequest& req) {
-// double zoom = 1;
-// CAST_PARAM(req.params, zoom, "zoom", double);
-// osg::Matrix scale = osg::Matrix::scale(zoom, zoom, zoom);
-// return scale;
- osg::Matrix identity;
- identity.makeIdentity();
- return identity;
-}
-
-osg::ref_ptr<osg::Node> OSGConverter::setupGraph(const std::string filename, bool autoRotate) {
-
- // get some privacy
- tthread::lock_guard<tthread::recursive_mutex> lock(_cacheMutex);
-
- /**
- * root (model pose)
- * - rotate (autoRotate to face largest side)
- * - modelCenter (center model)
- * - model (actual model)
- */
-
- long now = tthread::chrono::system_clock::now();
-
- {
-
- // do we have it in the cache?
- if (_models.find(filename) == _models.end()) {
- osg::ref_ptr<osg::Node> model = osgDB::readNodeFile(filename);
- if (!model.valid()) {
- LOG(ERROR) << "Cannot load model from " << filename;
- return new osg::MatrixTransform();
- }
- _models[filename] = std::make_pair(now, model);
- }
- _models[filename].first = now;
-
-#if 1
- // remove old models from cache
- std::map<std::string, std::pair<long, osg::ref_ptr<osg::Node> > >::iterator modelIter = _models.begin();
- while(modelIter != _models.end()) {
- // delete every model unused for 1 minutes
- if (now - modelIter->second.first > 6000) {
- _models.erase(modelIter++);
- } else {
- modelIter++;
- }
- }
-
-#endif
- }
-
- osg::ref_ptr<osg::MatrixTransform> root = new osg::MatrixTransform();
- osg::ref_ptr<osg::MatrixTransform> rotate = new osg::MatrixTransform();
- osg::ref_ptr<osg::Node> model = _models[filename].second;
-
- // translation matrix to move model into center
- osg::ref_ptr<osg::MatrixTransform> modelCenter = new osg::MatrixTransform();
- modelCenter->addChild(model);
- rotate->addChild(modelCenter);
-
- // move bounding sphere center into origin
- osg::BoundingSphere bs = model->getBound();
- modelCenter->setMatrix(osg::Matrix::translate(bs.center() *= -1));
-
- // get bounding box
- osg::ComputeBoundsVisitor cbv;
- osg::BoundingBox& bb(cbv.getBoundingBox());
- modelCenter->accept(cbv);
-
- if (autoRotate) {
- double depth = bb.zMax() - bb.zMin();
- double width = bb.xMax() - bb.xMin();
- double height = bb.yMax() - bb.yMin();
-
- double frontArea = width * height;
- double sideArea = depth * height;
- double topArea = depth * width;
-
- // rotate by multiples of 90deg to face largest area
- if (frontArea < sideArea || frontArea < topArea) {
- if (sideArea < topArea) {
- // top needs to come to front -> rotate on x
- rotate->setMatrix(osg::Matrix::rotate(M_PI_2, osg::Vec3f(1.0,0,0)));
- } else {
- // side needs to come to front
- rotate->setMatrix(osg::Matrix::rotate(M_PI_2, osg::Vec3f(0,1.0,0)));
- }
- }
- }
-
- // add rotation to root
- root->addChild(rotate);
- return root;
-}
-
-osg::ref_ptr<osg::Node> OSGConverter::getOrigin() {
- osg::Geode* geode = new osg::Geode();
-// osg::StateSet* stateset = new osg::StateSet();
-// stateset->setMode(GL_LIGHTING, osg::StateAttribute::ON);
-// geode->setStateSet(stateset);
-
- geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f),1)));
- geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(10.0f,0.0f,0.0f),0.5)));
- geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,10.0f,0.0f),2)));
- geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,10.0f),4)));
- // geode->addDrawable(new osg::ShapeDrawable(new osg::Cone(osg::Vec3(4.0f,0.0f,0.0f),radius,height),hints));
-
- return geode;
-}
-
-osg::Matrix OSGConverter::eulerToMatrix(double pitch, double roll, double yaw) {
- // see http://www.flipcode.com/documents/matrfaq.html#Q36
- osg::Matrix m;
- m.makeIdentity();
-
- double A = cos(pitch);
- double B = sin(pitch);
- double C = cos(roll);
- double D = sin(roll);
- double E = cos(yaw);
- double F = sin(yaw);
-
- double AD = A * D;
- double BD = B * D;
-
- m(0,0) = C * E;
- m(0,1) = -C * F;
- m(0,2) = -D;
- m(1,0) = -BD * E + A * F;
- m(1,1) = BD * F + A * E;
- m(1,2) = -B * C;
- m(2,0) = AD * E + B * F;
- m(2,1) = -AD * F + B * E;
- m(2,2) = A * C;
-
- m(0,3) = m(1,3) = m(2,3) = m(3,0) = m(3,1) = m(3,2) = 0;
- m(3,3) = 1;
-
- return m;
-}
-
-void OSGConverter::matrixToEuler(const osg::Matrix& m, double& pitch, double& roll, double& yaw) {
- // see: http://www.flipcode.com/documents/matrfaq.html#Q37
- double angle_x, angle_z;
- double D = -1 * asin(m(0,2)); /* Calculate Y-axis angle */
- double angle_y = D;
- double C = cos(angle_y);
-
- /* Gimball lock? */
- if ( fabs( C ) > 0.005 ) {
- double tr_x = m(2,2) / C; /* No, so get X-axis angle */
- double tr_y = -1 * m(1,2) / C;
- angle_x = atan2( tr_y, tr_x );
- tr_x = m(0,0) / C; /* Get Z-axis angle */
- tr_y = -1 * m(0,1) / C;
- angle_z = atan2( tr_y, tr_x );
- } else {
- /* Gimball lock has occurred */
- angle_x = 0; /* Set X-axis angle to zero */
- double tr_x = m(1,1); /* And calculate Z-axis angle */
- double tr_y = m(1,0);
- angle_z = atan2( tr_y, tr_x );
- }
-
- pitch = fmod(angle_x, 2 * M_PI ); /* Clamp all angles to range */
- roll = fmod( angle_y, 2 * M_PI );
- yaw = fmod( angle_z, 2 * M_PI );
-}
-
-void OSGConverter::dumpMatrix(const osg::Matrix& m) {
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < 4; j++) {
- std::cout << ", " << m(i, j);
- }
- std::cout << std::endl;
- }
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
deleted file mode 100644
index 10e6fc9..0000000
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef OSGCONVERTER_H_W09J90F0
-#define OSGCONVERTER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-#include <osg/Node>
-#include <osgViewer/ViewerEventHandlers>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class OSGConverter : public InvokerImpl {
-public:
- OSGConverter();
- virtual ~OSGConverter();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("osgconverter");
- names.push_back("osgconvert");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#osgconverter");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#osgconvert");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
- void reportSuccess(const SendRequest& req, const Data& content);
- void reportFailure(const SendRequest& req);
-
- osg::Matrix requestToModelPose(const SendRequest& req);
- osg::Matrix requestToCamPose(const SendRequest& req);
-
- static void dumpMatrix(const osg::Matrix& m);
- static osg::Matrix eulerToMatrix(double pitch, double roll, double yaw);
- static void matrixToEuler(const osg::Matrix& m, double& pitch, double& roll, double& yaw);
-
-protected:
-
- uscxml::concurrency::BlockingQueue<SendRequest> _workQueue;
- osg::ref_ptr<osg::Node> setupGraph(const std::string filename, bool autoRotate = false);
- osg::ref_ptr<osg::Node> getOrigin();
-
- tthread::recursive_mutex _viewerMutex;
-
- std::map<std::string, std::pair<long, osg::ref_ptr<osg::Node> > > _models;
- tthread::recursive_mutex _cacheMutex;
-
- std::set<tthread::thread*> _threads;
-
- static void run(void*);
- void process(const SendRequest& req);
-
- bool _isRunning;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(OSGConverter, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: OSGCONVERTER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp
deleted file mode 100644
index 0b54228..0000000
--- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "HeartbeatInvoker.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new HeartbeatInvokerProvider() );
- return true;
-}
-#endif
-
-HeartbeatInvoker::HeartbeatInvoker() {
-}
-
-HeartbeatInvoker::~HeartbeatInvoker() {
- cancel("");
-};
-
-boost::shared_ptr<InvokerImpl> HeartbeatInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<HeartbeatInvoker> invoker = boost::shared_ptr<HeartbeatInvoker>(new HeartbeatInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data HeartbeatInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void HeartbeatInvoker::send(const SendRequest& req) {
-}
-
-void HeartbeatInvoker::cancel(const std::string sendId) {
- HeartbeatDispatcher::getInstance()->cancelEvent(toStr(this));
-}
-
-void HeartbeatInvoker::invoke(const InvokeRequest& req) {
- _invokeId = req.invokeid;
- _event.invokeid = _invokeId;
- std::string intervalStr;
- double interval = 0;
- unsigned long intervalMs = 0;
- InvokeRequest::params_t::const_iterator paramIter = req.params.begin();
- while(paramIter != req.params.end()) {
- if (iequals(paramIter->first, "interval")) {
- intervalStr = paramIter->second.atom;
- NumAttr intervalAttr(paramIter->second.atom);
- interval = strTo<double>(intervalAttr.value);
- if (false) {
- } else if (iequals(intervalAttr.unit, "s")) {
- intervalMs = interval * 1000;
- } else if (iequals(intervalAttr.unit, "ms")) {
- intervalMs = interval;
- } else {
- intervalMs = interval;
- }
- }
- if (iequals(paramIter->first, "eventname")) {
- _event.name = paramIter->second.atom;
- }
- paramIter++;
- }
- if (_event.name.length() == 0)
- _event.name = std::string("heartbeat." + intervalStr);
-
- if (intervalMs > 0) {
- HeartbeatDispatcher::getInstance()->addEvent(toStr(this), HeartbeatInvoker::dispatch, intervalMs, this, true);
- }
-}
-
-void HeartbeatInvoker::dispatch(void* instance, std::string name) {
- HeartbeatInvoker* invoker = (HeartbeatInvoker*)instance;
- invoker->returnEvent(invoker->_event);
-}
-
-HeartbeatDispatcher* HeartbeatDispatcher::_instance = NULL;
-HeartbeatDispatcher* HeartbeatDispatcher::getInstance() {
- if (_instance == NULL) {
- _instance = new HeartbeatDispatcher();
- _instance->start();
- }
- return _instance;
-}
-
-HeartbeatDispatcher::HeartbeatDispatcher() {}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
deleted file mode 100644
index f0bc32c..0000000
--- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef HEARTBEATINVOKER_H_W09J90F0
-#define HEARTBEATINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class HeartbeatInvoker : public InvokerImpl {
-public:
- HeartbeatInvoker();
- virtual ~HeartbeatInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("heartbeat");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#heartbeat");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
- static void dispatch(void* instance, std::string name);
-
-protected:
- Event _event;
-
-};
-
-class HeartbeatDispatcher : public DelayedEventQueue {
-public:
- static HeartbeatDispatcher* getInstance();
-protected:
- static HeartbeatDispatcher* _instance;
- HeartbeatDispatcher();
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(HeartbeatInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: HEARTBEATINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
deleted file mode 100644
index 1e0fced..0000000
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "HTTPServletInvoker.h"
-#include <glog/logging.h>
-
-#include "uscxml/config.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new HTTPServletInvokerProvider() );
- return true;
-}
-#endif
-
-HTTPServletInvoker::HTTPServletInvoker() {
-}
-
-HTTPServletInvoker::~HTTPServletInvoker() {
- HTTPServer::unregisterServlet(this);
-
-};
-
-boost::shared_ptr<InvokerImpl> HTTPServletInvoker::create(InterpreterImpl* 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) {
-
- 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, Data>::const_iterator nameListIter = req.namelist.begin();
- while(nameListIter != req.namelist.end()) {
- httpReply.headers[nameListIter->first] = nameListIter->second.atom;
- nameListIter++;
- }
-
- std::multimap<std::string, Data>::const_iterator paramIter = req.params.begin();
- while(paramIter != req.params.end()) {
- httpReply.headers[paramIter->first] = paramIter->second.atom;
- paramIter++;
- }
-
- HTTPServer::reply(httpReply);
- return;
- }
-}
-
-void HTTPServletInvoker::cancel(const std::string sendId) {
-}
-
-void HTTPServletInvoker::invoke(const InvokeRequest& req) {
-
- _invokeId = req.invokeid;
- if (req.params.find("path") == req.params.end()) {
- LOG(ERROR) << "Path parameter required with httpserver";
- }
- _path = (*req.params.find("path")).second.atom;
-
- if (req.params.find("callback") != req.params.end()) {
- _callback = (*req.params.find("callback")).second.atom;
- } 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
- */
-bool HTTPServletInvoker::httpRecvRequest(const HTTPServer::Request& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
-// evhttp_request_own(req.curlReq);
-
- _requests[toStr((uintptr_t)req.evhttpReq)] = req;
-
- Event event = req;
-
- event.name = _callback;
- event.data.compound["reqId"] = Data(toStr((uintptr_t)req.evhttpReq), Data::VERBATIM);
-
- returnEvent(event);
- return true;
-}
-
-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
deleted file mode 100644
index 59c25ca..0000000
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#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();
- virtual ~HTTPServletInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("httpservlet");
- names.push_back("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 bool httpRecvRequest(const HTTPServer::Request& req);
- virtual std::string getPath();
- virtual void setURL(const std::string& url) {
- _url = url;
- }
- bool canAdaptPath() {
- return false;
- }
-
-protected:
- tthread::recursive_mutex _mutex;
- std::map<std::string, HTTPServer::Request> _requests;
- std::string _path;
- std::string _callback;
- std::string _url;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(HTTPServletInvoker, InvokerImpl);
-#endif
-
-}
-
-#endif /* end of include guard: HTTPSERVERINVOKER_H_OAAWX8NF */
diff --git a/src/uscxml/plugins/invoker/im/IMConfig.h.in b/src/uscxml/plugins/invoker/im/IMConfig.h.in
deleted file mode 100644
index b43fef6..0000000
--- a/src/uscxml/plugins/invoker/im/IMConfig.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#define LIBPURPLE_VERSION_MAJOR @LIBPURPLE_VERSION_MAJOR@
-#define LIBPURPLE_VERSION_MINOR @LIBPURPLE_VERSION_MINOR@
-#define LIBPURPLE_VERSION_PATCH @LIBPURPLE_VERSION_PATCH@
-#define LIBPURPLE_VERSION "@LIBPURPLE_VERSION@"
diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.cpp b/src/uscxml/plugins/invoker/im/IMInvoker.cpp
deleted file mode 100644
index f111743..0000000
--- a/src/uscxml/plugins/invoker/im/IMInvoker.cpp
+++ /dev/null
@@ -1,1409 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "IMInvoker.h"
-#include <glog/logging.h>
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/dom/NameSpacingParser.h"
-#include <boost/algorithm/string.hpp>
-
-#include "uscxml/concurrency/DelayedEventQueue.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#define GET_INSTANCE_IN_CALLBACK(account) \
-tthread::lock_guard<tthread::recursive_mutex> lock(_accountMutex); \
-IMInvoker* inst = NULL;\
-if (_accountInstances.find(account) == _accountInstances.end()) { \
- LOG(ERROR) << "Callback for unknown account called"; \
-} else {\
- inst = _accountInstances[account];\
-}
-
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new IMInvokerProvider() );
- return true;
-}
-#endif
-
-Data IMInvoker::_pluginData;
-GHashTable* IMInvoker::_uiInfo = NULL;
-GRand* IMInvoker::_gRand = NULL;
-
-PurpleEventLoopUiOps IMInvoker::_uiEventLoopOps = {
- purpleEventTimeoutAdd,
- purpleEventTimeoutRemove,
- purpleEventInputAdd,
- purpleEventInputRemove,
- purpleEventInputGetError,
- purpleEventTimeoutAddSec,
- NULL,
- NULL,
- NULL
-};
-
-PurpleDebugUiOps IMInvoker::_uiDebugOps = {
- purpleDebugPrint,
- purpleDebugIsEnabled,
- NULL, NULL, NULL, NULL
-};
-
-PurpleAccountUiOps IMInvoker::_uiAccountOps = {
- accountNotifyAdded,
- accountStatusChanged,
- accountRequestAdd,
- accountRequestAuthorize,
- accountCloseRequest,
- NULL,
- NULL,
- NULL
-};
-
-PurpleBlistUiOps IMInvoker::_uiBuddyOps = {
- purpleNewList,
- purpleNewNode,
- purpleShow,
- NULL, // purpleUpdate,
- NULL, // purpleRemove,
- NULL, // purpleDestroy,
- NULL, // purpleSetVisible,
- purpleRequestAddBuddy,
- purpleRequestAddChat,
- purpleRequestAddGroup,
- NULL, // purpleSaveNode,
- NULL, // purpleRemoveNode,
- NULL, // purpleSaveAccount,
-};
-
-// file transfer
-PurpleXferUiOps IMInvoker::_uiXferOps = {
- purpleNewXfer,
- purpleDestroy,
- purpleAddXfer,
- purpleUpdateProgress,
- purpleCancelLocal,
- purpleCancelRemote,
- purpleWrite,
- purpleRead,
- purpleDataNotSent,
- purpleAddThumbnail
-};
-
-// connection info
-PurpleConnectionUiOps IMInvoker::_uiConnectOps = {
- purpleConnectProgress,
- purpleConnected,
- purpleDisonnected,
- purpleNotice,
-#if LIBPURPLE_VERSION_MAJOR >= 3
- purpleNetworkConnected,
- purpleNetworkDisconnected,
- purpleReportDisconnect,
- NULL,
- NULL,
- NULL
-#else
- purpleReportDisconnect,
- purpleNetworkConnected,
- purpleNetworkDisconnected,
- NULL,
- NULL,
- NULL
-#endif
-};
-
-//libpurple conversation operations
-PurpleConversationUiOps IMInvoker::_uiConvOps = {
- NULL, //purpleCreateConversation,
- NULL, //purpleDestroyConversation,
- NULL, //purpleWriteChat,
- NULL, //purpleWriteIm,
- purpleWriteConv,
- NULL, //purpleChatRenameUser,
- NULL, //purpleChatRemoveUsers,
- NULL, //purpleChatUpdateUser,
- NULL, //purplePresentConversation,
- NULL, //purpleHasFocus,
- NULL, //purpleCustomSmileyAdd,
- NULL, //purpleCustomSmileyWrite,
- NULL, //purpleCustomSmileyClose,
- NULL, //purpleSendConfirm,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PurpleNotifyUiOps IMInvoker::_uiNotifyOps = {
- purpeNotifyMessage,
- purpeNotifyEmail,
- purpeNotifyEmails,
- purpeNotifyFormatted,
- purpeNotifySearchResults,
- purpeNotifySearchResultsNewRows,
- purpeNotifyUserInfo,
- purpeNotifyURI,
- purpeNotifyClose,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-#if LIBPURPLE_VERSION_MAJOR < 3
-PurplePrivacyUiOps IMInvoker::_uiPrivacyOps = {
- purplePermitAdded,
- purplePermitRemoved,
- purpleDebyAdded,
- purpleDenyRemoved,
- NULL,
- NULL,
- NULL,
- NULL
-};
-#endif
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
-PurpleRequestFeature IMInvoker::_features;
-#endif
-PurpleRequestUiOps IMInvoker::_uiRequestOps = {
-#if LIBPURPLE_VERSION_MAJOR >= 3
- _features,
- purpleRequestInput,
- purpleRequestChoice,
- purpleRequestAction,
- purpleRequestWait,
- purpleRequestWaitUpdate,
- purpleRequestFields,
- purpleRequestFile,
- purpleRequestFolder,
- purpleRequestClose,
- NULL,
- NULL,
- NULL,
- NULL
-#else
- purpleRequestInput,
- purpleRequestChoice,
- purpleRequestAction,
- purpleRequestFields,
- purpleRequestFile,
- purpleRequestClose,
- purpleRequestFolder,
- purpleRequestActionWithIcon,
- NULL,
- NULL,
- NULL
-
-#endif
-
-};
-
-PurpleWhiteboardUiOps IMInvoker::_uiWhiteboardOps = {
- purpleCreateWB,
- purpleDestroyWB,
- purpleSetDimensions,
- purpleSetBrush,
- purpleDrawPont,
- purpleDrawLine,
- purpleClearWB,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PurpleCoreUiOps IMInvoker::_uiCoreOps = {
- purplePrefsInit,
- NULL,
- purpleUIInit,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-DelayedEventQueue* IMInvoker::_eventQueue = NULL;
-
-tthread::mutex IMInvoker::_initMutex;
-tthread::condition_variable IMInvoker::_initCond;
-
-tthread::recursive_mutex IMInvoker::_accountMutex;
-std::map<PurpleAccount*, IMInvoker*> IMInvoker::_accountInstances;
-
-void IMInvoker::setupPurpleSignals() {
- int handle;
- // connection signals
- purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, PURPLE_CALLBACK(signedOnCB), NULL);
-
- // conversation signals
- purple_signal_connect(purple_conversations_get_handle(), "conversation-created", &handle, PURPLE_CALLBACK(conversationCreatedCB), NULL);
- purple_signal_connect(purple_conversations_get_handle(), "chat-joined", &handle, PURPLE_CALLBACK(chatJoinedCB), NULL);
- purple_signal_connect(purple_conversations_get_handle(), "chat-join-failed", &handle, PURPLE_CALLBACK(chatJoinFailedCB), NULL);
- purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", &handle, PURPLE_CALLBACK(buddyTypingCB), NULL);
- purple_signal_connect(purple_conversations_get_handle(), "buddy-typed", &handle, PURPLE_CALLBACK(buddyTypedCB), NULL);
- purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", &handle, PURPLE_CALLBACK(buddyTypingStoppedCB), NULL);
-
- // buddy signals
- purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNON));
- purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNOFF));
- purple_signal_connect(purple_blist_get_handle(), "buddy-got-login-time", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNON_TIME));
- purple_signal_connect(purple_blist_get_handle(), "buddy-idle-changed", &handle, PURPLE_CALLBACK(buddyIdleChangedCB), NULL);
- purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", &handle, PURPLE_CALLBACK(buddyStatusChangedCB), NULL);
- purple_signal_connect(purple_blist_get_handle(), "buddy-icon-changed", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_ICON));
- purple_signal_connect(purple_blist_get_handle(), "buddy-added", &handle, PURPLE_CALLBACK(buddyAddedCB), NULL);
- purple_signal_connect(purple_blist_get_handle(), "buddy-removed", &handle, PURPLE_CALLBACK(buddyRemovedCB), NULL);
- purple_signal_connect(purple_blist_get_handle(), "blist-node-aliased", &handle, PURPLE_CALLBACK(blistNodeAliasedCB), NULL);
- purple_signal_connect(purple_blist_get_handle(), "buddy-caps-changed", &handle, PURPLE_CALLBACK(buddyCapsChangedCB), NULL);
-
- // xfer signals
- purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", &handle, PURPLE_CALLBACK(fileRecvRequestCB), NULL);
-
-}
-
-void IMInvoker::initLibPurple(void *userdata, const std::string event) {
- _initMutex.lock();
-
- _uiInfo = g_hash_table_new(g_str_hash, g_str_equal);
-// g_hash_table_insert(_uiInfo, "name", (char*)"uscxml");
-// g_hash_table_insert(_uiInfo, "version", "0.0.3");
-// g_hash_table_insert(_uiInfo, "website", "http://uscxml.tk.informatik.tu-darmstadt.de");
-// g_hash_table_insert(_uiInfo, "dev_website", "http://uscxml.tk.informatik.tu-darmstadt.de");
-// g_hash_table_insert(_uiInfo, "client_type", "pc");
-
- _gRand = g_rand_new();
-
- /* Set a custom user directory (optional) */
- //purple_util_set_user_dir(CUSTOM_USER_DIRECTORY);
-
- /* We do not want any debugging for now to keep the noise to a minimum. */
- purple_debug_set_enabled(false);
-
- purple_core_set_ui_ops(&_uiCoreOps);
- purple_eventloop_set_ui_ops(&_uiEventLoopOps);
-
- purple_plugins_add_search_path("/usr/local/lib/purple-3");
- // purple_plugins_probe(G_MODULE_SUFFIX);
-
- if (!purple_core_init("uscxml")) {
- LOG(ERROR) << "libpurple initialization failed." << std::endl;
- return;
- }
-
- /* Load the preferences. */
- purple_prefs_load();
- purple_plugins_load_saved("/purple/uscxml/plugins/saved");
-
- GList *l;
- PurplePlugin *plugin;
-
- for (l = purple_plugins_get_all(); l != NULL; l = l->next) {
- plugin = (PurplePlugin *)l->data;
-
- Data pluginData;
- if (plugin->info->id) pluginData.compound["id"] = Data(plugin->info->id, Data::VERBATIM);
- if (plugin->info->homepage) pluginData.compound["homepage"] = Data(plugin->info->homepage, Data::VERBATIM);
- if (plugin->info->author) pluginData.compound["author"] = Data(plugin->info->author, Data::VERBATIM);
- if (plugin->info->description) pluginData.compound["description"] = Data(plugin->info->description, Data::VERBATIM);
- if (plugin->info->name) pluginData.compound["name"] = Data(plugin->info->name, Data::VERBATIM);
- if (plugin->info->summary) pluginData.compound["summary"] = Data(plugin->info->summary, Data::VERBATIM);
- if (plugin->info->version) pluginData.compound["version"] = Data(plugin->info->version, Data::VERBATIM);
- if (plugin->info->major_version) pluginData.compound["majorVersion"] = Data(toStr(plugin->info->major_version), Data::VERBATIM);
- if (plugin->info->minor_version) pluginData.compound["minorVersion"] = Data(toStr(plugin->info->minor_version), Data::VERBATIM);
-
- if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) {
- _pluginData.compound["protocol"].compound[plugin->info->id] = pluginData;
- } else if (plugin->info->type == PURPLE_PLUGIN_STANDARD) {
-// _pluginData.compound["standard"].compound[plugin->info->id] = pluginData;
- } else if (plugin->info->type == PURPLE_PLUGIN_LOADER) {
-// _pluginData.compound["loader"].compound[plugin->info->id] = pluginData;
- }
- }
-
- _initMutex.unlock();
- _initCond.notify_all();
-}
-
-// purple event callbacks
-void IMInvoker::signedOnCB(PurpleConnection *gc, gpointer null) {
- PurpleAccount *account = purple_connection_get_account(gc);
- GET_INSTANCE_IN_CALLBACK(account);
- if (!inst)
- return;
-
-#if 0
- GSList *buddies = purple_find_buddies(purple_connection_get_account(gc), NULL);
- GSList *cur;
- for (cur = buddies; cur; cur = cur->next) {
- buddyAddedCB((PurpleBuddy *)cur->data);
- }
- g_slist_free(buddies);
-#endif
-
- // set my status to active
- PurpleSavedStatus* status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE);
- purple_savedstatus_activate(status);
-
- Event retEv("im.signed.on");
- inst->returnEvent(retEv);
-}
-
-void IMInvoker::conversationCreatedCB(PurpleConversation *conv, void *data) {}
-void IMInvoker::chatJoinedCB(PurpleConversation *conv, void *data) {}
-void IMInvoker::chatJoinFailedCB(PurpleConnection *gc, GHashTable *components) {}
-void IMInvoker::buddyTypingCB(PurpleAccount *account, const char *name, void *data) {
- std::cout << "buddyTypingCB" << std::endl;
-}
-void IMInvoker::buddyTypedCB(PurpleAccount *account, const char *name, void *data) {
- std::cout << "buddyTypedCB" << std::endl;
-}
-void IMInvoker::buddyTypingStoppedCB(PurpleAccount *account, const char *name, void *data) {
- std::cout << "buddyTypingStoppedCB" << std::endl;
-}
-
-void IMInvoker::buddyEventCB(PurpleBuddy *buddy, PurpleBuddyEvent event) {
- if (!buddy)
- return;
-
- PurpleAccount *account = purple_buddy_get_account(buddy);
- GET_INSTANCE_IN_CALLBACK(account);
- if (!inst)
- return;
-
- switch (event) {
- case PURPLE_BUDDY_SIGNOFF:
- case PURPLE_BUDDY_SIGNON: {
- PurplePresence* presence = purple_buddy_get_presence(buddy);
- PurpleStatus* status = purple_presence_get_active_status(presence);
- buddyStatusChangedCB(buddy, NULL, status, event);
- break;
- }
- case PURPLE_BUDDY_ICON:
- break;
-
- default:
- break;
- }
-
-}
-
-void IMInvoker::buddyIdleChangedCB(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, PurpleBuddyEvent event) {
-}
-
-void IMInvoker::buddyStatusChangedCB(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *newstatus, PurpleBuddyEvent event) {
- PurpleAccount *account = purple_buddy_get_account(buddy);
- GET_INSTANCE_IN_CALLBACK(account);
-
- std::string buddyName = purple_buddy_get_name(buddy);
- Data buddyData = buddyToData(buddy);
- inst->_dataModelVars.compound["buddies"].compound[buddyName] = buddyData;
-
- Event retEv("im.buddy.status.changed");
- retEv.data = buddyData;
- inst->returnEvent(retEv);
-
-}
-
-void IMInvoker::buddyAddedCB(PurpleBuddy* buddy) {
- PurpleAccount *account = purple_buddy_get_account(buddy);
- GET_INSTANCE_IN_CALLBACK(account);
- if (!inst)
- return;
-
- std::string buddyName = purple_buddy_get_name(buddy);
-
- Event retEv("im.buddy.added");
- retEv.data.compound["name"] = Data(buddyName, Data::VERBATIM);
- inst->returnEvent(retEv);
-
- buddyStatusChangedCB(buddy, NULL, purple_presence_get_active_status(purple_buddy_get_presence(buddy)), PURPLE_BUDDY_NONE);
-
-}
-
-void IMInvoker::buddyRemovedCB(PurpleBuddy* buddy) {
- PurpleAccount *account = purple_buddy_get_account(buddy);
- GET_INSTANCE_IN_CALLBACK(account);
- std::string buddyName = purple_buddy_get_name(buddy);
-
- Event retEv("im.buddy.removed");
- retEv.data.compound["name"] = Data(buddyName, Data::VERBATIM);
- inst->returnEvent(retEv);
-
- inst->_dataModelVars.compound["buddies"].compound.erase(buddyName);
-
-}
-
-void IMInvoker::blistNodeAliasedCB(PurpleBlistNode *node, char *old_alias) {
-}
-
-void IMInvoker::fileRecvRequestCB(PurpleXfer *xfer) {
- purple_xfer_set_local_filename(xfer, "");
-}
-
-
-void IMInvoker::buddyCapsChangedCB(PurpleBuddy* buddy, PurpleMediaCaps newcaps, PurpleMediaCaps oldcaps) {
- PurpleAccount *account = purple_buddy_get_account(buddy);
- GET_INSTANCE_IN_CALLBACK(account);
-}
-
-Data IMInvoker::statusToData(PurpleStatus *status) {
- Data data;
- const char* statusName = purple_status_get_name(status);
- if (statusName) data.compound["name"] = Data(statusName, Data::VERBATIM);
-
- PurpleStatusType* statusType = PURPLE_STATUS_GET_TYPE(status);
-
- GList *statusAttrElem;
- PURPLE_STATUS_ATTR* statusAttr;
- GList *statusAttrList = purple_status_type_get_attrs(statusType);
-
- for(statusAttrElem = statusAttrList; statusAttrElem; statusAttrElem = statusAttrElem->next) {
- statusAttr = (PURPLE_STATUS_ATTR*)statusAttrElem->data;
- const char* statusAttrId = PURPLE_STATUS_ATTR_GET_ID(statusAttr);
- PURPLE_VALUE* statusValue = purple_status_get_attr_value(status, statusAttrId);
- if (statusValue) {
- data.compound[statusAttrId] = purpleValueToData(statusValue);
- }
- }
-
- data.compound["active"] = Data((bool)purple_status_is_active(status));
- data.compound["available"] = Data((bool)purple_status_is_available(status));
- data.compound["exclusive"] = Data((bool)purple_status_is_exclusive(status));
- data.compound["active"] = Data((bool)purple_status_is_active(status));
- data.compound["independent"] = Data((bool)purple_status_is_independent(status));
- data.compound["online"] = Data((bool)purple_status_is_online(status));
-
- return data;
-}
-
-Data IMInvoker::buddyToData(PurpleBuddy *buddy) {
- Data data;
- std::string buddyName = purple_buddy_get_name(buddy);
-
- if (purple_buddy_get_name(buddy)) data.compound["name"] = Data(purple_buddy_get_name(buddy), Data::VERBATIM);
- if (purple_buddy_get_alias(buddy)) data.compound["alias"] = Data(purple_buddy_get_alias(buddy), Data::VERBATIM);
- if (purple_buddy_get_alias_only(buddy)) data.compound["aliasOnly"] = Data(purple_buddy_get_alias_only(buddy), Data::VERBATIM);
- if (purple_buddy_get_server_alias(buddy)) data.compound["server"] = Data(purple_buddy_get_server_alias(buddy), Data::VERBATIM);
-
- PurpleGroup* group = purple_buddy_get_group(buddy);
- if (group) {
- if (purple_group_get_name(group)) data.compound["group"] = Data(purple_group_get_name(group), Data::VERBATIM);
- }
-
- PurpleBuddyIcon* icon = purple_buddy_get_icon(buddy);
- if (icon) {
- size_t iconSize = 0;
- gconstpointer iconData = purple_buddy_icon_get_data(icon, &iconSize);
- data.compound["icon"] = Data((char*)iconData, iconSize, "application/octet-stream", false);
- }
-
- PurplePresence* presence = purple_buddy_get_presence(buddy);
-
- if (presence) {
- GList *statusElem;
- GList *statusList = purple_presence_get_statuses(presence);
- PurpleStatus* status;
-
- for(statusElem = statusList; statusElem; statusElem = statusElem->next) {
- status = (PurpleStatus*)statusElem->data;
- const char* statusId = purple_status_get_id(status);
- PurpleStatusPrimitive statusPrimitive = purple_primitive_get_type_from_id(statusId);
-
- // only include active states
- if(statusPrimitive == PURPLE_STATUS_UNSET || !purple_presence_is_status_primitive_active(presence, statusPrimitive))
- continue;
- data.compound["status"].compound[statusId] = statusToData(status);
- }
- }
-
- return data;
-}
-
-Data IMInvoker::purpleValueToData(PURPLE_VALUE* value) {
- Data data;
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
- if (false) {
- } else if (g_type_check_value_holds(value, G_TYPE_CHAR)) {
- data = Data(g_value_get_schar(value), Data::VERBATIM);
-
- } else if (g_type_check_value_holds(value, G_TYPE_UCHAR)) {
- data = Data(g_value_get_uchar(value), Data::VERBATIM);
-
- } else if (g_type_check_value_holds(value, G_TYPE_BOOLEAN)) {
- data = Data(g_value_get_boolean(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_INT)) {
- data = Data(g_value_get_int(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_UINT)) {
- data = Data(g_value_get_uint(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_LONG)) {
- data = Data(g_value_get_long(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_ULONG)) {
- data = Data(g_value_get_ulong(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_INT64)) {
- data = Data(g_value_get_int64(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_FLOAT)) {
- data = Data(g_value_get_float(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_DOUBLE)) {
- data = Data(g_value_get_double(value));
-
- } else if (g_type_check_value_holds(value, G_TYPE_STRING)) {
- const gchar* tmp = g_value_get_string(value);
- if (tmp == NULL) {
- data = Data("", Data::VERBATIM);
- } else {
- data = Data(g_value_get_string(value), Data::VERBATIM);
- }
-
- } else if (g_type_check_value_holds(value, G_TYPE_OBJECT) ||
- g_type_check_value_holds(value, G_TYPE_PARAM) ||
- g_type_check_value_holds(value, G_TYPE_POINTER) ||
- g_type_check_value_holds(value, G_TYPE_FLAGS) ||
- g_type_check_value_holds(value, G_TYPE_ENUM)) {
- LOG(ERROR) << "purple thingy not supported";
- } else {
- LOG(ERROR) << "purple thingy unknown";
- }
-#else
- switch (purple_value_get_type(value)) {
- case PURPLE_TYPE_BOOLEAN:
- if (purple_value_get_boolean(value))
- data = Data("true");
- data = Data("false");
- break;
- case PURPLE_TYPE_STRING:
- if (purple_value_get_string(value)) {
- data = Data(purple_value_get_string(value), Data::VERBATIM);
- }
- break;
- case PURPLE_TYPE_CHAR:
- Data(purple_value_get_char(value));
- break;
- case PURPLE_TYPE_UCHAR:
- Data(purple_value_get_uchar(value));
- break;
- case PURPLE_TYPE_SHORT:
- Data(purple_value_get_short(value));
- break;
- case PURPLE_TYPE_USHORT:
- Data(purple_value_get_ushort(value));
- break;
- case PURPLE_TYPE_INT:
- Data(purple_value_get_int(value));
- break;
- case PURPLE_TYPE_UINT:
- Data(purple_value_get_uint(value));
- break;
- case PURPLE_TYPE_LONG:
- Data(purple_value_get_long(value));
- break;
- case PURPLE_TYPE_ULONG:
- Data(purple_value_get_ulong(value));
- break;
- case PURPLE_TYPE_INT64:
- Data(purple_value_get_int64(value));
- break;
- case PURPLE_TYPE_UINT64:
- Data(purple_value_get_uint64(value));
- break;
- case PURPLE_TYPE_OBJECT:
- case PURPLE_TYPE_POINTER:
- case PURPLE_TYPE_ENUM:
- case PURPLE_TYPE_BOXED:
- case PURPLE_TYPE_UNKNOWN:
- case PURPLE_TYPE_SUBTYPE:
- LOG(ERROR) << "purple thingy not supported";
- break;
- }
-#endif
- return data;
-}
-
-IMInvoker::IMInvoker() {
- _account = NULL;
-}
-
-IMInvoker::~IMInvoker() {
- if (_account) {
- _accountMutex.lock();
- _accountInstances.erase(_account);
-// purple_account_destroy(_account);
- _accountMutex.unlock();
- }
-};
-
-boost::shared_ptr<InvokerImpl> IMInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<IMInvoker> invoker = boost::shared_ptr<IMInvoker>(new IMInvoker());
-
- if (!_eventQueue) {
- tthread::lock_guard<tthread::mutex> lock(_initMutex);
- _eventQueue = new DelayedEventQueue();
- _eventQueue->addEvent("initLibPurple", IMInvoker::initLibPurple, 0, NULL);
- _eventQueue->start();
- // make sure to have the shebang initialized when we leave
- _initCond.wait(_initMutex);
- }
-
- invoker->_dataModelVars.compound["plugins"] = _pluginData;
- return invoker;
-}
-
-Data IMInvoker::getDataModelVariables() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_accountMutex);
- return _dataModelVars;
-}
-
-void IMInvoker::send(const SendRequest& req) {
- EventContext* ctx = new EventContext();
- ctx->sendReq = req;
- ctx->instance = this;
-
- std::string eventId = UUID::getUUID();
- _eventQueue->addEvent(eventId, IMInvoker::send, 0, ctx);
- return;
-}
-
-void IMInvoker::send(void *userdata, const std::string event) {
- // we are in the thread that manages all of libpurple
- EventContext* ctx = (EventContext*)userdata;
-
- if (!ctx)
- return;
-
- if (!ctx->instance || !ctx->instance->_account) {
- ctx->instance->returnErrorExecution("No account available");
- delete(ctx);
- return;
- }
-
- if (iequals(ctx->sendReq.name, "im.send")) {
- std::string receiver;
- Event::getParam(ctx->sendReq.params, "receiver", receiver);
-
- Data data;
- Event::getParam(ctx->sendReq.params, "data", data);
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
- PurpleIMConversation* conv = purple_im_conversation_new(ctx->instance->_account, receiver.c_str());
- if (ctx->sendReq.content.length() > 0)
- purple_conversation_send(PURPLE_CONVERSATION(conv), ctx->sendReq.content.c_str());
-#else
- PurpleConversation* conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, ctx->instance->_account, receiver.c_str());
- if (ctx->sendReq.content.length() > 0)
- purple_conv_im_send(purple_conversation_get_im_data(conv), ctx->sendReq.content.c_str());
-#endif
-
-#if 0
- if (data.binary) {
- PurpleConnection *gc = purple_account_get_connection(ctx->instance->_account);
- PurplePlugin *prpl;
- PurplePluginProtocolInfo *prpl_info;
-
-
- if (gc) {
- prpl = purple_connection_get_prpl(gc);
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-
-// if (prpl_info && prpl_info->new_xfer) {
-// PurpleXfer* xfer = (prpl_info->new_xfer)(purple_account_get_connection(ctx->instance->_account), receiver.c_str());
-// purple_xfer_set_local_filename(xfer, "/Users/sradomski/Documents/W3C Standards.pdf");
-// purple_xfer_set_filename(xfer, "asdfadsf.pdf");
-// purple_xfer_request(xfer);
-// purple_xfer_request_accepted(xfer, "/Users/sradomski/Documents/W3C Standards.pdf");
-// }
-
- //Set the filename
-// purple_xfer_set_local_filename(xfer, [[fileTransfer localFilename] UTF8String]);
-// purple_xfer_set_filename(xfer, [[[fileTransfer localFilename] lastPathComponent] UTF8String]);
-// xfer->ui_data
-// purple_xfer_request(xfer);
-
- serv_send_file(gc, "sradomski@localhost", "/Users/sradomski/Documents/W3C Standards.pdf");
-// if (prpl_info->send_file && (prpl_info->can_receive_file && prpl_info->can_receive_file(gc, receiver.c_str()))) {
-// prpl_info->send_file(gc, receiver.c_str(), "/Users/sradomski/Documents/W3C Standards.pdf");
-// }
-// prpl_info->send_raw(gc, data.binary->data, data.binary->size);
- }
-
- }
-#endif
- } else if (iequals(ctx->sendReq.name, "im.buddy.add")) {
- std::string buddyName;
- Event::getParam(ctx->sendReq.params, "name", buddyName);
-
- std::string reqMsg;
- Event::getParam(ctx->sendReq.params, "msg", reqMsg);
-
- PurpleBuddy* buddy = purple_buddy_new(ctx->instance->_account, buddyName.c_str(), NULL);
- purple_blist_add_buddy(buddy, NULL, NULL, NULL);
-#if LIBPURPLE_VERSION_MAJOR >= 3
- purple_account_add_buddy(ctx->instance->_account, buddy, reqMsg.c_str());
-#else
- purple_account_add_buddy(ctx->instance->_account, buddy);
-#endif
-
- } else if (iequals(ctx->sendReq.name, "im.buddy.remove")) {
- std::string buddyName;
- Event::getParam(ctx->sendReq.params, "name", buddyName);
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
- PurpleBuddy* buddy = purple_blist_find_buddy(ctx->instance->_account, buddyName.c_str());
- if (PURPLE_IS_BUDDY(buddy)) {
- purple_account_remove_buddy(ctx->instance->_account, buddy, purple_buddy_get_group(buddy));
- purple_blist_remove_buddy(buddy);
- }
-#else
- PurpleBuddy* buddy = purple_find_buddy(ctx->instance->_account, buddyName.c_str());
- purple_account_remove_buddy(ctx->instance->_account, buddy, purple_buddy_get_group(buddy));
- purple_blist_remove_buddy(buddy);
-
-#endif
- }
-
- delete(ctx);
-}
-
-void IMInvoker::cancel(const std::string sendId) {
-}
-
-void IMInvoker::invoke(const InvokeRequest& req) {
-
- EventContext* ctx = new EventContext();
- ctx->invokeReq = req;
- ctx->instance = this;
- _eventQueue->addEvent(req.sendid, IMInvoker::invoke, 0, ctx);
- return;
-}
-
-void IMInvoker::invoke(void *userdata, const std::string event) {
- _accountMutex.lock();
-
- EventContext* ctx = (EventContext*)userdata;
- IMInvoker* instance = ctx->instance;
-
- std::string username;
- Event::getParam(ctx->invokeReq.params, "username", username);
- std::string protocolId;
- Event::getParam(ctx->invokeReq.params, "protocol", protocolId);
- std::string password;
- Event::getParam(ctx->invokeReq.params, "password", password);
-
- instance->_account = purple_account_new(username.c_str(), protocolId.c_str());
- _accountInstances[instance->_account] = instance;
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
- purple_account_set_password(instance->_account, password.c_str(), NULL, NULL);
-#else
- purple_account_set_password(instance->_account, password.c_str());
-#endif
- purple_account_set_enabled(instance->_account, "uscxml", true);
-
- GSList* buddies = purple_blist_get_buddies();
- GSList *cur;
- for (cur = buddies; cur; cur = cur->next) {
- std::string buddyName = purple_buddy_get_name((PurpleBuddy *)cur->data);
- Data buddyData = buddyToData((PurpleBuddy *)cur->data);
- instance->_dataModelVars.compound["buddies"].compound[buddyName] = buddyData;
- }
- g_slist_free(buddies);
-
-
-
- delete(ctx);
- _accountMutex.unlock();
-}
-
-guint IMInvoker::purpleEventTimeoutAdd(guint interval, GSourceFunc function, gpointer data) {
- PurpleEventContext* ctx = new PurpleEventContext();
- ctx->function = function;
- ctx->input = NULL;
- ctx->data = data;
- uintptr_t ptr = reinterpret_cast<uintptr_t>(ctx);
-
- _eventQueue->addEvent(toStr(ptr), purpleCallback, interval, ctx);
- return ptr;
-}
-
-gboolean IMInvoker::purpleEventTimeoutRemove(guint handle) {
- _eventQueue->cancelEvent(toStr(handle));
- return true;
-}
-
-guint IMInvoker::purpleEventTimeoutAddSec(guint interval, GSourceFunc function, gpointer data) {
- return purpleEventTimeoutAdd(interval * 1000, function, data);
-}
-
-guint IMInvoker::purpleEventInputAdd(int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer data) {
- PurpleEventContext* ctx = new PurpleEventContext();
- ctx->function = NULL;
- ctx->input = func;
- ctx->inputFD = fd;
- ctx->cond = cond;
- ctx->data = data;
-
- short opMask = 0;
- if (cond & PURPLE_INPUT_READ)
- opMask |= DelayedEventQueue::DEQ_READ;
- if (cond & PURPLE_INPUT_WRITE)
- opMask |= DelayedEventQueue::DEQ_WRITE;
-
- guint eventId = g_rand_int(_gRand);
-// std::cout << "-- Input add " << eventId << " --------" << fd << std::endl;
- _eventQueue->addEvent(toStr(eventId), fd, opMask, purpleCallback, ctx, true);
- return eventId;
-}
-
-gboolean IMInvoker::purpleEventInputRemove(guint handle) {
-// std::cout << "-- Input del " << handle << std::endl;
- _eventQueue->cancelEvent(toStr(handle));
- return true;
-}
-
-int IMInvoker::purpleEventInputGetError(int fd, int *error) {
- int ret;
- socklen_t len;
- len = sizeof(*error);
-
- ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, error, &len);
- if (!ret && !(*error)) {
- /*
- * Taken from Fire's FaimP2PConnection.m:
- * The job of this function is to detect if the connection failed or not
- * There has to be a better way to do this
- *
- * Any socket that fails to connect will select for reading and writing
- * and all reads and writes will fail
- * Any listening socket will select for reading, and any read will fail
- * So, select for writing, if you can write, and the write fails, not connected
- */
-
- {
- fd_set thisfd;
- struct timeval timeout;
-
- FD_ZERO(&thisfd);
- FD_SET(fd, &thisfd);
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- select(fd+1, NULL, &thisfd, NULL, &timeout);
- if(FD_ISSET(fd, &thisfd)) {
- ssize_t length = 0;
- char buffer[4] = {0, 0, 0, 0};
-
- length = write(fd, buffer, length);
- if(length == -1) {
- /* Not connected */
- ret = -1;
- *error = ENOTCONN;
- }
- }
- }
- }
-
- return ret;
-}
-
-void IMInvoker::purpleCallback(void *userdata, const std::string event) {
- PurpleEventContext* ctx = (PurpleEventContext*)userdata;
- if (ctx->function) {
- ctx->function(ctx->data);
- delete ctx;
- } else if(ctx->input) {
-// std::cout << "operating on " << ctx->inputFD << std::endl;
- ctx->input(ctx->data, ctx->inputFD, ctx->cond);
- }
-}
-
-void IMInvoker::purplePrefsInit(void) {
- purple_prefs_add_bool("/auto-login", false);
-}
-
-void IMInvoker::purpleDebugInit(void) {}
-
-void IMInvoker::purpleUIInit(void) {
- purple_accounts_set_ui_ops(&_uiAccountOps);
-// purple_xfers_set_ui_ops(&_uiXferOps);
-// purple_blist_set_ui_ops(&_uiBuddyOps);
-// purple_notify_set_ui_ops(&_uiNotifyOps);
-// purple_privacy_set_ui_ops(&_uiPrivacyOps);
-// purple_request_set_ui_ops(&_uiRequestOps);
-// purple_connections_set_ui_ops(&_uiConnectOps);
-// purple_whiteboard_set_ui_ops(&_uiWhiteboardOps);
- purple_conversations_set_ui_ops(&_uiConvOps);
- purple_debug_set_ui_ops(&_uiDebugOps);
-
- setupPurpleSignals();
-
-}
-void IMInvoker::purpleQuit(void) {}
-
-GHashTable* IMInvoker::purpleGetUIInfo(void) {
- return _uiInfo;
-}
-
-void IMInvoker::accountNotifyAdded(PurpleAccount *account,
- const char *remote_user,
- const char *id,
- const char *alias,
- const char *message) {
- std::cout << "accountNotifyAdded" << std::endl;
-}
-
-void IMInvoker::accountStatusChanged(PurpleAccount *account,
- PurpleStatus *status) {
- std::cout << "accountStatusChanged" << std::endl;
-
-}
-
-void IMInvoker::accountRequestAdd(PurpleAccount *account,
- const char *remote_user,
- const char *id,
- const char *alias,
- const char *message) {
- std::cout << "accountRequestAdd" << std::endl;
-}
-
-void* IMInvoker::accountRequestAuthorize(PurpleAccount *account,
- const char *remote_user,
- const char *id,
- const char *alias,
- const char *message,
- gboolean on_list,
- PurpleAccountRequestAuthorizationCb authorize_cb,
- PurpleAccountRequestAuthorizationCb deny_cb,
- void *user_data) {
- // always accept all "may I add you as a buddy?" requests
-#if LIBPURPLE_VERSION_MAJOR >= 3
- authorize_cb(message, user_data);
-#else
- authorize_cb(user_data);
-#endif
- return user_data;
-}
-
-void IMInvoker::accountCloseRequest(void *ui_handle) {
- std::cout << "accountCloseRequest" << std::endl;
-}
-
-//libpurple conversation operations
-void IMInvoker::purpleCreateConversation(PurpleConversation *conv) {}
-void IMInvoker::purpleDestroyConversation(PurpleConversation *conv) {}
-void IMInvoker::purpleWriteChat(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime) {
- std::cout << "purpleWriteChat" << std::endl;
-}
-void IMInvoker::purpleWriteIm(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime) {
- std::cout << "purpleWriteIm" << std::endl;
-}
-void IMInvoker::purpleWriteConv(PurpleConversation *conv, const char *name, const char *alias, const char *message, PurpleMessageFlags flags, time_t mtime) {
-
- GET_INSTANCE_IN_CALLBACK(purple_conversation_get_account(conv));
- if (inst == NULL)
- return;
-
- Event msgRcvdEv;
- if (flags & PURPLE_MESSAGE_SEND)
- msgRcvdEv.name = "im.send.conv";
- if (flags & PURPLE_MESSAGE_RECV)
- msgRcvdEv.name = "im.rcvd.conv";
-
- if (alias && *alias)
- msgRcvdEv.data.compound["alias"] = Data(alias, Data::VERBATIM);
- if (name && *name)
- msgRcvdEv.data.compound["name"] = Data(name, Data::VERBATIM);
-
- msgRcvdEv.data.compound["conversation"] = Data(purple_conversation_get_name(conv), Data::VERBATIM);
- msgRcvdEv.data.compound["timestamp"] = Data(mtime);
- msgRcvdEv.data.compound["time"] = Data(purple_utf8_strftime("%T", localtime(&mtime)), Data::VERBATIM);
- msgRcvdEv.data.compound["date"] = Data(purple_utf8_strftime("%F", localtime(&mtime)), Data::VERBATIM);
- msgRcvdEv.data.compound["datetime"] = Data(purple_utf8_strftime("%c", localtime(&mtime)), Data::VERBATIM);
-
- msgRcvdEv.data.compound["raw"] = Data(message, Data::VERBATIM);
- if (flags & PURPLE_MESSAGE_RAW) {
- msgRcvdEv.data.compound["message"] = Data(message, Data::VERBATIM);
- } else {
- bool successParse = false; // unfortunate code layout as parsers operator= is private :(
- std::string origErrors;
-
- // try to parse as XHTML
- {
- NameSpacingParser parser = NameSpacingParser::fromXML(message);
- if (!parser.errorsReported()) {
- msgRcvdEv.data.compound["message"].node = parser.getDocument().getDocumentElement();
- successParse = true;
- } else {
- origErrors = parser.errors();
- }
- }
-
- // try again with added XHTML tags
- if (!successParse) {
- NameSpacingParser parser = NameSpacingParser::fromXML(std::string("<html xmlns='http://jabber.org/protocol/xhtml-im'>") +
- std::string("<body xmlns='http://www.w3.org/1999/xhtml'>") +
- message +
- std::string("</body>") +
- std::string("</html>"));
- if (!parser.errorsReported()) {
- msgRcvdEv.data.compound["message"].node = parser.getDocument().getDocumentElement();
- successParse = true;
- } else {
- LOG(ERROR) << "Cannot parse message as XHTML: " << origErrors << std::endl << message;
- }
- }
-
- if (successParse) {
- // prepare stripped message content
- std::list<Arabica::DOM::Node<std::string> > texts = DOMUtils::getElementsByType(msgRcvdEv.data.compound["message"].node, Arabica::DOM::Node_base::TEXT_NODE);
- std::stringstream ssTexts;
- std::string seperator;
- while(texts.size() > 0) {
- ssTexts << seperator << texts.front().getNodeValue();
- texts.pop_front();
- if (ssTexts.str().length() > 0 && isspace(ssTexts.str()[ssTexts.str().length() - 1])) {
- seperator = "";
- } else {
- seperator = " ";
- }
- }
-
- msgRcvdEv.data.compound["stripped"] = Data(ssTexts.str(), Data::VERBATIM);
- }
- // erase for now as JS dump croaks on dom nodes with cycles
- msgRcvdEv.data.compound.erase("message");
- }
-
- msgRcvdEv.data.compound["flags"].compound["send"] = Data((bool)(flags & PURPLE_MESSAGE_SEND));
- msgRcvdEv.data.compound["flags"].compound["rcvd"] = Data((bool)(flags & PURPLE_MESSAGE_RECV));
- msgRcvdEv.data.compound["flags"].compound["system"] = Data((bool)(flags & PURPLE_MESSAGE_SYSTEM));
- msgRcvdEv.data.compound["flags"].compound["auoresponse"] = Data((bool)(flags & PURPLE_MESSAGE_AUTO_RESP));
- msgRcvdEv.data.compound["flags"].compound["activeonly"] = Data((bool)(flags & PURPLE_MESSAGE_ACTIVE_ONLY));
- msgRcvdEv.data.compound["flags"].compound["containsnick"] = Data((bool)(flags & PURPLE_MESSAGE_NICK));
- msgRcvdEv.data.compound["flags"].compound["nolog"] = Data((bool)(flags & PURPLE_MESSAGE_NO_LOG));
- msgRcvdEv.data.compound["flags"].compound["whisper"] = Data((bool)(flags & PURPLE_MESSAGE_WHISPER));
- msgRcvdEv.data.compound["flags"].compound["error"] = Data((bool)(flags & PURPLE_MESSAGE_ERROR));
- msgRcvdEv.data.compound["flags"].compound["delayed"] = Data((bool)(flags & PURPLE_MESSAGE_DELAYED));
- msgRcvdEv.data.compound["flags"].compound["raw"] = Data((bool)(flags & PURPLE_MESSAGE_RAW));
- msgRcvdEv.data.compound["flags"].compound["images"] = Data((bool)(flags & PURPLE_MESSAGE_IMAGES));
- msgRcvdEv.data.compound["flags"].compound["notify"] = Data((bool)(flags & PURPLE_MESSAGE_NOTIFY));
- msgRcvdEv.data.compound["flags"].compound["nolinkify"] = Data((bool)(flags & PURPLE_MESSAGE_NO_LINKIFY));
- msgRcvdEv.data.compound["flags"].compound["invisible"] = Data((bool)(flags & PURPLE_MESSAGE_INVISIBLE));
-
- inst->returnEvent(msgRcvdEv);
-}
-void IMInvoker::purpleChatAddUsers(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals) {}
-void IMInvoker::purpleChatRenameUser(PurpleConversation *conv, const char *old_name, const char *new_name, const char *new_alias) {}
-void IMInvoker::purpleChatRemoveUsers(PurpleConversation *conv, GList *users) {}
-void IMInvoker::purpleChatUpdateUser(PurpleConversation *conv, const char *user) {}
-void IMInvoker::purplePresentConversation(PurpleConversation *conv) {}
-gboolean IMInvoker::purpleHasFocus(PurpleConversation *conv) {
- return true;
-}
-gboolean IMInvoker::purpleCustomSmileyAdd(PurpleConversation *conv, const char *smile, gboolean remote) {
- return true;
-}
-void IMInvoker::purpleCustomSmileyWrite(PurpleConversation *conv, const char *smile, const guchar *data, gsize size) {}
-void IMInvoker::purpleCustomSmileyClose(PurpleConversation *conv, const char *smile) {}
-void IMInvoker::purpleSendConfirm(PurpleConversation *conv, const char *message) {}
-
-// buddy operations
-void IMInvoker::purpleNewList(PurpleBuddyList *list) {
- std::cout << "purpleNewList" << std::endl;
-}
-void IMInvoker::purpleNewNode(PurpleBlistNode *node) {
- std::cout << "purpleNewNode" << std::endl;
-}
-void IMInvoker::purpleShow(PurpleBuddyList *list) {
- std::cout << "purpleShow" << std::endl;
-}
-void IMInvoker::purpleUpdate(PurpleBuddyList *list, PurpleBlistNode *node) {
-}
-void IMInvoker::purpleRemove(PurpleBuddyList *list, PurpleBlistNode *node) {}
-void IMInvoker::purpleDestroy(PurpleBuddyList *list) {}
-void IMInvoker::purpleSetVisible(PurpleBuddyList *list, gboolean show) {}
-void IMInvoker::purpleRequestAddBuddy(PurpleAccount *account, const char *username, const char *group, const char *alias) {
- std::cout << "purpleRequestAddBuddy" << std::endl;
-}
-void IMInvoker::purpleRequestAddChat(PurpleAccount *account, PurpleGroup *group, const char *alias, const char *name) {
- std::cout << "purpleRequestAddChat" << std::endl;
-}
-void IMInvoker::purpleRequestAddGroup(void) {
- std::cout << "purpleRequestAddGroup" << std::endl;
-}
-void IMInvoker::purpleSaveNode(PurpleBlistNode *node) {}
-void IMInvoker::purpleRemoveNode(PurpleBlistNode *node) {}
-void IMInvoker::purpleSaveAccount(PurpleAccount *account) {}
-
-// file transfer operations
-void IMInvoker::purpleNewXfer(PurpleXfer *xfer) {
- std::cout << "purpleNewXfer" << std::endl;
-}
-void IMInvoker::purpleDestroy(PurpleXfer *xfer) {
- std::cout << "purpleDestroy" << std::endl;
-}
-void IMInvoker::purpleAddXfer(PurpleXfer *xfer) {
- std::cout << "purpleAddXfer" << std::endl;
-}
-void IMInvoker::purpleUpdateProgress(PurpleXfer *xfer, double percent) {
- std::cout << "purpleUpdateProgress" << std::endl;
-}
-void IMInvoker::purpleCancelLocal(PurpleXfer *xfer) {
- std::cout << "purpleCancelLocal" << std::endl;
-}
-void IMInvoker::purpleCancelRemote(PurpleXfer *xfer) {
- std::cout << "purpleCancelRemote" << std::endl;
-}
-gssize IMInvoker::purpleWrite(PurpleXfer *xfer, const guchar *buffer, gssize size) {
- std::cout << "purpleWrite" << std::endl;
- return 0;
-}
-gssize IMInvoker::purpleRead(PurpleXfer *xfer, guchar **buffer, gssize size) {
- std::cout << "purpleRead" << std::endl;
- return 0;
-}
-void IMInvoker::purpleDataNotSent(PurpleXfer *xfer, const guchar *buffer, gsize size) {
- std::cout << "purpleDataNotSent" << std::endl;
-}
-void IMInvoker::purpleAddThumbnail(PurpleXfer *xfer, const gchar *formats) {
- std::cout << "purpleAddThumbnail" << std::endl;
-}
-
-// notification operations
-#if LIBPURPLE_VERSION_MAJOR >= 3
-void* IMInvoker::purpeNotifyMessage(PurpleNotifyMsgType type, const char *title, const char *primary, const char *secondary, PurpleRequestCommonParameters *cpar) {
-#else
-void* IMInvoker::purpeNotifyMessage(PurpleNotifyMsgType type, const char *title, const char *primary, const char *secondary) {
-#endif
- return NULL;
-}
-void* IMInvoker::purpeNotifyEmail(PurpleConnection *gc, const char *subject, const char *from, const char *to, const char *url) {
- return NULL;
-}
-void* IMInvoker::purpeNotifyEmails(PurpleConnection *gc, size_t count, gboolean detailed, const char **subjects, const char **froms, const char **tos, const char **urls) {
- return NULL;
-}
-void* IMInvoker::purpeNotifyFormatted(const char *title, const char *primary, const char *secondary, const char *text) {
- return NULL;
-}
-void* IMInvoker::purpeNotifySearchResults(PurpleConnection *gc, const char *title, const char *primary, const char *secondary, PurpleNotifySearchResults *results, gpointer user_data) {
- return NULL;
-}
-void IMInvoker::purpeNotifySearchResultsNewRows(PurpleConnection *gc, PurpleNotifySearchResults *results, void *data) {}
-void* IMInvoker::purpeNotifyUserInfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info) {
- return NULL;
-}
-void* IMInvoker::purpeNotifyURI(const char *uri) {
- return NULL;
-}
-void IMInvoker::purpeNotifyClose(PurpleNotifyType type, void *ui_handle) {}
-
-// privacy ui operations
-void IMInvoker::purplePermitAdded(PurpleAccount *account, const char *name) {}
-void IMInvoker::purplePermitRemoved(PurpleAccount *account, const char *name) {}
-void IMInvoker::purpleDebyAdded(PurpleAccount *account, const char *name) {}
-void IMInvoker::purpleDenyRemoved(PurpleAccount *account, const char *name) {}
-
-
-// request ui operations
-#if LIBPURPLE_VERSION_MAJOR >= 3
-
-void* IMInvoker::purpleRequestInput(const char *title, const char *primary,
- const char *secondary, const char *default_value,
- gboolean multiline, gboolean masked, gchar *hint,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data) {
- return NULL;
-}
-void* IMInvoker::purpleRequestChoice(const char *title, const char *primary,
- const char *secondary, gpointer default_value,
- const char *ok_text, GCallback ok_cb, const char *cancel_text,
- GCallback cancel_cb , PurpleRequestCommonParameters *cpar,
- void *user_data, va_list choices) {
- return NULL;
-}
-void* IMInvoker::purpleRequestAction(const char *title, const char *primary,
- const char *secondary, int default_action,
- PurpleRequestCommonParameters *cpar, void *user_data,
- size_t action_count, va_list actions) {
- return NULL;
-}
-
-void* IMInvoker::purpleRequestWait(const char *title, const char *primary,
- const char *secondary, gboolean with_progress,
- PurpleRequestCancelCb cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data) {
- return NULL;
-}
-
-void IMInvoker::purpleRequestWaitUpdate(void *ui_handle, gboolean pulse, gfloat fraction) {
-}
-
-void* IMInvoker::purpleRequestFields(const char *title, const char *primary,
- const char *secondary, PurpleRequestFields *fields,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data) {
- return NULL;
-}
-void* IMInvoker::purpleRequestFile(const char *title, const char *filename,
- gboolean savedialog, GCallback ok_cb, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data) {
- // click ok
- PurpleXfer *xfer = (PurpleXfer *)user_data;
- PurpleXferType xferType = purple_xfer_get_xfer_type(xfer);
- if (xferType == PURPLE_XFER_TYPE_RECEIVE) {
- ((PurpleRequestFileCb)ok_cb)(user_data, filename);
- } else if (xferType == PURPLE_XFER_TYPE_SEND) {
- if (purple_xfer_get_local_filename(xfer) != NULL && purple_xfer_get_filename(xfer) != NULL) {
- ((PurpleRequestFileCb)ok_cb)(user_data, purple_xfer_get_local_filename(xfer));
- } else {
- ((PurpleRequestFileCb)cancel_cb)(user_data, purple_xfer_get_local_filename(xfer));
- }
- }
- return NULL;
-}
-
-void* IMInvoker::purpleRequestFolder(const char *title, const char *dirname,
- GCallback ok_cb, GCallback cancel_cb
- , PurpleRequestCommonParameters *cpar, void *user_data) {
- return NULL;
-}
-
-void IMInvoker::purpleRequestClose(PurpleRequestType type, void *ui_handle) {
-
-}
-#else
-
-void* IMInvoker::purpleRequestInput(const char *title, const char *primary,
- const char *secondary, const char *default_value,
- gboolean multiline, gboolean masked, gchar *hint,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data) {
- return NULL;
-}
-
-void* IMInvoker::purpleRequestChoice(const char *title, const char *primary,
- const char *secondary, int default_value,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data,
- va_list choices) {
- return NULL;
-}
-
-void* IMInvoker::purpleRequestAction(const char *title, const char *primary,
- const char *secondary, int default_action,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data,
- size_t action_count, va_list actions) {
- return NULL;
-}
-
-void* IMInvoker::purpleRequestFields(const char *title, const char *primary,
- const char *secondary, PurpleRequestFields *fields,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data) {
- return NULL;
-}
-
-void* IMInvoker::purpleRequestFile(const char *title, const char *filename,
- gboolean savedialog, GCallback ok_cb,
- GCallback cancel_cb, PurpleAccount *account,
- const char *who, PurpleConversation *conv,
- void *user_data) {
- return NULL;
-}
-
-void IMInvoker::purpleRequestClose(PurpleRequestType type, void *ui_handle) {
-}
-
-void* IMInvoker::purpleRequestFolder(const char *title, const char *dirname,
- GCallback ok_cb, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data) {
- return NULL;
-}
-
-void* IMInvoker::purpleRequestActionWithIcon(const char *title, const char *primary,
- const char *secondary, int default_action,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv,
- gconstpointer icon_data, gsize icon_size,
- void *user_data,
- size_t action_count, va_list actions) {
- return NULL;
-}
-
-#endif
-
-
-// connection ui operations
-void IMInvoker::purpleConnectProgress(PurpleConnection *gc, const char *text, size_t step, size_t step_count) {}
-void IMInvoker::purpleConnected(PurpleConnection *gc) {}
-void IMInvoker::purpleDisonnected(PurpleConnection *gc) {}
-void IMInvoker::purpleNotice(PurpleConnection *gc, const char *text) {}
-void IMInvoker::purpleNetworkConnected(void) {}
-void IMInvoker::purpleNetworkDisconnected(void) {}
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
-void IMInvoker::purpleReportDisconnect(PurpleConnection *gc, PurpleConnectionError reason, const char *text) {
-#else
-void IMInvoker::purpleReportDisconnect(PurpleConnection *gc, const char *text) {
-#endif
-}
-// whiteboard ui operations
-void IMInvoker::purpleCreateWB(PurpleWhiteboard *wb) {}
-void IMInvoker::purpleDestroyWB(PurpleWhiteboard *wb) {}
-void IMInvoker::purpleSetDimensions(PurpleWhiteboard *wb, int width, int height) {}
-void IMInvoker::purpleSetBrush(PurpleWhiteboard *wb, int size, int color) {}
-void IMInvoker::purpleDrawPont(PurpleWhiteboard *wb, int x, int y, int color, int size) {}
-void IMInvoker::purpleDrawLine(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size) {}
-void IMInvoker::purpleClearWB(PurpleWhiteboard *wb) {}
-
-// debug ui operations
-void IMInvoker::purpleDebugPrint(PurpleDebugLevel level, const char *category, const char *arg_s) {
-// std::cout << category << ": " << arg_s << std::endl;
-}
-
-gboolean IMInvoker::purpleDebugIsEnabled(PurpleDebugLevel level, const char *category) {
- return true;
-}
-
-
-}
diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.h b/src/uscxml/plugins/invoker/im/IMInvoker.h
deleted file mode 100644
index 82d5762..0000000
--- a/src/uscxml/plugins/invoker/im/IMInvoker.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef IMINVOKER_H_FNWG0XCQ
-#define IMINVOKER_H_FNWG0XCQ
-
-#include <uscxml/Interpreter.h>
-
-extern "C" {
-#include <purple.h>
-}
-
-#include "uscxml/IMConfig.h"
-
-#if LIBPURPLE_VERSION_MAJOR < 3
-#define PURPLE_STATUS_GET_TYPE purple_status_get_type
-#define PURPLE_STATUS_ATTR_GET_ID purple_status_attr_get_id
-#define PURPLE_STATUS_ATTR PurpleStatusAttr
-#define PURPLE_VALUE PurpleValue
-#else
-#define PURPLE_STATUS_GET_TYPE purple_status_get_status_type
-#define PURPLE_STATUS_ATTR_GET_ID purple_status_attribute_get_id
-#define PURPLE_STATUS_ATTR PurpleStatusAttribute
-#define PURPLE_VALUE GValue
-#endif
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-typedef enum {
- PURPLE_BUDDY_NONE = 0x00, /**< No events. */
- PURPLE_BUDDY_SIGNON = 0x01, /**< The buddy signed on. */
- PURPLE_BUDDY_SIGNOFF = 0x02, /**< The buddy signed off. */
- PURPLE_BUDDY_INFO_UPDATED = 0x10, /**< The buddy's information (profile) changed. */
- PURPLE_BUDDY_ICON = 0x40, /**< The buddy's icon changed. */
- PURPLE_BUDDY_MISCELLANEOUS = 0x80, /**< The buddy's service-specific miscalleneous info changed. */
- PURPLE_BUDDY_SIGNON_TIME = 0x11, /**< The buddy's signon time changed. */
- PURPLE_BUDDY_EVIL = 0x12, /**< The buddy's warning level changed. */
- PURPLE_BUDDY_DIRECTIM_CONNECTED = 0x14, /**< Connected to the buddy via DirectIM. */
- PURPLE_BUDDY_DIRECTIM_DISCONNECTED = 0x18, /**< Disconnected from the buddy via DirectIM. */
- PURPLE_BUDDY_NAME = 0x20 /**<Buddy name (UID) changed. */
-} PurpleBuddyEvent;
-
-class IMInvoker : public InvokerImpl {
-public:
- struct EventContext {
- InvokeRequest invokeReq;
- SendRequest sendReq;
- IMInvoker* instance;
- };
-
- IMInvoker();
- virtual ~IMInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("im");
- names.push_back("instant-messaging");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#instant-messaging");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-private:
- static bool _libPurpleIsInitialized;
- static Data _pluginData;
-
- Data _dataModelVars;
-
- static Data buddyToData(PurpleBuddy *buddy);
- static Data statusToData(PurpleStatus *status);
- static Data purpleValueToData(PURPLE_VALUE* value);
-
- static PurpleAccountUiOps _uiAccountOps;
- static PurpleEventLoopUiOps _uiEventLoopOps;
- static PurpleCoreUiOps _uiCoreOps;
- static PurpleConversationUiOps _uiConvOps;
- static PurpleBlistUiOps _uiBuddyOps;
- static PurpleXferUiOps _uiXferOps;
- static PurpleNotifyUiOps _uiNotifyOps;
-#if LIBPURPLE_VERSION_MAJOR < 3
- static PurplePrivacyUiOps _uiPrivacyOps;
-#endif
- static PurpleRequestUiOps _uiRequestOps;
- static PurpleConnectionUiOps _uiConnectOps;
- static PurpleWhiteboardUiOps _uiWhiteboardOps;
- static PurpleDebugUiOps _uiDebugOps;
-
-#if LIBPURPLE_VERSION_MAJOR >= 3
- static PurpleRequestFeature _features;
-#endif
-
- static GHashTable* _uiInfo;
- static GRand* _gRand;
-
- static tthread::recursive_mutex _accountMutex;
- static std::map<PurpleAccount*, IMInvoker*> _accountInstances;
- static tthread::mutex _initMutex;
- static tthread::condition_variable _initCond;
- static DelayedEventQueue* _eventQueue;
-
- // libpurple event callbacks
- static void signedOnCB(PurpleConnection *gc, gpointer null);
- static void conversationCreatedCB(PurpleConversation *conv, void *data);
- static void chatJoinedCB(PurpleConversation *conv, void *data);
- static void chatJoinFailedCB(PurpleConnection *gc, GHashTable *components);
- static void buddyTypingCB(PurpleAccount *account, const char *name, void *data);
- static void buddyTypedCB(PurpleAccount *account, const char *name, void *data);
- static void buddyTypingStoppedCB(PurpleAccount *account, const char *name, void *data);
- static void buddyIdleChangedCB(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, PurpleBuddyEvent event);
- static void blistNodeAliasedCB(PurpleBlistNode *node, char *old_alias);
- static void buddyEventCB(PurpleBuddy *buddy, PurpleBuddyEvent event);
- static void buddyStatusChangedCB(PurpleBuddy *buddy, PurpleStatus *oldstatus, PurpleStatus *newstatus, PurpleBuddyEvent event);
- static void buddyAddedCB(PurpleBuddy* buddy);
- static void buddyRemovedCB(PurpleBuddy* buddy);
- static void fileRecvRequestCB(PurpleXfer *xfer);
- static void buddyCapsChangedCB(PurpleBuddy* buddy, PurpleMediaCaps newcaps, PurpleMediaCaps oldcaps);
-
- // these are only being called from the delayed queue's thread
- static void initLibPurple(void *userdata, const std::string event);
- static void setupPurpleSignals();
-
- static void send(void *userdata, const std::string event);
- static void invoke(void *userdata, const std::string event);
-
- // libpurple ui operations
- static guint purpleEventTimeoutAdd(guint interval, GSourceFunc function, gpointer data);
- static gboolean purpleEventTimeoutRemove(guint handle);
- static guint purpleEventInputAdd(int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer user_data);
- static gboolean purpleEventInputRemove(guint handle);
- static int purpleEventInputGetError(int fd, int *error);
- static guint purpleEventTimeoutAddSec(guint interval, GSourceFunc function, gpointer data);
-
- // callback contexts
- struct PurpleEventContext {
- PurpleInputFunction input;
- PurpleInputCondition cond;
- int inputFD;
- GSourceFunc function;
- gpointer data;
- };
- static void purpleCallback(void *userdata, const std::string event);
-
- // libpurple debug
- static void purpleDebugPrint(PurpleDebugLevel level, const char *category, const char *arg_s);
- static gboolean purpleDebugIsEnabled(PurpleDebugLevel level, const char *category);
-
-
- // libpurple core operations
- static void purplePrefsInit(void);
- static void purpleDebugInit(void);
- static void purpleUIInit(void);
- static void purpleQuit(void);
- static GHashTable* purpleGetUIInfo(void);
-
- //libpurple conversation operations
- static void purpleCreateConversation(PurpleConversation *conv);
- static void purpleDestroyConversation(PurpleConversation *conv);
- static void purpleWriteChat(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime);
- static void purpleWriteIm(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime);
- static void purpleWriteConv(PurpleConversation *conv, const char *name, const char *alias, const char *message, PurpleMessageFlags flags, time_t mtime);
- static void purpleChatAddUsers(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals);
- static void purpleChatRenameUser(PurpleConversation *conv, const char *old_name, const char *new_name, const char *new_alias);
- static void purpleChatRemoveUsers(PurpleConversation *conv, GList *users);
- static void purpleChatUpdateUser(PurpleConversation *conv, const char *user);
- static void purplePresentConversation(PurpleConversation *conv);
- static gboolean purpleHasFocus(PurpleConversation *conv);
- static gboolean purpleCustomSmileyAdd(PurpleConversation *conv, const char *smile, gboolean remote);
- static void purpleCustomSmileyWrite(PurpleConversation *conv, const char *smile, const guchar *data, gsize size);
- static void purpleCustomSmileyClose(PurpleConversation *conv, const char *smile);
- static void purpleSendConfirm(PurpleConversation *conv, const char *message);
-
- // buddy operations
- static void purpleNewList(PurpleBuddyList *list);
- static void purpleNewNode(PurpleBlistNode *node);
- static void purpleShow(PurpleBuddyList *list);
- static void purpleUpdate(PurpleBuddyList *list, PurpleBlistNode *node);
- static void purpleRemove(PurpleBuddyList *list, PurpleBlistNode *node);
- static void purpleDestroy(PurpleBuddyList *list);
- static void purpleSetVisible(PurpleBuddyList *list, gboolean show);
- static void purpleRequestAddBuddy(PurpleAccount *account, const char *username, const char *group, const char *alias);
- static void purpleRequestAddChat(PurpleAccount *account, PurpleGroup *group, const char *alias, const char *name);
- static void purpleRequestAddGroup(void);
- static void purpleSaveNode(PurpleBlistNode *node);
- static void purpleRemoveNode(PurpleBlistNode *node);
- static void purpleSaveAccount(PurpleAccount *account);
-
- // file transfer operations
- static void purpleNewXfer(PurpleXfer *xfer);
- static void purpleDestroy(PurpleXfer *xfer);
- static void purpleAddXfer(PurpleXfer *xfer);
- static void purpleUpdateProgress(PurpleXfer *xfer, double percent);
- static void purpleCancelLocal(PurpleXfer *xfer);
- static void purpleCancelRemote(PurpleXfer *xfer);
- static gssize purpleWrite(PurpleXfer *xfer, const guchar *buffer, gssize size);
- static gssize purpleRead(PurpleXfer *xfer, guchar **buffer, gssize size);
- static void purpleDataNotSent(PurpleXfer *xfer, const guchar *buffer, gsize size);
- static void purpleAddThumbnail(PurpleXfer *xfer, const gchar *formats);
-
- // notification operations
-#if LIBPURPLE_VERSION_MAJOR >= 3
- static void* purpeNotifyMessage(PurpleNotifyMsgType type, const char *title, const char *primary, const char *secondary , PurpleRequestCommonParameters *cpar);
-#else
- static void* purpeNotifyMessage(PurpleNotifyMsgType type, const char *title, const char *primary, const char *secondary);
-#endif
- static void* purpeNotifyEmail(PurpleConnection *gc, const char *subject, const char *from, const char *to, const char *url);
- static void* purpeNotifyEmails(PurpleConnection *gc, size_t count, gboolean detailed, const char **subjects, const char **froms, const char **tos, const char **urls);
- static void* purpeNotifyFormatted(const char *title, const char *primary, const char *secondary, const char *text);
- static void* purpeNotifySearchResults(PurpleConnection *gc, const char *title, const char *primary, const char *secondary, PurpleNotifySearchResults *results, gpointer user_data);
- static void purpeNotifySearchResultsNewRows(PurpleConnection *gc, PurpleNotifySearchResults *results, void *data);
- static void* purpeNotifyUserInfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info);
- static void* purpeNotifyURI(const char *uri);
- static void purpeNotifyClose(PurpleNotifyType type, void *ui_handle);
-
- // account operations
- static void accountNotifyAdded(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, const char *message);
- static void accountStatusChanged(PurpleAccount *account, PurpleStatus *status);
- static void accountRequestAdd(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, const char *message);
- static void* accountRequestAuthorize(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, const char *message, gboolean on_list, PurpleAccountRequestAuthorizationCb authorize_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data);
- static void accountCloseRequest(void *ui_handle);
-
- // privacy ui operations
- static void purplePermitAdded(PurpleAccount *account, const char *name);
- static void purplePermitRemoved(PurpleAccount *account, const char *name);
- static void purpleDebyAdded(PurpleAccount *account, const char *name);
- static void purpleDenyRemoved(PurpleAccount *account, const char *name);
-
- // request ui operations
-#if LIBPURPLE_VERSION_MAJOR >= 3
-
- static void* purpleRequestInput(const char *title, const char *primary,
- const char *secondary, const char *default_value,
- gboolean multiline, gboolean masked, gchar *hint,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data);
- static void* purpleRequestChoice(const char *title, const char *primary,
- const char *secondary, gpointer default_value,
- const char *ok_text, GCallback ok_cb, const char *cancel_text,
- GCallback cancel_cb , PurpleRequestCommonParameters *cpar,
- void *user_data, va_list choices);
- static void* purpleRequestAction(const char *title, const char *primary,
- const char *secondary, int default_action,
- PurpleRequestCommonParameters *cpar, void *user_data,
- size_t action_count, va_list actions);
- static void* purpleRequestWait(const char *title, const char *primary,
- const char *secondary, gboolean with_progress,
- PurpleRequestCancelCb cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data);
-
- static void purpleRequestWaitUpdate(void *ui_handle, gboolean pulse, gfloat fraction);
-
- static void* purpleRequestFields(const char *title, const char *primary,
- const char *secondary, PurpleRequestFields *fields,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data);
- static void* purpleRequestFile(const char *title, const char *filename,
- gboolean savedialog, GCallback ok_cb, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data);
- static void* purpleRequestFolder(const char *title, const char *dirname,
- GCallback ok_cb, GCallback cancel_cb,
- PurpleRequestCommonParameters *cpar, void *user_data);
- static void purpleRequestClose(PurpleRequestType type, void *ui_handle);
-#else
-
- static void* purpleRequestInput(const char *title, const char *primary,
- const char *secondary, const char *default_value,
- gboolean multiline, gboolean masked, gchar *hint,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data);
-
- static void* purpleRequestChoice(const char *title, const char *primary,
- const char *secondary, int default_value,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data,
- va_list choices);
-
- static void* purpleRequestAction(const char *title, const char *primary,
- const char *secondary, int default_action,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data,
- size_t action_count, va_list actions);
-
- static void* purpleRequestFields(const char *title, const char *primary,
- const char *secondary, PurpleRequestFields *fields,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data);
-
- static void* purpleRequestFile(const char *title, const char *filename,
- gboolean savedialog, GCallback ok_cb,
- GCallback cancel_cb, PurpleAccount *account,
- const char *who, PurpleConversation *conv,
- void *user_data);
-
- static void purpleRequestClose(PurpleRequestType type, void *ui_handle);
-
- static void* purpleRequestFolder(const char *title, const char *dirname,
- GCallback ok_cb, GCallback cancel_cb,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv, void *user_data);
-
- static void* purpleRequestActionWithIcon(const char *title, const char *primary,
- const char *secondary, int default_action,
- PurpleAccount *account, const char *who,
- PurpleConversation *conv,
- gconstpointer icon_data, gsize icon_size,
- void *user_data,
- size_t action_count, va_list actions);
-
-#endif
-
-
- // connection ui operations
- static void purpleConnectProgress(PurpleConnection *gc, const char *text, size_t step, size_t step_count);
- static void purpleConnected(PurpleConnection *gc);
- static void purpleDisonnected(PurpleConnection *gc);
- static void purpleNotice(PurpleConnection *gc, const char *text);
- static void purpleNetworkConnected(void);
- static void purpleNetworkDisconnected(void);
-#if LIBPURPLE_VERSION_MAJOR >= 3
- static void purpleReportDisconnect(PurpleConnection *gc, PurpleConnectionError reason, const char *text);
-#else
- static void purpleReportDisconnect(PurpleConnection *gc, const char *text);
-#endif
-
- // whiteboard ui operations
- static void purpleCreateWB(PurpleWhiteboard *wb);
- static void purpleDestroyWB(PurpleWhiteboard *wb);
- static void purpleSetDimensions(PurpleWhiteboard *wb, int width, int height);
- static void purpleSetBrush(PurpleWhiteboard *wb, int size, int color);
- static void purpleDrawPont(PurpleWhiteboard *wb, int x, int y, int color, int size);
- static void purpleDrawLine(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size);
- static void purpleClearWB(PurpleWhiteboard *wb);
-
-
- PurpleAccount* _account;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(IMInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: IMINVOKER_H_FNWG0XCQ */
diff --git a/src/uscxml/plugins/invoker/imap/IMAPInvoker.cpp b/src/uscxml/plugins/invoker/imap/IMAPInvoker.cpp
deleted file mode 100644
index d3686f9..0000000
--- a/src/uscxml/plugins/invoker/imap/IMAPInvoker.cpp
+++ /dev/null
@@ -1,495 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#define NOMINMAX // and have MSVC die in a fire for defining min macro
-#include "IMAPInvoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#include <boost/algorithm/string.hpp>
-#include "uscxml/UUID.h"
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new IMAPInvokerProvider() );
- return true;
-}
-#endif
-
-IMAPInvoker::IMAPInvoker() {
-}
-
-IMAPInvoker::~IMAPInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> IMAPInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<IMAPInvoker> invoker = boost::shared_ptr<IMAPInvoker>(new IMAPInvoker());
- return invoker;
-}
-
-Data IMAPInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void IMAPInvoker::run(void* instance) {
- IMAPInvoker* INSTANCE = (IMAPInvoker*)instance;
- while(true) {
- IMAPContext* req = INSTANCE->_workQueue.pop();
- if (INSTANCE->_isRunning) {
- INSTANCE->process(req);
- } else {
- return;
- }
- }
-}
-
-size_t IMAPInvoker::writeCurlData(void *ptr, size_t size, size_t nmemb, void *userdata) {
- if (!userdata)
- return 0;
-
- IMAPContext* ctx = (IMAPContext*)userdata;
-
- size_t toWrite = (std::min)(ctx->outContent.length() - ctx->readPtr, size * nmemb);
- if (toWrite > 0) {
- memcpy (ptr, ctx->outContent.c_str() + ctx->readPtr, toWrite);
- ctx->readPtr += toWrite;
- }
-
- return toWrite;
-}
-
-size_t IMAPInvoker::readCurlData(void *ptr, size_t size, size_t nmemb, void *userdata) {
- if (!userdata)
- return 0;
-
- IMAPContext* ctx = (IMAPContext*)userdata;
- ctx->inContent << std::string((char*)ptr, size * nmemb);
-
- return size * nmemb;
-}
-
-
-void IMAPInvoker::send(const SendRequest& req) {
- IMAPContext* ctx = NULL;
-
- if (false) {
- } else if (iequals(req.name, "select")) {
- IMAPContext::Select* args = new IMAPContext::Select();
- Event::getParam(req.params, "mailbox", args->mailbox);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_SELECT;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "examine")) {
- IMAPContext::Examine* args = new IMAPContext::Examine();
- Event::getParam(req.params, "mailbox", args->mailbox);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_EXAMINE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "delete")) {
- IMAPContext::Delete* args = new IMAPContext::Delete();
- Event::getParam(req.params, "mailbox", args->mailbox);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_DELETE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "rename")) {
- IMAPContext::Rename* args = new IMAPContext::Rename();
- Event::getParam(req.params, "mailbox", args->mailbox);
- Event::getParam(req.params, "name", args->newName);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_RENAME;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "subscribe")) {
- IMAPContext::Subscribe* args = new IMAPContext::Subscribe();
- Event::getParam(req.params, "mailbox", args->mailbox);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_SUBSCRIBE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "unsubscribe")) {
- IMAPContext::Unsubscribe* args = new IMAPContext::Unsubscribe();
- Event::getParam(req.params, "mailbox", args->mailbox);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_UNSUBSCRIBE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "list")) {
- IMAPContext::List* args = new IMAPContext::List();
- Event::getParam(req.params, "mailbox", args->mailbox);
- Event::getParam(req.params, "reference", args->refName);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_LIST;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "lsub")) {
- IMAPContext::LSub* args = new IMAPContext::LSub();
- Event::getParam(req.params, "mailbox", args->mailbox);
- Event::getParam(req.params, "reference", args->refName);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_LSUB;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "status")) {
- IMAPContext::Status* args = new IMAPContext::Status();
- Event::getParam(req.params, "mailbox", args->mailbox);
- Event::getParam(req.params, "dataitems", args->dataItems);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_STATUS;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "append")) {
- IMAPContext::Append* args = new IMAPContext::Append();
- Event::getParam(req.params, "mailbox", args->mailbox);
- Event::getParam(req.params, "flags", args->flags);
- Event::getParam(req.params, "datetime", args->dateTime);
-
- if (!Event::getParam(req.params, "message", args->literal)) {
- args->literal = req.content;
- }
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_APPEND;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "check")) {
- IMAPContext::Check* args = new IMAPContext::Check();
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_CHECK;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "close")) {
- IMAPContext::Close* args = new IMAPContext::Close();
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_CLOSE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "expunge")) {
- IMAPContext::Expunge* args = new IMAPContext::Expunge();
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_EXPUNGE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "search")) {
- IMAPContext::Search* args = new IMAPContext::Search();
- Event::getParam(req.params, "charset", args->charSet);
- Event::getParam(req.params, "criteria", args->criteria);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_SEARCH;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "fetch")) {
- IMAPContext::Fetch* args = new IMAPContext::Fetch();
- Event::getParam(req.params, "sequence", args->sequence);
- Event::getParam(req.params, "itemnames", args->itemNames);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_FETCH;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "store")) {
- IMAPContext::Store* args = new IMAPContext::Store();
- Event::getParam(req.params, "sequence", args->sequence);
- Event::getParam(req.params, "itemnames", args->itemNames);
- Event::getParam(req.params, "values", args->values);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_STORE;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "copy")) {
- IMAPContext::Copy* args = new IMAPContext::Copy();
- Event::getParam(req.params, "mailbox", args->mailbox);
- Event::getParam(req.params, "sequence", args->sequence);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_COPY;
- ctx->arguments = args;
-
- } else if (iequals(req.name, "uid")) {
- IMAPContext::UId* args = new IMAPContext::UId();
- Event::getParam(req.params, "command", args->command);
- Event::getParam(req.params, "arguments", args->arguments);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_UID;
- ctx->arguments = args;
-
- } else if (boost::istarts_with(req.name, "x")) {
- IMAPContext::XExtension* args = new IMAPContext::XExtension();
- args->command = req.name;
- Event::getParam(req.params, "arguments", args->arguments);
-
- ctx = new IMAPContext();
- ctx->command = IMAPContext::IMAP_XEXTENSION;
- ctx->arguments = args;
-
- }
-
- if (ctx == NULL) {
- returnErrorExecution("Event '" + req.name + "' not known");
- return;
- }
-
- Event::getParam(req.params, "verbose", ctx->verbose);
- Event::getParam(req.params, "ssl", ctx->useSSL);
-
- ctx->invoker = this;
- ctx->sendReq = req;
-
- _workQueue.push(ctx);
-}
-
-void IMAPInvoker::process(IMAPContext* ctx) {
- CURL* _curl;
- CURLcode curlError;
-
- // see http://curl.haxx.se/libcurl/c/imap-tls.html
- _curl = curl_easy_init();
- if(_curl) {
- (curlError = curl_easy_setopt(_curl, CURLOPT_USERNAME, _username.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set username: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_PASSWORD, _password.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set password: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_URL, _server.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set server string: " << curl_easy_strerror(curlError);
-
- if (ctx->useSSL) {
- (curlError = curl_easy_setopt(_curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL)) == CURLE_OK ||
- LOG(ERROR) << "Cannot use SSL: " << curl_easy_strerror(curlError);
-#if 1
- (curlError = curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot unset verify peer with SSL: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot unset verify host with SSL: " << curl_easy_strerror(curlError);
-#else
- (curlError = curl_easy_setopt(_curl, CURLOPT_CAINFO, "/path/to/certificate.pem")) == CURLE_OK ||
- LOG(ERROR) << "Cannot set CA info path: " << curl_easy_strerror(curlError);
-#endif
-
- }
-
- (curlError = curl_easy_setopt(_curl, CURLOPT_READFUNCTION, IMAPInvoker::writeCurlData)) == CURLE_OK ||
- LOG(ERROR) << "Cannot register read function: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_READDATA, ctx)) == CURLE_OK ||
- LOG(ERROR) << "Cannot register userdata for read function: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, IMAPInvoker::readCurlData)) == CURLE_OK ||
- LOG(ERROR) << "Cannot register read function: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_WRITEDATA, ctx)) == CURLE_OK ||
- LOG(ERROR) << "Cannot register userdata for write function: " << curl_easy_strerror(curlError);
-
- if (ctx->verbose) {
- (curlError = curl_easy_setopt(_curl, CURLOPT_VERBOSE, 1L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot set curl to verbose: " << curl_easy_strerror(curlError);
- }
-
- std::stringstream cmdSS;
- switch (ctx->command) {
- case IMAPContext::IMAP_SELECT: {
- IMAPContext::Select* cmd = (IMAPContext::Select*)ctx->arguments;
- cmdSS << "SELECT " << "\"" << cmd->mailbox << "\"";
- break;
- }
- case IMAPContext::IMAP_EXAMINE: {
- IMAPContext::Examine* cmd = (IMAPContext::Examine*)ctx->arguments;
- cmdSS << "EXAMINE " << "\"" << cmd->mailbox << "\"";
- break;
- }
- case IMAPContext::IMAP_CREATE: {
- IMAPContext::Create* cmd = (IMAPContext::Create*)ctx->arguments;
- cmdSS << "CREATE " << "\"" << cmd->mailbox << "\"";
- break;
- }
- case IMAPContext::IMAP_DELETE: {
- IMAPContext::Delete* cmd = (IMAPContext::Delete*)ctx->arguments;
- cmdSS << "DELETE " << "\"" << cmd->mailbox << "\"";
- break;
- }
- case IMAPContext::IMAP_RENAME: {
- IMAPContext::Rename* cmd = (IMAPContext::Rename*)ctx->arguments;
- cmdSS << "RENAME " << "\"" << cmd->mailbox << "\" \"" << cmd->newName << "\"";
- break;
- }
- case IMAPContext::IMAP_SUBSCRIBE: {
- IMAPContext::Subscribe* cmd = (IMAPContext::Subscribe*)ctx->arguments;
- cmdSS << "SUBSCRIBE " << "\"" << cmd->mailbox << "\"";
- break;
- }
- case IMAPContext::IMAP_UNSUBSCRIBE: {
- IMAPContext::Unsubscribe* cmd = (IMAPContext::Unsubscribe*)ctx->arguments;
- cmdSS << "UNSUBSCRIBE " << "\"" << cmd->mailbox << "\"";
- break;
- }
- case IMAPContext::IMAP_LIST: {
- IMAPContext::List* cmd = (IMAPContext::List*)ctx->arguments;
- cmdSS << "LIST " << "\"" << cmd->mailbox << "\" \"" << cmd->refName << "\"";
- break;
- }
- case IMAPContext::IMAP_LSUB: {
- IMAPContext::LSub* cmd = (IMAPContext::LSub*)ctx->arguments;
- cmdSS << "LSUB " << "\"" << cmd->mailbox << "\" \"" << cmd->refName << "\"";
- break;
- }
- case IMAPContext::IMAP_STATUS: {
- IMAPContext::Status* cmd = (IMAPContext::Status*)ctx->arguments;
- cmdSS << "STATUS " << "\"" << cmd->mailbox << "\" (" << cmd->dataItems << ")";
- break;
- }
- case IMAPContext::IMAP_APPEND: {
- IMAPContext::Append* cmd = (IMAPContext::Append*)ctx->arguments;
- cmdSS << "APPEND " << "\"" << cmd->mailbox << "\" (" << cmd->flags << ") {" << cmd->dateTime << "}";
- break;
- }
- case IMAPContext::IMAP_CHECK: {
- cmdSS << "CHECK";
- break;
- }
- case IMAPContext::IMAP_CLOSE: {
- cmdSS << "CLOSE";
- break;
- }
- case IMAPContext::IMAP_EXPUNGE: {
- cmdSS << "EXPUNGE";
- break;
- }
- case IMAPContext::IMAP_SEARCH: {
- IMAPContext::Search* cmd = (IMAPContext::Search*)ctx->arguments;
- cmdSS << "SEARCH ";
- if (cmd->charSet.size() > 0) {
- cmdSS << "CHARSET " << cmd->charSet << " ";
- }
- cmdSS << cmd->criteria;
- break;
- }
- case IMAPContext::IMAP_FETCH: {
- IMAPContext::Fetch* cmd = (IMAPContext::Fetch*)ctx->arguments;
- cmdSS << "FETCH " << cmd->sequence << " " << cmd->itemNames;
- break;
- }
- case IMAPContext::IMAP_STORE: {
- IMAPContext::Store* cmd = (IMAPContext::Store*)ctx->arguments;
- cmdSS << "STORE " << cmd->sequence << " " << cmd->itemNames << " " << cmd->values;
- break;
- }
- case IMAPContext::IMAP_COPY: {
- IMAPContext::Copy* cmd = (IMAPContext::Copy*)ctx->arguments;
- cmdSS << "COPY " << "\"" << cmd->mailbox << "\" " << cmd->sequence;
- break;
- }
- case IMAPContext::IMAP_UID: {
- IMAPContext::UId* cmd = (IMAPContext::UId*)ctx->arguments;
- cmdSS << "UID " << cmd->command << " " << cmd->arguments;
- break;
- }
- case IMAPContext::IMAP_XEXTENSION: {
- IMAPContext::XExtension* cmd = (IMAPContext::XExtension*)ctx->arguments;
- cmdSS << cmd->command << " " << cmd->arguments;
- break;
- }
- default:
- break;
- }
- curl_easy_setopt(_curl, CURLOPT_CUSTOMREQUEST, cmdSS.str().c_str());
-
- CURLcode res = curl_easy_perform(_curl);
-
- /* Check for errors */
- if(res != CURLE_OK) {
- LOG(ERROR) << "curl_easy_perform() failed: " << curl_easy_strerror(res);
- returnErrorExecution("error.mail.send");
- } else {
-
- Event e;
-
-#if 0
- switch (ctx->command) {
- case IMAPContext::LIST:
- e.data = parseListReponse(ctx->inContent.str());
- break;
- default:
- break;
- }
-#endif
-
- e.name = ctx->sendReq.name + ".success";
- e.data.compound["raw"] = Data(ctx->inContent.str(), Data::VERBATIM);
-
- returnEvent(e);
- }
-
- /* Always cleanup */
- curl_easy_cleanup(_curl);
-
- }
-}
-
-#if 0
-Data IMAPInvoker::parseListReponse(const std::string& response) {
- Data data;
-
- std::string line;
- std::istringstream inSS(response);
-
- while(std::getline(inSS, line, '\n')) {
- // individual lines
- size_t lastSep = line.find_last_of("\" ");
- if (lastSep != std::string::npos) {
-
- }
- }
-
- return data;
-}
-#endif
-
-void IMAPInvoker::cancel(const std::string sendId) {
-}
-
-void IMAPInvoker::invoke(const InvokeRequest& req) {
- Event::getParam(req.params, "username", _username);
- Event::getParam(req.params, "password", _password);
- Event::getParam(req.params, "server", _server);
-
- _isRunning = true;
- _thread = new tthread::thread(IMAPInvoker::run, this);
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/imap/IMAPInvoker.h b/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
deleted file mode 100644
index bf2b3e9..0000000
--- a/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef IMAPINVOKER_H_W09JFED0
-#define IMAPINVOKER_H_W09JFED0
-
-#include <uscxml/Interpreter.h>
-#include <uscxml/concurrency/BlockingQueue.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-#include <curl/curl.h>
-
-namespace uscxml {
-
-class IMAPInvoker : public InvokerImpl {
-public:
- IMAPInvoker();
- virtual ~IMAPInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("imap");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#imap");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-
- class IMAPContext {
-
- public:
- enum Cmd {
- // valid in authenticated state
- IMAP_SELECT,
- IMAP_EXAMINE,
- IMAP_CREATE,
- IMAP_DELETE,
- IMAP_RENAME,
- IMAP_SUBSCRIBE,
- IMAP_UNSUBSCRIBE,
- IMAP_LIST,
- IMAP_LSUB,
- IMAP_STATUS,
- IMAP_APPEND,
- // valid in selected state
- IMAP_CHECK,
- IMAP_CLOSE,
- IMAP_EXPUNGE,
- IMAP_SEARCH,
- IMAP_FETCH,
- IMAP_STORE,
- IMAP_COPY,
- IMAP_UID,
- IMAP_XEXTENSION,
- };
-
- struct MailboxOp {
- std::string mailbox;
- };
-
- struct Select : MailboxOp {};
- struct Examine : MailboxOp {};
- struct Create : MailboxOp {};
- struct Delete : MailboxOp {};
- struct Rename : MailboxOp {
- std::string newName;
- };
- struct Subscribe : MailboxOp {};
- struct Unsubscribe : MailboxOp {};
- struct List : MailboxOp {
- std::string refName;
- };
- struct LSub : List {};
- struct Status : MailboxOp {
- std::string dataItems;
- };
- struct Append : MailboxOp {
- std::string flags;
- std::string dateTime;
- std::string literal;
- };
- struct Check {};
- struct Close {};
- struct Expunge {};
- struct Search {
- std::string charSet;
- std::string criteria;
- };
- struct Fetch {
- std::string sequence;
- std::string itemNames;
- };
- struct Store : Fetch {
- std::string values;
- };
- struct Copy : MailboxOp {
- std::string sequence;
- };
- struct UId {
- std::string command;
- std::string arguments;
- };
- struct XExtension : UId {};
-
-
- IMAPContext() : readPtr(0) {}
-
- void* arguments;
- Cmd command;
-
- IMAPInvoker* invoker;
- SendRequest sendReq;
- std::stringstream inContent;
- std::string outContent;
- size_t readPtr;
- bool verbose;
- bool useSSL;
-
- };
-
-protected:
- std::string _username;
- std::string _password;
- std::string _server;
-
- static void run(void*);
-
- tthread::thread* _thread;
- uscxml::concurrency::BlockingQueue<IMAPContext*> _workQueue;
- bool _isRunning;
-
- void process(IMAPContext* ctx);
- static size_t writeCurlData(void *ptr, size_t size, size_t nmemb, void *userdata);
- static size_t readCurlData(void *ptr, size_t size, size_t nmemb, void *userdata);
-
-// Data parseListReponse(const std::string& response);
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(IMAPInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: IMAPINVOKER_H_W09JFED0 */
diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp
deleted file mode 100644
index 7b12ddd..0000000
--- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp
+++ /dev/null
@@ -1,1097 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "MilesSessionInvoker.h"
-#include "uscxml/server/HTTPServer.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#include <inttypes.h>
-#include <stdlib.h> /* srand, rand */
-
-#ifdef _WIN32
-#define strdup _strdup
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new MilesSessionInvokerProvider() );
- return true;
-}
-#endif
-
-MilesSessionInvoker::MilesSessionInvoker() {
- /* Initialize Miles */
- miles_init();
-
- _isRunning = false;
- _imageSeq = 0;
- num_connected = 0;
-}
-
-MilesSessionInvoker::~MilesSessionInvoker() {
- free_media_buffers();
-};
-
-boost::shared_ptr<InvokerImpl> MilesSessionInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<MilesSessionInvoker> invoker = boost::shared_ptr<MilesSessionInvoker>(new MilesSessionInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data MilesSessionInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void MilesSessionInvoker::init_media_buffers() {
- video_out_buf = NULL;
- video_conv_buf = NULL;
- encoded_out_img = NULL;
- audio_in_buf = NULL;
- render_img = NULL;
- render_img_size = 0;
- audio_data = NULL;
- encoded_out_audio = NULL;
- audio_read_buf = NULL;
- video_data = (char *)malloc(1000000);
- text_msg_buf = (char *)malloc(1000);
- text_msg_available = 0;
-}
-
-void MilesSessionInvoker::free_media_buffers() {
- if(video_out_buf)
- free(video_out_buf);
- video_out_buf = NULL;
- if(video_conv_buf)
- free(video_conv_buf);
- video_conv_buf = NULL;
- if(encoded_out_img)
- free(encoded_out_img);
- encoded_out_img = NULL;
- if(audio_in_buf)
- free(audio_in_buf);
- audio_in_buf = NULL;
- if(render_img)
- free(render_img);
- render_img = NULL;
- render_img_size = 0;
- if(audio_data)
- free(audio_data);
- audio_data = NULL;
- if(video_data)
- free(video_data);
- video_data = NULL;
- if(encoded_out_audio)
- free(encoded_out_audio);
- encoded_out_audio = NULL;
- if(audio_read_buf)
- free(audio_read_buf);
- audio_read_buf = NULL;
- if(text_msg_buf)
- free(text_msg_buf);
- text_msg_buf = NULL;
- text_msg_available = 0;
-}
-
-void MilesSessionInvoker::free_video_buffers() {
- if(video_out_buf)
- free(video_out_buf);
- video_out_buf = NULL;
- if(video_conv_buf)
- free(video_conv_buf);
- video_conv_buf = NULL;
- if(encoded_out_img)
- free(encoded_out_img);
- encoded_out_img = NULL;
- if(render_img)
- free(render_img);
- render_img = NULL;
- render_img_size = 0;
- if(video_data)
- free(video_data);
- video_data = NULL;
-}
-
-void MilesSessionInvoker::free_audio_buffers() {
- if(audio_in_buf)
- free(audio_in_buf);
- audio_in_buf = NULL;
- if(audio_data)
- free(audio_data);
- audio_data = NULL;
- video_data = NULL;
- if(encoded_out_audio)
- free(encoded_out_audio);
- encoded_out_audio = NULL;
- if(audio_read_buf)
- free(audio_read_buf);
- audio_read_buf = NULL;
-}
-
-void MilesSessionInvoker::free_text_buffers() {
- if(text_msg_buf)
- free(text_msg_buf);
- text_msg_buf = NULL;
- text_msg_available = 0;
-}
-
-// Yes, sort of ugly...
-char confero_text_msg_buf[1000];
-int confero_text_msg_available = 0;
-
-int receive_text_message_callback(u_int32_t ssrc, char *pkt, int length) {
- char cname[100];
- int i=0, j;
-
- while(pkt[i]) {
- cname[i] = pkt[i];
- i++;
- }
- cname[i++] = 0;
- j = i;
- while(pkt[j] && j<length) {
- if(pkt[j]=='<' || pkt[j]=='>' || pkt[j]=='\r' || pkt[j]=='\n')
- pkt[j] = ' ';
- j++;
- }
- memcpy(confero_text_msg_buf, pkt+i, length-i);
- //printf("RTCP app depacketizer called, cname = %s, msg = %s\n", cname, confero_text_msg_buf);
- confero_text_msg_available = 1;
- return length;
-}
-
-void MilesSessionInvoker::send(const SendRequest& req) {
-// std::cout << req;
- std::string origin;
- Event::getParam(req.params, "origin", origin);
-
- if (false) {
- } else if (iequals(req.name, "start")) {
-
- std::string userId, reflector, session;
- Event::getParam(req.params, "userid", userId);
- Event::getParam(req.params, "reflector", reflector);
- Event::getParam(req.params, "session", session);
- processEventStart(origin, userId, reflector, session);
-
- } else if (iequals(req.name, "stop")) {
-
- processEventStop(origin);
-
- } else if (iequals(req.name, "participants")) {
-
- processEventParticipants(origin);
-
- } else if (iequals(req.name, "thumbnail")) {
-
- std::string userId;
- Event::getParam(req.params, "userid", userId);
- processEventThumbnail(origin, userId);
-
- } else if (iequals(req.name, "videoon")) {
-
- std::string userId;
- Event::getParam(req.params, "userid", userId);
- processEventVideoOn(origin, userId);
-
- } else if (iequals(req.name, "videooff")) {
-
- std::string userId;
- Event::getParam(req.params, "userid", userId);
- processEventVideoOff(origin, userId);
-
- } else if (iequals(req.name, "audioon")) {
-
- std::string userId;
- Event::getParam(req.params, "userid", userId);
- processEventAudioOn(origin, userId);
-
- } else if (iequals(req.name, "audiooff")) {
-
- std::string userId;
- Event::getParam(req.params, "userid", userId);
- processEventAudioOff(origin, userId);
-
- } else if (iequals(req.name, "sendvideo")) {
-
- std::string userId, compression;
- size_t height, width, framerate;
- Event::getParam(req.params, "userid", userId);
- Event::getParam(req.params, "height", height);
- Event::getParam(req.params, "width", width);
- Event::getParam(req.params, "framerate", framerate);
- processEventSendVideo(origin, width, height, framerate, compression);
-
- } else if (iequals(req.name, "sendvideooff")) {
-
- processEventSendVideoOff(origin);
-
- } else if (iequals(req.name, "sendaudio")) {
-
- std::string userId, encoding;
- Event::getParam(req.params, "userid", userId);
- Event::getParam(req.params, "encoding", encoding);
- processEventSendAudio(origin, encoding);
-
- } else if (iequals(req.name, "sendaudiooff")) {
-
- processEventSendAudioOff(origin);
-
- } else if (iequals(req.name, "gettext")) {
-
- processEventGetText(origin);
-
- } else if (iequals(req.name, "posttext")) {
-
- std::string userId, message;
- Event::getParam(req.params, "userid", userId);
- Event::getParam(req.params, "message", message);
- processEventPostText(origin, userId, message);
-
- } else {
- LOG(ERROR) << "Do not know how to handle event " << req.name;
- }
-
-}
-
-void MilesSessionInvoker::processEventStart(const std::string& origin, const std::string& userid, const std::string& reflector, const std::string& session) {
-
- Event ev;
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- //std::cout << req;
- if(num_connected>0) {
- num_connected++;
- ev.name = "start.reply";
- returnEvent(ev);
- return;
- }
-
- LOG(ERROR) << "miles/start called, reflector ip = " << reflector << " session name = " << session << " userid = " << userid;
-
- int rv;
- rv = miles_connect_reflector_session((char*)reflector.c_str(), (char*)session.c_str());
- if (!rv) {
- LOG(ERROR) << "Could not setup reflector session";
- ev.name = "start.error";
- returnEvent(ev);
- return;
- }
- LOG(ERROR) << "session set up";
-
- /* set up media buffers */
- init_media_buffers();
-
- /* Set up audio and video RTP sockets */
- video_rtp_in_socket = miles_net_setup_udp_socket((char*)reflector.c_str(), video_port, video_port, 10, 16000);
- audio_rtp_in_socket = miles_net_setup_udp_socket((char*)reflector.c_str(), audio_port, audio_port, 10, 16000);
- video_rtp_out_socket = video_rtp_in_socket;
- audio_rtp_out_socket = audio_rtp_in_socket;
-
-
- /* Set up audio and video RTCP sockets */
- video_rtcp_in_socket = miles_net_setup_udp_socket((char*)reflector.c_str(), video_port+1, video_port+1, 10, 16000);
- audio_rtcp_in_socket = miles_net_setup_udp_socket((char*)reflector.c_str(), audio_port+1, audio_port+1, 10, 16000);
- video_rtcp_out_socket = video_rtcp_in_socket;
- audio_rtcp_out_socket = audio_rtcp_in_socket;
-
- /* Set up RTP audio and video sessions */
- video_session = miles_rtp_setup_session(video_rtp_in_socket, MILES_RTP_MEDIA_TYPE_VIDEO);
- audio_session = miles_rtp_setup_session(audio_rtp_in_socket, MILES_RTP_MEDIA_TYPE_AUDIO);
-
- /* Set up RTCP audio and video sessions */
- video_session->rtcp_session = miles_rtp_setup_rtcp_session(video_session, video_rtcp_in_socket);
- audio_session->rtcp_session = miles_rtp_setup_rtcp_session(audio_session, audio_rtcp_in_socket);
-
- /* Set up video capture */
- video_grabber_available = setup_video_grabber();
- if(video_grabber_available)
- sendvideo_enabled = 1;
-
- /* Set up audio capture/playback */
- audio_available = setup_audio();
- if(audio_available)
- sendaudio_enabled = 1;
-
- /* Set up outgoing RTP stream for video */
- if(video_grabber_available) {
- out_rtp_video_stream = miles_rtp_setup_outgoing_stream(video_session, video_rtp_out_socket, 0, MILES_RTP_PAYLOAD_TYPE_JPEG);
- out_rtp_video_stream->codec_ctx = video_encoder;
- out_rtcp_video_stream = miles_rtp_setup_outgoing_rtcp_stream(video_session->rtcp_session, video_rtcp_out_socket, out_rtp_video_stream->ssrc);
- if(out_rtp_video_stream->sdes.cname)
- free(out_rtp_video_stream->sdes.cname);
- out_rtp_video_stream->sdes.cname = strdup(userid.c_str());
- }
-
- /* Set up outgoing RTP stream for audio */
- if(audio_available) {
- out_rtp_audio_stream = miles_rtp_setup_outgoing_stream(audio_session, audio_rtp_out_socket, 0, MILES_RTP_PAYLOAD_TYPE_L16);
- if(out_rtp_audio_stream->sdes.cname)
- free(out_rtp_audio_stream->sdes.cname);
- out_rtp_audio_stream->sdes.cname = strdup(userid.c_str());
-
- /* Associate RTP stream with codec context */
- out_rtp_audio_stream->codec_ctx = audio_encoder;
-
- /* Set up outgoing RTCP streams for audio */
- out_rtcp_audio_stream = miles_rtp_setup_outgoing_rtcp_stream(audio_session->rtcp_session, audio_rtcp_out_socket, out_rtp_audio_stream->ssrc);
- }
-
- /* Register RTCP APP handler for text messages */
- rv = miles_rtp_register_rtcp_app_handler("text", NULL, receive_text_message_callback, 0);
- if(rv==0) {
- LOG(ERROR) << "Error registering text message callback";
- }
- memset(confero_text_msg_buf, 0, 1000);
-
- _isRunning = true;
- num_connected=1;
- _reflector = reflector;
- _userId = userid;
- _session = session;
-
- if(audio_available)
- _audioThread = new tthread::thread(MilesSessionInvoker::runAudio, this);
- _videoThread = new tthread::thread(MilesSessionInvoker::runVideo, this);
- ev.name = "start.reply";
- returnEvent(ev);
-}
-
-void MilesSessionInvoker::processEventStop(const std::string& origin) {
- Event ev;
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
-
- if(num_connected==0) {
- LOG(ERROR) << "not connected";
- ev.name = "stop.error";
- returnEvent(ev);
- return;
- }
- num_connected--;
- if(num_connected>0) {
- ev.name = "stop.reply";
- returnEvent(ev);
- return;
- }
- int rv = miles_disconnect_reflector_session((char*)_reflector.c_str(), (char*)_session.c_str());
- if (!rv) {
- LOG(ERROR) << "Could not disconnect from reflector session";
- ev.name = "stop.error";
- returnEvent(ev);
- return;
- }
- /* Unregister RTCP APP handler for text messages */
- rv = miles_rtp_unregister_rtcp_app_handler("text");
- if(rv==0) {
- LOG(ERROR) << "Error registering text message callback";
- }
- _isRunning = false;
- free_text_buffers();
- ev.name = "stop.reply";
- returnEvent(ev);
- LOG(ERROR) << "disconnected from reflector session";
-}
-
-void MilesSessionInvoker::processEventParticipants(const std::string& origin) {
-
- Event ev;
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- if(num_connected==0) {
- LOG(ERROR) << "not connected";
- ev.name = "participants.error";
- returnEvent(ev);
- return;
- }
- // create an array with objects inside
- for (int i = 0; i < 5; i++) {
- Data userInfo;
- userInfo.compound["name"] = Data("username" + toStr(i), Data::VERBATIM);
- userInfo.compound["email"] = Data("usermail" + toStr(i), Data::VERBATIM);
- ev.data.compound["participants"].array.push_back(userInfo);
- }
-
- ev.name = "participants.reply";
- returnEvent(ev);
-}
-
-void MilesSessionInvoker::processEventThumbnail(const std::string& origin, const std::string& userid) {
- Event ev;
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- if(num_connected==0) {
- LOG(ERROR) << "not connected";
- ev.name = "thumbnail.error";
- returnEvent(ev);
- return;
- }
-
- _imageSeq++;
- if (_imageSeq > 4)
- _imageSeq = 1;
-
- std::stringstream testImageName;
- testImageName << "test" << _imageSeq << ".jpeg";
-
- URL imageURL(testImageName.str());
- imageURL.toAbsolute(_interpreter->getBaseURL());
- std::stringstream ssImage;
- ssImage << imageURL;
- std::string imageContent = ssImage.str();
-
- ev.name = "thumbnail.reply";
-
- struct thumb_entry *use_thumb = NULL;
- struct miles_list *p;
- struct thumb_entry *te;
- _mutex.lock();
- // Find thumbnail of user
- p = thumb_list;
- while(p) {
- te = (struct thumb_entry *)p->item;
- if(te->userid && strcmp(te->userid, userid.c_str()) == 0) {
- use_thumb = te;
- break;
- }
- if(te->userid==NULL && use_thumb == NULL) {
- use_thumb = te;
- }
- p = p->next;
- }
- if(!p && use_thumb)
- use_thumb->userid = strdup(userid.c_str());
- if(use_thumb) {
- ev.data.compound["image"] = Data(use_thumb->img_buf, use_thumb->img_size, "image/jpeg");
- } else {
- // Return empty face image
- ev.data.compound["image"] = Data(imageContent.data(), imageContent.size(), "image/jpeg");
- }
- _mutex.unlock();
-
- returnEvent(ev);
-}
-
-void MilesSessionInvoker::processEventVideoOn(const std::string& origin, const std::string& userid) {
- Event ev;
- ev.name = "videoon.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
-}
-void MilesSessionInvoker::processEventVideoOff(const std::string& origin, const std::string& userid) {
- Event ev;
- ev.name = "videooff.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
-}
-void MilesSessionInvoker::processEventAudioOn(const std::string& origin, const std::string& userid) {
- Event ev;
- ev.name = "audioon.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
-}
-void MilesSessionInvoker::processEventAudioOff(const std::string& origin, const std::string& userid) {
- Event ev;
- ev.name = "audiooff.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
-}
-void MilesSessionInvoker::processEventSendVideo(const std::string& origin, size_t width, size_t height, size_t framerate, const std::string& compression) {
- Event ev;
- ev.name = "sendvideo.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- sendvideo_enabled = 1;
- returnEvent(ev);
-}
-void MilesSessionInvoker::processEventSendVideoOff(const std::string& origin) {
- Event ev;
- ev.name = "sendvideooff.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
- sendvideo_enabled = 0;
-}
-void MilesSessionInvoker::processEventSendAudio(const std::string& origin, const std::string& encoding) {
- Event ev;
- ev.name = "sendaudio.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
- sendaudio_enabled = 1;
-}
-void MilesSessionInvoker::processEventSendAudioOff(const std::string& origin) {
- Event ev;
- ev.name = "sendaudiooff.reply";
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- returnEvent(ev);
- sendaudio_enabled = 0;
-}
-void MilesSessionInvoker::processEventPostText(const std::string& origin, const std::string& userid, const std::string& message) {
- char msgbuf[1000];
- char pkt[1000];
- char *cname = "user@all"; // for now
- int n, length;
- Event ev;
-
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- if(num_connected==0) {
- LOG(ERROR) << "not connected";
- ev.name = "posttext.error";
- returnEvent(ev);
- return;
- }
- ev.name = "posttext.reply";
- returnEvent(ev);
- if(out_rtcp_video_stream==NULL)
- return;
- //printf("sending message %s\n", message.c_str());
- memcpy(msgbuf, cname, strlen(cname)+1);
- sprintf(msgbuf+strlen(cname)+1, "<%s>: %s", userid.c_str(), message.c_str());
- n = strlen(cname)+1 + userid.length() + 4 + message.length();
- length = miles_rtp_make_rtcp_app(pkt, out_rtcp_video_stream->ssrc, "text", n, msgbuf);
- if(length>0 && out_rtcp_video_stream)
- out_rtcp_video_stream->send_packet(out_rtcp_video_stream->socket, pkt, length, 0);
-}
-
-void MilesSessionInvoker::processEventGetText(const std::string& origin) {
- Event ev;
- ev.data.compound["origin"] = Data(origin, Data::INTERPRETED);
- if(num_connected==0) {
- LOG(ERROR) << "not connected";
- ev.name = "gettext.error";
- returnEvent(ev);
- return;
- }
-
- ev.name = "gettext.reply";
- if(confero_text_msg_available) {
- strcpy(text_msg_buf, confero_text_msg_buf);
- ev.data.compound["message"] = Data(text_msg_buf, Data::VERBATIM);
- //ev.data.compound["message"] = Data(base64_encode(text_msg_buf, strlen(text_msg_buf)), Data::VERBATIM);
- ev.data.compound["user"] = Data("username1", Data::VERBATIM);
- memset(confero_text_msg_buf, 0, 1000);
- confero_text_msg_available = 0;
- }
-
- returnEvent(ev);
-}
-
-void MilesSessionInvoker::runAudio(void* instance) {
- ((MilesSessionInvoker*)instance)->processAudio();
-}
-
-void MilesSessionInvoker::runVideo(void* instance) {
- ((MilesSessionInvoker*)instance)->processVideo();
-}
-
-void MilesSessionInvoker::processVideo() {
- while(_isRunning) {
- rtp_video_receiver(video_session);
- if(video_grabber_available && sendvideo_enabled)
- video_transmitter(video_grabber, video_encoder, out_rtp_video_stream, out_rtcp_video_stream);
- }
- /* done, clean up */
- if(video_grabber_available) {
- miles_rtp_destroy_out_stream(out_rtp_video_stream);
- miles_video_grabber_destroy(video_grabber);
- miles_video_codec_destroy_encoder(video_encoder);
- video_grabber_available = 0;
- sendvideo_enabled = 0;
- }
- miles_rtp_destroy_session(video_session);
- miles_list_destroy(thumb_list);
- thumb_list = NULL;
- miles_net_socket_close(video_rtp_in_socket);
- miles_net_socket_close(video_rtcp_in_socket);
-
- free_video_buffers();
-}
-
-void MilesSessionInvoker::processAudio() {
- while(_isRunning) {
- rtp_audio_receiver(audio_session);
- if(audio_available && sendaudio_enabled)
- audio_transmitter(audio_dev, audio_encoder, out_rtp_audio_stream, out_rtcp_audio_stream);
- }
- /* done, clean up */
- if(audio_available) {
- miles_rtp_destroy_out_stream(out_rtp_audio_stream);
- if(audio_dev_playback)
- miles_audio_device_close(MILES_AUDIO_IO_OPENAL, audio_dev_playback, 0);
- if(audio_dev)
- miles_audio_device_close(MILES_AUDIO_IO_OPENAL, audio_dev, 1);
- miles_audio_codec_destroy_encoder(audio_encoder);
- audio_available = 0;
- sendaudio_enabled = 0;
- }
- miles_rtp_destroy_session(audio_session);
- miles_net_socket_close(audio_rtp_in_socket);
- miles_net_socket_close(audio_rtcp_in_socket);
-
- free_video_buffers();
-}
-
-int MilesSessionInvoker::setup_audio() {
- /* Check that we have OpeanAL audio */
- if(!miles_audio_io_is_supported(MILES_AUDIO_IO_OPENAL)) {
- fprintf(stderr, "OpenAL audio i/o not supported on this platform.\n");
- return 0;
- }
-
- /* Initialize and configure audio encoder */
- audio_encoder = miles_audio_codec_init_encoder();
- audio_encoder->codec_id = miles_audio_codec_get_encoder_for_rtp_payload_type(MILES_RTP_PAYLOAD_TYPE_L16);
- audio_encoder->sample_rate = 16000;
- audio_encoder->bytes_per_sample = 2;
- audio_encoder->chunk_size = 320; /* 20 ms */
- audio_encoder->input_format = MILES_AUDIO_FORMAT_PCM;
- int rv = miles_audio_codec_setup_encoder(audio_encoder);
- if(rv == 0) {
- /* Couldn't set up audio codec */
- LOG(ERROR) << "Couldn't set up audio codec";
- return 0;
- }
-
- /* Set up audio grabber */
- int n = miles_audio_device_get_supported_devices(MILES_AUDIO_IO_OPENAL, &supported_audio_devices);
- if(n<=0) {
- /* No audio device available */
- LOG(ERROR) << "No audio device available";
- return 0;
- }
- /* Use first device that supports capture */
- for(int i=0; i<n; i++) {
- audio_dev = miles_audio_device_open(MILES_AUDIO_IO_OPENAL, supported_audio_devices[i].id, MILES_AUDIO_FORMAT_PCM, 16000, 2, 1, 640, 1);
- if(audio_dev)
- break;
- }
- if(audio_dev == NULL) {
- LOG(ERROR) << "No audio device supporting capture available";
- return 0;
- }
-
- /* Find first audio device that supports playback */
- for(int i=0; i<n; i++) {
- audio_dev_playback = miles_audio_device_open(MILES_AUDIO_IO_OPENAL, supported_audio_devices[i].id, MILES_AUDIO_FORMAT_PCM, 16000, 2, 1, 640, 0);
- if(audio_dev_playback) {
- audio_dev_playback_id = supported_audio_devices[i].id;
- break;
- }
- }
- if(audio_dev_playback == NULL) {
- LOG(ERROR) << "No audio device supporting playback available";
- return 0;
- }
-
- audio_in_buf = (char *)malloc(audio_encoder->sample_rate*audio_encoder->bytes_per_sample);
- encoded_out_audio = (char *)malloc(audio_encoder->sample_rate*audio_encoder->bytes_per_sample);
- audio_read_buf = (char *)malloc(audio_encoder->sample_rate*audio_encoder->bytes_per_sample);
- audio_data = (char *)malloc(1000000);
-
- LOG(ERROR) << "audio device set up";
- return 1;
-}
-
-int MilesSessionInvoker::setup_video_grabber() {
- struct miles_video_grabber_description *grabber_description;
-
- /* Set up video grabber */
- int n = miles_video_grabber_get_supported_grabbers(&supported_video_grabbers);
- if(n<=0) {
- /* No video grabber available */
- LOG(ERROR) << "No video grabber available";
- return 0;
- }
- int use_grabber = 0;
- if(n>1) {
- /* If more than one grabber, select one that is not 'Test' */
- for(int i=0; i<n; i++) {
- grabber_description = miles_video_grabber_get_description(supported_video_grabbers[i]);
- if(strcmp(grabber_description->name, "Test") != 0) {
- /* Make sure there is a device */
- if(grabber_description->devices != NULL) {
- use_grabber = i;
- free(grabber_description);
- break;
- }
- }
- free(grabber_description);
- }
- }
- grabber_description = miles_video_grabber_get_description(supported_video_grabbers[use_grabber]);
- printf("Using video grabber %s\n", grabber_description->name);
- video_grabber = miles_video_grabber_create_context(supported_video_grabbers[use_grabber]);
- video_grabber->width = 320;
- video_grabber->height = 240;
- video_grabber->frame_rate = 25*100;
- /* Select first supported image format */
- struct miles_video_grabber_device *dev;
- dev = (struct miles_video_grabber_device *)grabber_description->devices->item;
- struct miles_int_struct *img_format;
- img_format = (struct miles_int_struct *)dev->capabilities->formats->item;
- video_grabber->image_format = img_format->value;
- miles_video_grabber_setup(video_grabber);
- free(supported_video_grabbers);
- free(grabber_description);
-
- /* Initialize and configure video encoder */
- video_encoder = miles_video_codec_init_encoder();
- video_encoder->codec_id = miles_video_codec_get_encoder_for_rtp_payload_type(MILES_RTP_PAYLOAD_TYPE_JPEG);
- video_encoder->width = video_grabber->width = 320;
- video_encoder->height = video_grabber->height = 240;
- video_encoder->qfactor = 50;
- //video_encoder->input_format = MILES_IMAGE_RGB; //video_grabber->image_format;
- int rv = miles_video_codec_setup_encoder(video_encoder);
- if (!rv) {
- LOG(ERROR) << "Could not setup video encoder";
- return 0;
- }
-
- video_out_buf = (char *)malloc(video_encoder->width*video_encoder->height*4);
- encoded_out_img = (char *)malloc(video_encoder->width*video_encoder->height*4);
-
- return 1;
-}
-
-void MilesSessionInvoker::cancel(const std::string sendId) {
-}
-
-void MilesSessionInvoker::invoke(const InvokeRequest& req) {
- video_port = 5566;
- audio_port = 5568;
- thumb_list = NULL;
- save_image = 0;
-}
-
-/**
- * Render video image in a window
- */
-void MilesSessionInvoker::render_video_image(char *img, int width, int height, int img_format) {
- char *img_buf_ptr;
-
- if(img_format != MILES_IMAGE_RGB) {
- if(render_img==NULL || render_img_size < width*height*4) {
- if(render_img)
- free(render_img);
- render_img_size = width*height*4;
- render_img = (char *)malloc(render_img_size);
- }
- miles_image_convert(img, render_img, img_format, MILES_IMAGE_RGB, width, height);
- img_buf_ptr = render_img;
- } else {
- img_buf_ptr = img;
- }
-
- /* save image to disk */
- if(save_image)
- miles_image_file_write(MILES_IMAGE_FILE_FORMAT_PNG, MILES_IMAGE_RGB, "image.png", width, height, img_buf_ptr);
-
- /* render image in window... to be implementd. */
-}
-
-
-/**
- * Send an audio chunk decoded from an RTP stream to an audio device
- */
-void MilesSessionInvoker::playback_audio(u_int32_t ssrc, char *buf, int sample_rate, int bps, int audio_format, int size) {
-
- if(size<0)
- return;
-
- /* re-configure audio device, if needed */
- if(audio_dev_playback == NULL || audio_dev_playback->chunk_size != size || audio_dev_playback->sample_rate != sample_rate ||
- audio_dev_playback->format != audio_format || audio_dev_playback->bytes_per_sample != bps) {
- if(audio_dev_playback)
- miles_audio_device_close(MILES_AUDIO_IO_OPENAL, audio_dev_playback, 0);
- audio_dev_playback = miles_audio_device_open(MILES_AUDIO_IO_OPENAL, audio_dev_playback_id, audio_format, sample_rate, bps, 1, size, 0);
- if(audio_dev_playback == NULL)
- return;
- }
-
- /* play audio */
- miles_audio_device_write(MILES_AUDIO_IO_OPENAL, audio_dev_playback, buf, size);
-}
-
-/**
- * Handle incoming video streams
- */
-
-int MilesSessionInvoker::video_receiver(struct miles_rtp_in_stream *rtp_stream, char *data, int bytes_read) {
- int status, n;
- struct miles_video_codec_decode_context *codec_ctx;
- char *codec_name;
- struct miles_list *p;
- struct thumb_entry *te;
-
- codec_ctx = (struct miles_video_codec_decode_context *)rtp_stream->codec_ctx;
-
- if(codec_ctx == NULL || !miles_video_codec_decoder_supports_rtp_payload_type(codec_ctx, rtp_stream->payload_type)) {
- if(codec_ctx)
- miles_video_codec_destroy_decoder(codec_ctx);
- codec_ctx = miles_video_codec_init_decoder();
- codec_ctx->codec_id = miles_video_codec_get_decoder_for_rtp_payload_type(rtp_stream->payload_type);
- if(codec_ctx->codec_id == MILES_VIDEO_CODEC_UNKNOWN) {
- /* Cannot decode the video stream */
- return 0;
- }
-
- status = miles_video_codec_setup_decoder(codec_ctx);
- if(status == 0) {
- /* Cannot decode the video stream */
- return 0;
- }
- rtp_stream->codec_ctx = (void *)codec_ctx;
- return 0;
- }
-
- /* Find thumbnail list entry of the stream */
- _mutex.lock();
- p = thumb_list;
- while(p) {
- te = (struct thumb_entry *)p->item;
- if(te->ssrc == rtp_stream->ssrc) {
- break;
- }
- p = p->next;
- }
- if(p==NULL) {
- // Create new thumbnail list entry
- te = (struct thumb_entry *)malloc(sizeof(struct thumb_entry));
- if(thumb_list==NULL)
- p = thumb_list = miles_list_create(te);
- else
- p = miles_list_append(thumb_list, te);
- te->ssrc = rtp_stream->ssrc;
- te->window_ctx = NULL;
- te->userid = NULL;
- te->img_buf = (char *)malloc(bytes_read);
- te->buf_size = bytes_read;
- te->img_size = 0;
- te->decode_buf = NULL;
- }
- if(te->buf_size < bytes_read) {
- // Need bigger image buffer
- free(te->img_buf);
- te->img_buf = (char *)malloc(bytes_read);
- te->buf_size = bytes_read;
- }
- /*
- * If codec is JPEG, thumbnail image can be saved without decoding
- */
- codec_name = miles_video_codec_get_codec_name(codec_ctx->codec_id);
- if(codec_name==NULL) {
- _mutex.unlock();
- return 0;
- }
- if(strcmp(codec_name, "JPEG")==0) {
- memcpy(te->img_buf, data, bytes_read);
- te->img_size = bytes_read;
- te->img_format = WEBCONFERO_THUMB_JPEG;
- //miles_image_file_write(MILES_IMAGE_FILE_FORMAT_JPG, MILES_IMAGE_JPEG, "test.jpg", bytes_read, 1, data);
- // If we're not going to render the video in a window, we're done now
- if(te->window_ctx==NULL) {
- _mutex.unlock();
- return 0;
- }
- } else {
- te->img_format = WEBCONFERO_THUMB_PNG;
- }
- free(codec_name);
-
- if(te->decode_buf==NULL) {
- te->decode_buf = (char *)malloc(1920*1080*4);
- }
- n = miles_video_codec_decode(codec_ctx, data, te->decode_buf, bytes_read);
- if(n > 0) {
- if(te->img_format==WEBCONFERO_THUMB_PNG) {
- if(n > te->buf_size) {
- free(te->img_buf);
- te->img_buf = (char *)malloc(n);
- te->buf_size = n;
- }
- // Need to insert a PNG header here...
- memcpy(te->img_buf, te->decode_buf, n);
- te->img_size = n;
- }
- if(te->window_ctx)
- render_video_image(te->decode_buf, codec_ctx->width, codec_ctx->height, codec_ctx->output_format);
- }
- _mutex.unlock();
-
- return n;
-}
-
-/**
- * Handle incoming audio streams
- */
-
-int MilesSessionInvoker::audio_receiver(struct miles_rtp_in_stream *rtp_stream, char *data, int bytes_read) {
- int status, size;
- struct miles_audio_codec_decode_context *codec_ctx;
-
- codec_ctx = (struct miles_audio_codec_decode_context *)rtp_stream->codec_ctx;
-
- if(codec_ctx == NULL || !miles_audio_codec_decoder_supports_rtp_payload_type(codec_ctx, rtp_stream->payload_type)) {
- if(codec_ctx)
- miles_audio_codec_destroy_decoder(codec_ctx);
- codec_ctx = miles_audio_codec_init_decoder();
- codec_ctx->codec_id = miles_audio_codec_get_decoder_for_rtp_payload_type(rtp_stream->payload_type);
- if(codec_ctx->codec_id == MILES_AUDIO_CODEC_UNKNOWN) {
- /* Cannot decode the audio stream */
- return 0;
- }
- status = miles_audio_codec_setup_decoder(codec_ctx);
- if(status == 0) {
- /* Cannot decode the audio stream */
- return 0;
- }
- rtp_stream->codec_ctx = (void *)codec_ctx;
- }
- size = miles_audio_codec_decode(codec_ctx, data, audio_in_buf);
- if(size > 0) {
- playback_audio(rtp_stream->ssrc, audio_in_buf, codec_ctx->sample_rate, codec_ctx->bytes_per_sample, codec_ctx->output_format, size);
- }
- return size;
-}
-
-/**
- * Read and depacketize incoming RTP streams
- */
-
-void MilesSessionInvoker::rtp_audio_receiver(struct miles_rtp_session *rtp_session) {
- int n;
- struct miles_rtp_in_stream *rtp_stream;
-
- /* Poll RTP socket, read all available RTP packets */
- while (1) {
- n = miles_net_wait_socket(rtp_session->socket, 10);
- if(n<=0) return;
-
- /* Read RTP data */
- n = miles_rtp_recv(rtp_session, &rtp_stream, audio_data);
- if(n>0) {
- audio_receiver(rtp_stream, audio_data, n);
- }
-
- /* Poll RTCP socket */
- n = miles_net_poll_socket(rtp_session->rtcp_session->socket);
- if(n>0) {
- /* Do RTCP packet processEventing */
- n = miles_rtp_recv_rtcp(rtp_session->rtcp_session);
- }
- }
-}
-
-void MilesSessionInvoker::rtp_video_receiver(struct miles_rtp_session *rtp_session) {
- int n;
- struct miles_rtp_in_stream *rtp_stream;
-
- /* Poll RTP socket, read all available RTP packets */
- while (1) {
- n = miles_net_wait_socket(rtp_session->socket, 10);
- if(n<=0) return;
-
- /* Read RTP data */
- n = miles_rtp_recv(rtp_session, &rtp_stream, video_data);
- if(n>0) {
- video_receiver(rtp_stream, video_data, n);
- }
-
- /* Poll RTCP socket */
- n = miles_net_poll_socket(rtp_session->rtcp_session->socket);
- if(n>0) {
- /* Do RTCP packet processEventing */
- n = miles_rtp_recv_rtcp(rtp_session->rtcp_session);
- }
- }
-}
-
-/**
- * Send RTP video stream
- */
-int MilesSessionInvoker::video_transmitter(struct miles_video_grabber_context *grabber, struct miles_video_codec_encode_context *codec_ctx, struct miles_rtp_out_stream *rtp_stream, struct miles_rtcp_out_stream *out_rtcp_stream) {
- int n;
- static struct timeval last_time;
- static int first_time=1;
- struct timeval now;
- int tbf;
- char *video_buf_ptr;
-
-#ifndef WIN32
- // Need to fix gettimeofday() on Win
- if (first_time) {
- gettimeofday(&last_time, 0);
- first_time = 0;
- }
- gettimeofday(&now, 0);
- tbf = 100000 / grabber->frame_rate;
- if (miles_elapsed_time(&last_time, &now) < tbf)
- return 0;
-
- last_time = now;
-#endif
-
- /* Send RTCP packets, if due */
- miles_rtp_send_rtcp(out_rtcp_stream);
-
- n = miles_video_grabber_grab(grabber, video_out_buf);
- if(n <= 0)
- return 0;
- if(grabber->image_format != codec_ctx->input_format) {
- /* image conversion ... */
- if(video_conv_buf==NULL)
- video_conv_buf = (char *)malloc(codec_ctx->width*codec_ctx->height*4);
- printf("converting video...\n");
- miles_image_convert(video_out_buf, video_conv_buf, grabber->image_format, codec_ctx->input_format, codec_ctx->width, codec_ctx->height);
- video_buf_ptr = video_conv_buf;
- } else {
- video_buf_ptr = video_out_buf;
- }
- n = miles_video_codec_encode(codec_ctx, video_buf_ptr, encoded_out_img);
- if(n<=0)
- return 0;
- return miles_rtp_send(rtp_stream, encoded_out_img, n);
-}
-
-/**
- * Send RTP audio stream
- */
-int MilesSessionInvoker::audio_transmitter(struct miles_audio_device *dev, struct miles_audio_codec_encode_context *codec_ctx, struct miles_rtp_out_stream *rtp_stream, struct miles_rtcp_out_stream *out_rtcp_audio_stream) {
- int n;
-
- /* Send RTCP packets, if due */
- miles_rtp_send_rtcp(out_rtcp_audio_stream);
-
- n = miles_audio_device_read(MILES_AUDIO_IO_OPENAL, dev, audio_read_buf, codec_ctx->chunk_size);
- if(n <= 0)
- return 0;
- if(dev->format != codec_ctx->input_format) {
- /* audio conversion needed ... */
- }
- n = miles_audio_codec_encode(codec_ctx, audio_read_buf, encoded_out_audio);
- if(n<=0)
- return 0;
- return miles_rtp_send(rtp_stream, encoded_out_audio, n);
-}
-
-
-}
diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
deleted file mode 100644
index 148be68..0000000
--- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef MILESSESIONINVOKER_H_W09J90F0
-#define MILESSESIONINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-
-extern "C" {
-#include "miles/miles.h"
-#include "miles/network.h"
-#include "miles/rtp.h"
-#include "miles/audio_codec.h"
-#include "miles/audio_io.h"
-#include "miles/audio_device.h"
-#include "miles/video_codec.h"
-#include "miles/video_grabber.h"
-#include "miles/session.h"
-#include "miles/image.h"
-#include "miles/list.h"
- long miles_elapsed_time(struct timeval *before, struct timeval *after);
-}
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-#define WEBCONFERO_THUMB_NONE 0
-#define WEBCONFERO_THUMB_JPEG 1
-#define WEBCONFERO_THUMB_PNG 2
-
-struct thumb_entry {
- char *img_buf;
- int buf_size; // The size of the buffer malloced
- int img_size; // The size of the image
- int img_format; // JPEG or PNG image
- char *decode_buf;
- u_int32_t ssrc;
- char *userid; // The user id assigned to the video stream
- void *window_ctx; // The context of the window popped up when the thumbnail is clicked.
-};
-
-namespace uscxml {
-
-class MilesSessionInvoker : public InvokerImpl {
-public:
- MilesSessionInvoker();
- virtual ~MilesSessionInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("miles");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#miles");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
- void processEventStart(const std::string& origin, const std::string& userid, const std::string& reflector, const std::string& session);
- void processEventStop(const std::string& origin);
- void processEventParticipants(const std::string& origin);
- void processEventThumbnail(const std::string& origin, const std::string& userid);
- void processEventVideoOn(const std::string& origin, const std::string& userid);
- void processEventVideoOff(const std::string& origin, const std::string& userid);
- void processEventAudioOn(const std::string& origin, const std::string& userid);
- void processEventAudioOff(const std::string& origin, const std::string& userid);
- void processEventSendVideo(const std::string& origin, size_t width, size_t height, size_t framerate, const std::string& compression);
- void processEventSendVideoOff(const std::string& origin);
- void processEventSendAudio(const std::string& origin, const std::string& encoding);
- void processEventSendAudioOff(const std::string& origin);
- void processEventPostText(const std::string& origin, const std::string& userid, const std::string& message);
- void processEventGetText(const std::string& origin);
-
- int _imageSeq;
-
- int video_rtp_in_socket, audio_rtp_in_socket;
- int video_rtp_out_socket, audio_rtp_out_socket;
- int video_rtcp_in_socket, audio_rtcp_in_socket;
- int video_rtcp_out_socket, audio_rtcp_out_socket;
- struct miles_rtp_session *video_session, *audio_session;
- struct miles_video_codec_encode_context *video_encoder;
- struct miles_audio_codec_encode_context *audio_encoder;
- int *supported_video_grabbers;
- struct miles_video_grabber_context *video_grabber;
- struct miles_rtp_out_stream *out_rtp_video_stream, *out_rtp_audio_stream;
- struct miles_rtcp_out_stream *out_rtcp_video_stream, *out_rtcp_audio_stream;
- struct miles_audio_device *audio_dev;
- struct miles_audio_device_description *supported_audio_devices;
- int video_port, audio_port;
- std::string ip_address;
-
- char *video_out_buf;
- char *video_conv_buf;
- char *encoded_out_img;
- char *audio_in_buf;
- char *render_img;
- int render_img_size;
- char *audio_data;
- char *video_data;
-
- char *encoded_out_audio;
- char *audio_read_buf;
- struct miles_list *thumb_list;
- int save_image;
-
- char *text_msg_buf;
- int text_msg_available;
-
- struct miles_audio_device *audio_dev_playback;
- int audio_dev_playback_id;
- int audio_available;
- int video_grabber_available;
- int sendvideo_enabled;
- int sendaudio_enabled;
-
- static void runAudio(void* instance);
- static void runVideo(void* instance);
- void processVideo();
- void processAudio();
- int setup_video_grabber();
- int setup_audio();
-
- void init_media_buffers();
- void free_media_buffers();
- void free_video_buffers();
- void free_audio_buffers();
- void free_text_buffers();
-
- void render_video_image(char *img, int width, int height, int img_format);
- void playback_audio(u_int32_t ssrc, char *buf, int sample_rate, int bps, int audio_format, int size);
- int video_receiver(struct miles_rtp_in_stream *rtp_stream, char *data, int bytes_read);
- int audio_receiver(struct miles_rtp_in_stream *rtp_stream, char *data, int bytes_read);
- void rtp_audio_receiver(struct miles_rtp_session *rtp_session);
- void rtp_video_receiver(struct miles_rtp_session *rtp_session);
- int video_transmitter(struct miles_video_grabber_context *grabber, struct miles_video_codec_encode_context *codec_ctx, struct miles_rtp_out_stream *rtp_stream, struct miles_rtcp_out_stream *out_rtcp_stream);
- int audio_transmitter(struct miles_audio_device *dev, struct miles_audio_codec_encode_context *codec_ctx, struct miles_rtp_out_stream *rtp_stream, struct miles_rtcp_out_stream *out_rtcp_audio_stream);
-
-
- bool _isRunning;
- int num_connected;
- std::string _userId, _reflector, _session;
- tthread::thread* _videoThread;
- tthread::thread* _audioThread;
- tthread::recursive_mutex _mutex;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(MilesSessionInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: MILESSESIONINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
deleted file mode 100644
index d91b14c..0000000
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "SampleInvoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SampleInvokerProvider() );
- return true;
-}
-#endif
-
-SampleInvoker::SampleInvoker() {
-}
-
-SampleInvoker::~SampleInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> SampleInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<SampleInvoker> invoker = boost::shared_ptr<SampleInvoker>(new SampleInvoker());
- return invoker;
-}
-
-Data SampleInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void SampleInvoker::send(const SendRequest& req) {
-}
-
-void SampleInvoker::cancel(const std::string sendId) {
-}
-
-void SampleInvoker::invoke(const InvokeRequest& req) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
deleted file mode 100644
index f7bcb24..0000000
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SAMPLEINVOKER_H_W09J90F0
-#define SAMPLEINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class SampleInvoker : public InvokerImpl {
-public:
- SampleInvoker();
- virtual ~SampleInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("sample");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#sample");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(SampleInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: SAMPLEINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
index 62f7a1e..4d3c579 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
@@ -18,16 +18,22 @@
*/
#include "USCXMLInvoker.h"
-#include <glog/logging.h>
-#include "uscxml/dom/DOMUtils.h"
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
+
+#include "uscxml/config.h"
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
#endif
+#ifdef UNIX
+#include <pthread.h>
+#endif
+
namespace uscxml {
+// msxml.h should die in a fire for polluting the global namespace
+// using namespace xercesc;
+
#ifdef BUILD_AS_PLUGINS
PLUMA_CONNECTOR
bool pluginConnect(pluma::Host& host) {
@@ -36,26 +42,88 @@ bool pluginConnect(pluma::Host& host) {
}
#endif
-USCXMLInvoker::USCXMLInvoker() : _cancelled(false) {
- _parentQueue._invoker = this;
+USCXMLInvoker::USCXMLInvoker() {
+ _parentQueue = EventQueue(std::shared_ptr<ParentQueueImpl>(new ParentQueueImpl(this)));
+ _thread = NULL;
+ _isActive = false;
+ _isStarted = false;
}
USCXMLInvoker::~USCXMLInvoker() {
+ stop();
};
+void USCXMLInvoker::start() {
+ _isStarted = true;
+ _thread = new std::thread(USCXMLInvoker::run, this);
+}
+
+void USCXMLInvoker::stop() {
+ _isStarted = false;
+ _isActive = false;
+
+ if (_thread) {
+ /**
+ * We cannot join the invoked thread if it is blocking at an external
+ * receive. Cancel will finalize and unblock.
+ */
+ _invokedInterpreter.cancel();
+ _thread->join();
+ delete _thread;
+ _thread = NULL;
+ }
+}
+
void USCXMLInvoker::uninvoke() {
- _cancelled = true;
- Event event;
- event.name = "unblock.and.die";
- if (_invokedInterpreter)
+ _isActive = false;
+ stop();
+}
+
+void USCXMLInvoker::eventFromSCXML(const Event& event) {
+ if (_isActive) {
_invokedInterpreter.receive(event);
+ }
+}
+
+void USCXMLInvoker::run(void* instance) {
+ USCXMLInvoker* INSTANCE = (USCXMLInvoker*)instance;
+
+#ifdef APPLE
+ std::string threadName;
+ threadName += "uscxml::";
+ threadName += (INSTANCE->_invokedInterpreter.getImpl()->_name.size() > 0 ? INSTANCE->_invokedInterpreter.getImpl()->_name : "anon");
+ threadName += ".scxml";
+
+ pthread_setname_np(threadName.c_str());
+#endif
+ InterpreterState state = USCXML_UNDEF;
+ while(state != USCXML_FINISHED) {
+ state = INSTANCE->_invokedInterpreter.step(true);
+
+// if (!INSTANCE->_isStarted) {
+// // we have been cancelled
+// INSTANCE->_isActive = false;
+// return;
+// }
+ }
+
+ if (INSTANCE->_isActive) {
+ // we finished on our own and were not cancelled
+ Event e;
+ e.eventType = Event::PLATFORM;
+ e.invokeid = INSTANCE->_invokedInterpreter.getImpl()->getInvokeId();
+ e.name = "done.invoke." + e.invokeid;
+ INSTANCE->_interpreter->enqueueExternal(e);
+ }
+
+ INSTANCE->_isActive = false;
}
-boost::shared_ptr<InvokerImpl> USCXMLInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<USCXMLInvoker> invoker = boost::shared_ptr<USCXMLInvoker>(new USCXMLInvoker());
- invoker->_parentInterpreter = interpreter;
+std::shared_ptr<InvokerImpl> USCXMLInvoker::create(InterpreterImpl* interpreter) {
+ std::shared_ptr<USCXMLInvoker> invoker(new USCXMLInvoker());
+ invoker->_interpreter = interpreter;
return invoker;
}
@@ -64,71 +132,65 @@ Data USCXMLInvoker::getDataModelVariables() {
return data;
}
-void USCXMLInvoker::send(const SendRequest& req) {
- if (_invokedInterpreter)
- _invokedInterpreter.receive(req);
-}
-
-void USCXMLInvoker::cancel(const std::string sendId) {
- assert(false);
-}
+void USCXMLInvoker::invoke(const std::string& source, const Event& invokeEvent) {
+ if (source.length() > 0) {
+ _invokedInterpreter = Interpreter::fromURL(source);
+ } else if (invokeEvent.data.node) {
+ xercesc::DOMImplementation* implementation = xercesc::DOMImplementationRegistry::getDOMImplementation(X("core"));
+ xercesc::DOMDocument* document = implementation->createDocument();
-void USCXMLInvoker::invoke(const InvokeRequest& req) {
- _cancelled = false;
- if (req.src.length() > 0) {
- _invokedInterpreter = Interpreter::fromURL(req.src);
- } else if (req.dom) {
- Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Arabica::DOM::Document<std::string> dom = domFactory.createDocument(req.dom.getNamespaceURI(), "", 0);
// we need to import the parent - to support xpath test150
- Arabica::DOM::Node<std::string> newNode = dom.importNode(req.dom, true);
- dom.appendChild(newNode);
+ xercesc::DOMNode* newNode = document->importNode(invokeEvent.data.node, true);
+ document->appendChild(newNode);
+
+// std::cout << *document << std::endl;
+
// TODO: where do we get the namespace from?
- _invokedInterpreter = Interpreter::fromDOM(dom, _interpreter->getNameSpaceInfo(), _interpreter->getSourceURL());
- } else if (req.content.size() > 0) {
- _invokedInterpreter = Interpreter::fromXML(req.content, _interpreter->getSourceURL());
+ _invokedInterpreter = Interpreter::fromDocument(document, _interpreter->getBaseURL());
+
} else {
- LOG(ERROR) << "Cannot invoke nested SCXML interpreter, neither src attribute nor content nor DOM is given";
+ _isActive = false;
+ ERROR_PLATFORM_THROW("Cannot invoke nested SCXML interpreter, neither src attribute nor content nor DOM is given");
}
- if (_invokedInterpreter) {
- if (req.elem && HAS_ATTR(req.elem, "initial")) {
- _invokedInterpreter.setInitalConfiguration(tokenize(ATTR(req.elem, "initial")));
- }
- DataModel dataModel(_invokedInterpreter.getImpl()->getDataModel());
- _invokedInterpreter.getImpl()->setParentQueue(&_parentQueue);
+ if (_invokedInterpreter) {
+ _invokedInterpreter.getImpl()->_parentQueue = _parentQueue;
+ _invokedInterpreter.getImpl()->_invokeId = invokeEvent.invokeid;
+ _invokedInterpreter.getImpl()->_invokeReq = invokeEvent;
// copy monitors
- std::set<InterpreterMonitor*>::const_iterator monIter = _interpreter->_monitors.begin();
- while(monIter != _interpreter->_monitors.end()) {
- if ((*monIter)->copyToInvokers()) {
- _invokedInterpreter.getImpl()->_monitors.insert(*monIter);
- }
- monIter++;
- }
-
- // transfer namespace prefixes
- _invokedInterpreter.setNameSpaceInfo(_parentInterpreter->getNameSpaceInfo());
- _invokedInterpreter.getImpl()->_sessionId = req.invokeid;
+// std::set<InterpreterMonitor*>::const_iterator monIter = _interpreter->_monitors.begin();
+// while(monIter != _interpreter->_monitors.end()) {
+// if ((*monIter)->copyToInvokers()) {
+// _invokedInterpreter.getImpl()->_monitors.insert(*monIter);
+// }
+// monIter++;
+// }
+
/// test240 assumes that invoke request params will carry over to the datamodel
- _invokedInterpreter.getImpl()->setInvokeRequest(req);
+// _invokedInterpreter.getImpl()->setInvokeRequest(req);
+ _isActive = true;
+
+ // we need to make sure it is at least setup to receive data!
+ _invokedInterpreter.getImpl()->init();
+
+ start();
- _invokedInterpreter.start();
} else {
/// test 530
- _parentInterpreter->receive(Event("done.invoke." + _invokeId, Event::PLATFORM));
+ Event e("done.invoke." + invokeEvent.invokeid, Event::PLATFORM);
+ eventToSCXML(e, USCXML_INVOKER_SCXML_TYPE, _invokeId);
+ _isActive = false;
}
}
-void USCXMLInvoker::ParentQueue::push(const SendRequest& event) {
+void USCXMLInvoker::ParentQueueImpl::enqueue(const Event& event) {
// test 252
- if (_invoker->_cancelled)
+ if (!_invoker->_isActive)
return;
- SendRequest copyEvent(event);
- // this is somewhat hidden here!
- copyEvent.invokeid = _invoker->_invokeId;
- _invoker->_parentInterpreter->receive(copyEvent);
+ Event copy(event); // TODO: can we get around a copy?
+ _invoker->eventToSCXML(copy, USCXML_INVOKER_SCXML_TYPE, _invoker->_invokeId);
}
} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
index f5f8fbd..dac8d8b 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
@@ -21,56 +21,57 @@
#define USCXMLINVOKER_H_OQFA21IO
#include <uscxml/Interpreter.h>
-#include <boost/enable_shared_from_this.hpp>
-#include "uscxml/concurrency/BlockingQueue.h"
+#include "uscxml/interpreter/EventQueueImpl.h"
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
#endif
-namespace uscxml {
+#define USCXML_INVOKER_SCXML_TYPE "http://www.w3.org/TR/scxml"
-class Interpreter;
-class USCXMLInvoker;
+namespace uscxml {
class USCXMLInvoker :
public InvokerImpl,
- public boost::enable_shared_from_this<USCXMLInvoker> {
+ public std::enable_shared_from_this<USCXMLInvoker> {
public:
- class ParentQueue : public concurrency::BlockingQueue<SendRequest> {
+ class ParentQueueImpl : public EventQueueImpl {
public:
- ParentQueue() {}
- virtual void push(const SendRequest& event);
+ ParentQueueImpl(USCXMLInvoker* invoker) : _invoker(invoker) {}
+ virtual void enqueue(const Event& event);
USCXMLInvoker* _invoker;
};
USCXMLInvoker();
virtual ~USCXMLInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
+ virtual std::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
+
virtual std::list<std::string> getNames() {
std::list<std::string> names;
names.push_back("scxml");
names.push_back("uscxml");
- names.push_back("http://www.w3.org/TR/scxml");
+ names.push_back(USCXML_INVOKER_SCXML_TYPE);
names.push_back("http://www.w3.org/TR/scxml/");
return names;
}
- virtual bool deleteOnUninvoke() {
- return false;
- }
+ virtual void eventFromSCXML(const Event& event);
virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
+ virtual void invoke(const std::string& source, const Event& invokeEvent);
virtual void uninvoke();
protected:
- bool _cancelled;
- ParentQueue _parentQueue;
+
+ void start();
+ void stop();
+ static void run(void* instance);
+
+ bool _isActive;
+ bool _isStarted;
+ std::thread* _thread;
+ EventQueue _parentQueue;
Interpreter _invokedInterpreter;
- InterpreterImpl* _parentInterpreter;
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/plugins/invoker/smtp/SMTPInvoker.cpp b/src/uscxml/plugins/invoker/smtp/SMTPInvoker.cpp
deleted file mode 100644
index 90b777c..0000000
--- a/src/uscxml/plugins/invoker/smtp/SMTPInvoker.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "SMTPInvoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#include <boost/algorithm/string.hpp>
-#include "uscxml/UUID.h"
-#include "uscxml/messages/Blob.h"
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SMTPInvokerProvider() );
- return true;
-}
-#endif
-
-SMTPInvoker::SMTPInvoker() {
-}
-
-SMTPInvoker::~SMTPInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> SMTPInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<SMTPInvoker> invoker = boost::shared_ptr<SMTPInvoker>(new SMTPInvoker());
- return invoker;
-}
-
-Data SMTPInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-size_t SMTPInvoker::writeCurlData(void *ptr, size_t size, size_t nmemb, void *userdata) {
- if (!userdata)
- return 0;
-
- SMTPContext* ctx = (SMTPContext*)userdata;
-
- size_t toWrite = (std::min)(ctx->content.length() - ctx->readPtr, size * nmemb);
- if (toWrite > 0) {
- memcpy (ptr, ctx->content.c_str() + ctx->readPtr, toWrite);
- ctx->readPtr += toWrite;
- }
-
- return toWrite;
-}
-
-std::list<std::string> SMTPInvoker::getAtoms(std::list<Data> list) {
- std::list<std::string> atoms;
-
- std::list<Data>::const_iterator iter = list.begin();
- while(iter != list.end()) {
- const Data& data = *iter;
- if (data.atom.size() > 0) {
- atoms.push_back(data.atom);
- } else if (data.array.size() > 0) {
- std::list<Data>::const_iterator arrIter = data.array.begin();
- while(arrIter != data.array.end()) {
- if (arrIter->atom.size() > 0) {
- atoms.push_back(arrIter->atom);
- arrIter++;
- }
- }
- }
- iter++;
- }
- return atoms;
-}
-
-void SMTPInvoker::getAttachments(std::list<Data> list, std::list<Data>& attachments) {
- // accumulate attachments with filename, mimetype and data
- std::list<Data>::const_iterator iter = list.begin();
- while(iter != list.end()) {
- const Data& data = *iter;
- if (data.hasKey("data")) {
- // compound structure with all information
- Data att = data;
-
- if (!att.hasKey("mimetype")) {
- if (att["data"].binary && att["data"].binary.getMimeType().size() > 0) {
- att.compound["mimetype"] = Data(att["data"].binary.getMimeType(), Data::VERBATIM);
- } else {
- att.compound["mimetype"] = Data("text/plain", Data::VERBATIM);
- }
- }
-
- if (!att.hasKey("filename")) {
- std::stringstream filenameSS;
- filenameSS << "attachment" << attachments.size() + 1;
- if (boost::starts_with(att.compound["mimetype"].atom, "text")) {
- filenameSS << ".txt";
- } else {
- filenameSS << ".bin";
- }
- att.compound["filename"] = Data(filenameSS.str(), Data::VERBATIM);
- }
-
- attachments.push_back(att);
-
- } else if (data.binary) {
- // a single binary blob
- Data att;
-
- att.compound["data"].binary = data.binary;
-
- if (data.binary.getMimeType().size() > 0) {
- att.compound["mimetype"] = Data(attachments.back()["data"].binary.getMimeType(), Data::VERBATIM);
- } else {
- att.compound["mimetype"] = Data("application/octet-stream", Data::VERBATIM);
- }
-
- std::stringstream filenameSS;
- filenameSS << "attachment" << attachments.size() + 1;
- if (boost::starts_with(att.compound["mimetype"].atom, "text")) {
- filenameSS << ".txt";
- } else {
- filenameSS << ".bin";
- }
- att.compound["filename"] = Data(filenameSS.str(), Data::VERBATIM);
-
- attachments.push_back(att);
-
- } else if (data.compound.size() > 0) {
- // data is some compound, descent to find attachment structures or binaries
- std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
- while(compIter != data.compound.end()) {
- std::list<Data> tmp;
- tmp.push_back(compIter->second);
- getAttachments(tmp, attachments);
- compIter++;
- }
- } else if (data.array.size() > 0) {
- // descent into array
- getAttachments(data.array, attachments);
- }
- iter++;
- }
-}
-
-void SMTPInvoker::send(const SendRequest& req) {
- if (iequals(req.name, "mail.send")) {
-
- struct curl_slist* recipients = NULL;
- CURLcode curlError;
- std::string multipartSep;
-
- bool verbose;
- std::string from;
- std::string subject;
- std::string contentType;
- std::list<Data> headerParams;
- std::list<Data> toParams;
- std::list<Data> ccParams;
- std::list<Data> bccParams;
- std::list<Data> attachmentParams;
-
- Event::getParam(req.params, "verbose", verbose);
- Event::getParam(req.params, "Content-Type", contentType);
- Event::getParam(req.params, "attachment", attachmentParams);
- Event::getParam(req.params, "from", from);
- Event::getParam(req.params, "subject", subject);
- Event::getParam(req.params, "header", headerParams);
- Event::getParam(req.params, "to", toParams);
- Event::getParam(req.params, "cc", ccParams);
- Event::getParam(req.params, "bcc", bccParams);
-
- if (contentType.size() == 0)
- contentType = "text/plain; charset=\"UTF-8\"";
-
- SMTPContext* ctx = new SMTPContext();
- std::stringstream contentSS;
-
- std::list<std::string>::const_iterator recIter;
- std::list<std::string> to = getAtoms(toParams);
- std::list<std::string> cc = getAtoms(ccParams);
- std::list<std::string> bcc = getAtoms(bccParams);
- std::list<std::string> headers = getAtoms(headerParams);
- std::list<Data> attachments;
- getAttachments(attachmentParams, attachments);
-
- if (to.size() == 0)
- return;
-
- recIter = to.begin();
- recIter++; // skip first as we need it in CURLOPT_MAIL_RCPT
- while(recIter != to.end()) {
- contentSS << "TO: " << *recIter << std::endl;
- recIter++;
- }
- recIter = cc.begin();
- while(recIter != cc.end()) {
- contentSS << "CC: " << *recIter << std::endl;
- recIter++;
- }
- recIter = bcc.begin();
- while(recIter != bcc.end()) {
- contentSS << "BCC: " << *recIter << std::endl;
- recIter++;
- }
-
- recIter = headers.begin();
- while(recIter != headers.end()) {
- contentSS << *recIter << std::endl;
- recIter++;
- }
-
- if (subject.length() > 0) {
- boost::replace_all(subject, "\n\r", " ");
- boost::replace_all(subject, "\r\n", " ");
- boost::replace_all(subject, "\n", " ");
- boost::replace_all(subject, "\r", " ");
- contentSS << "Subject: " << subject << "\n";
- }
-
- // content type is different when we have attachments
- if (attachments.size() > 0) {
- multipartSep = UUID::getUUID();
- boost::replace_all(multipartSep, "-", "");
- contentSS << "Content-Type: multipart/mixed; boundary=\"" << multipartSep << "\"\n";
- contentSS << "MIME-Version: 1.0\n";
- contentSS << "\n";
- contentSS << "--" << multipartSep << "\n";
- contentSS << "Content-Type: " << contentType << "\n";
- } else {
- // when we have no attachment, respect user-defined or use text/plain
- contentSS << "Content-Type: " << contentType << "\n";
- }
-
- contentSS << "\n";
- contentSS << req.content;
-
- std::list<Data>::iterator attIter = attachments.begin();
- while(attIter != attachments.end()) {
- // only send valid attachments
- if(!attIter->hasKey("filename") || !attIter->hasKey("mimetype") || !attIter->hasKey("data")) {
- LOG(ERROR) << "Not sending attachment as filename, mimetype or data is missing: " << *attIter;
- } else {
- contentSS << "\n\n";
- contentSS << "--" << multipartSep << "\n";
- contentSS << "Content-Disposition: attachment; filename=\"" << attIter->compound["filename"].atom << "\"";
- contentSS << "\n";
-
- contentSS << "Content-Type: " << attIter->compound["mimetype"].atom << "; ";
- contentSS << "name=\"" << attIter->compound["filename"].atom << "\"";
- contentSS << "\n";
-
- if (attIter->compound["data"].binary) {
- contentSS << "Content-Transfer-Encoding: base64";
- contentSS << "\n\n";
- contentSS << attIter->compound["data"].binary.base64();
- } else {
- contentSS << "Content-Transfer-Encoding: 7Bit";
- contentSS << "\n\n";
- contentSS << attIter->compound["data"].atom;
- }
- }
- attIter++;
- }
-
- ctx->content = contentSS.str();
- ctx->invoker = this;
-
-
- // see http://curl.haxx.se/libcurl/c/smtp-tls.html
- _curl = curl_easy_init();
- if(_curl) {
- (curlError = curl_easy_setopt(_curl, CURLOPT_USERNAME, _username.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set username: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_PASSWORD, _password.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set password: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_URL, _server.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set server string: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL)) == CURLE_OK ||
- LOG(ERROR) << "Cannot use SSL: " << curl_easy_strerror(curlError);
-
- // this is needed, even if we have a callback function
- recipients = curl_slist_append(recipients, to.begin()->c_str());
- (curlError = curl_easy_setopt(_curl, CURLOPT_MAIL_RCPT, recipients)) == CURLE_OK ||
- LOG(ERROR) << "Cannot set mail recipient: " << curl_easy_strerror(curlError);
-
- (curlError = curl_easy_setopt(_curl, CURLOPT_READFUNCTION, SMTPInvoker::writeCurlData)) == CURLE_OK ||
- LOG(ERROR) << "Cannot register read function: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_READDATA, ctx)) == CURLE_OK ||
- LOG(ERROR) << "Cannot register userdata for read function: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_UPLOAD, 1L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot set upload parameter: " << curl_easy_strerror(curlError);
-
-#if 1
- (curlError = curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot unset verify peer with SSL: " << curl_easy_strerror(curlError);
- (curlError = curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 0L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot unset verify host with SSL: " << curl_easy_strerror(curlError);
-#else
- (curlError = curl_easy_setopt(_curl, CURLOPT_CAINFO, "/path/to/certificate.pem")) == CURLE_OK ||
- LOG(ERROR) << "Cannot set CA info path: " << curl_easy_strerror(curlError);
-#endif
-
- if (from.length() > 0) {
- (curlError = curl_easy_setopt(_curl, CURLOPT_MAIL_FROM, from.c_str())) == CURLE_OK ||
- LOG(ERROR) << "Cannot set from parameter: " << curl_easy_strerror(curlError);
- }
-
- if (verbose) {
- (curlError = curl_easy_setopt(_curl, CURLOPT_VERBOSE, 1L)) == CURLE_OK ||
- LOG(ERROR) << "Cannot set curl to verbose: " << curl_easy_strerror(curlError);
- }
-
- CURLcode res = curl_easy_perform(_curl);
-
- /* Check for errors */
- if(res != CURLE_OK) {
- LOG(ERROR) << "curl_easy_perform() failed: " << curl_easy_strerror(res);
- returnErrorExecution("error.mail.send");
- } else {
- returnErrorExecution("success.mail.send");
- }
- /* Free the list of recipients */
- if (recipients)
- curl_slist_free_all(recipients);
-
- /* Always cleanup */
- curl_easy_cleanup(_curl);
-
- }
-
- }
-}
-
-void SMTPInvoker::cancel(const std::string sendId) {
-}
-
-void SMTPInvoker::invoke(const InvokeRequest& req) {
- Event::getParam(req.params, "username", _username);
- Event::getParam(req.params, "password", _password);
- Event::getParam(req.params, "server", _server);
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h b/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h
deleted file mode 100644
index 5975b4b..0000000
--- a/src/uscxml/plugins/invoker/smtp/SMTPInvoker.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SMTPINVOKER_H_W09J90F0
-#define SMTPINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-#include <curl/curl.h>
-
-namespace uscxml {
-
-class SMTPInvoker : public InvokerImpl {
-public:
- SMTPInvoker();
- virtual ~SMTPInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("smtp");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#smtp");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-
- class SMTPContext {
- public:
- SMTPContext() : readPtr(0) {}
- std::string content;
- size_t readPtr;
- SMTPInvoker* invoker;
- };
-
- CURL* _curl;
- std::string _username;
- std::string _password;
- std::string _server;
-
- std::list<std::string> getAtoms(std::list<Data> list);
- void getAttachments(std::list<Data> list, std::list<Data>& attachments);
- static size_t writeCurlData(void *ptr, size_t size, size_t nmemb, void *userdata);
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(SMTPInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: SMTPINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp
deleted file mode 100644
index debe371..0000000
--- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "Sqlite3Invoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new Sqlite3InvokerProvider() );
- return true;
-}
-#endif
-
-Sqlite3Invoker::Sqlite3Invoker() {
-}
-
-Sqlite3Invoker::~Sqlite3Invoker() {
-};
-
-boost::shared_ptr<InvokerImpl> Sqlite3Invoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<Sqlite3Invoker> invoker = boost::shared_ptr<Sqlite3Invoker>(new Sqlite3Invoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data Sqlite3Invoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void Sqlite3Invoker::send(const SendRequest& req) {
-}
-
-void Sqlite3Invoker::cancel(const std::string sendId) {
-}
-
-void Sqlite3Invoker::invoke(const InvokeRequest& req) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
deleted file mode 100644
index b6e5031..0000000
--- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SQLITE3INVOKER_H_W09J90F0
-#define SQLITE3INVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class Sqlite3Invoker : public InvokerImpl {
-public:
- Sqlite3Invoker();
- virtual ~Sqlite3Invoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("sqlite3");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#sqlite3");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(Sqlite3Invoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: SQLITE3INVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp
deleted file mode 100644
index c5f574f..0000000
--- a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "SystemInvoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add(new SystemInvokerProvider());
- return true;
-}
-#endif
-
-SystemInvoker::SystemInvoker() {
-}
-
-SystemInvoker::~SystemInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> SystemInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<SystemInvoker> invoker = boost::shared_ptr<SystemInvoker>(new SystemInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data SystemInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void SystemInvoker::send(const SendRequest& req) {
-}
-
-void SystemInvoker::cancel(const std::string sendId) {
-}
-
-void SystemInvoker::invoke(const InvokeRequest& req) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.h b/src/uscxml/plugins/invoker/system/SystemInvoker.h
deleted file mode 100644
index a3d1451..0000000
--- a/src/uscxml/plugins/invoker/system/SystemInvoker.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SYSTEMINVOKER_H_W09J90F0
-#define SYSTEMINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class SystemInvoker : public InvokerImpl {
-public:
- SystemInvoker();
- virtual ~SystemInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("system");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#system");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(SystemInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: SYSTEMINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/umundo/JSON.pb.cc b/src/uscxml/plugins/invoker/umundo/JSON.pb.cc
deleted file mode 100644
index 9e245c1..0000000
--- a/src/uscxml/plugins/invoker/umundo/JSON.pb.cc
+++ /dev/null
@@ -1,462 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: JSON.proto
-
-#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
-#include "JSON.pb.h"
-
-#include <algorithm>
-
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/generated_message_reflection.h>
-#include <google/protobuf/reflection_ops.h>
-#include <google/protobuf/wire_format.h>
-// @@protoc_insertion_point(includes)
-
-namespace {
-
-const ::google::protobuf::Descriptor* JSONProto_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
- JSONProto_reflection_ = NULL;
-
-} // namespace
-
-
-void protobuf_AssignDesc_JSON_2eproto() {
- protobuf_AddDesc_JSON_2eproto();
- const ::google::protobuf::FileDescriptor* file =
- ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
- "JSON.proto");
- GOOGLE_CHECK(file != NULL);
- JSONProto_descriptor_ = file->message_type(0);
- static const int JSONProto_offsets_[4] = {
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, compound_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, key_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, atom_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, verbatim_),
- };
- JSONProto_reflection_ =
- new ::google::protobuf::internal::GeneratedMessageReflection(
- JSONProto_descriptor_,
- JSONProto::default_instance_,
- JSONProto_offsets_,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, _has_bits_[0]),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, _unknown_fields_),
- -1,
- ::google::protobuf::DescriptorPool::generated_pool(),
- ::google::protobuf::MessageFactory::generated_factory(),
- sizeof(JSONProto));
-}
-
-namespace {
-
-GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
-inline void protobuf_AssignDescriptorsOnce() {
- ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
- &protobuf_AssignDesc_JSON_2eproto);
-}
-
-void protobuf_RegisterTypes(const ::std::string&) {
- protobuf_AssignDescriptorsOnce();
- ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
- JSONProto_descriptor_, &JSONProto::default_instance());
-}
-
-} // namespace
-
-void protobuf_ShutdownFile_JSON_2eproto() {
- delete JSONProto::default_instance_;
- delete JSONProto_reflection_;
-}
-
-void protobuf_AddDesc_JSON_2eproto() {
- static bool already_here = false;
- if (already_here) return;
- already_here = true;
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
- "\n\nJSON.proto\"V\n\tJSONProto\022\034\n\010compound\030\001 "
- "\003(\0132\n.JSONProto\022\013\n\003key\030\002 \001(\t\022\014\n\004atom\030\003 \001"
- "(\t\022\020\n\010verbatim\030\004 \001(\010", 100);
- ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
- "JSON.proto", &protobuf_RegisterTypes);
- JSONProto::default_instance_ = new JSONProto();
- JSONProto::default_instance_->InitAsDefaultInstance();
- ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_JSON_2eproto);
-}
-
-// Force AddDescriptors() to be called at static initialization time.
-struct StaticDescriptorInitializer_JSON_2eproto {
- StaticDescriptorInitializer_JSON_2eproto() {
- protobuf_AddDesc_JSON_2eproto();
- }
-} static_descriptor_initializer_JSON_2eproto_;
-
-// ===================================================================
-
-#ifndef _MSC_VER
-const int JSONProto::kCompoundFieldNumber;
-const int JSONProto::kKeyFieldNumber;
-const int JSONProto::kAtomFieldNumber;
-const int JSONProto::kVerbatimFieldNumber;
-#endif // !_MSC_VER
-
-JSONProto::JSONProto()
- : ::google::protobuf::Message() {
- SharedCtor();
-}
-
-void JSONProto::InitAsDefaultInstance() {
-}
-
-JSONProto::JSONProto(const JSONProto& from)
- : ::google::protobuf::Message() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void JSONProto::SharedCtor() {
- _cached_size_ = 0;
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- verbatim_ = false;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-JSONProto::~JSONProto() {
- SharedDtor();
-}
-
-void JSONProto::SharedDtor() {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- delete key_;
- }
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- delete atom_;
- }
- if (this != default_instance_) {
- }
-}
-
-void JSONProto::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* JSONProto::descriptor() {
- protobuf_AssignDescriptorsOnce();
- return JSONProto_descriptor_;
-}
-
-const JSONProto& JSONProto::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_JSON_2eproto();
- return *default_instance_;
-}
-
-JSONProto* JSONProto::default_instance_ = NULL;
-
-JSONProto* JSONProto::New() const {
- return new JSONProto;
-}
-
-void JSONProto::Clear() {
- if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) {
- if (has_key()) {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- key_->clear();
- }
- }
- if (has_atom()) {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- atom_->clear();
- }
- }
- verbatim_ = false;
- }
- compound_.Clear();
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
- mutable_unknown_fields()->Clear();
-}
-
-bool JSONProto::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // repeated .JSONProto compound = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_compound:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, add_compound()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(10)) goto parse_compound;
- if (input->ExpectTag(18)) goto parse_key;
- break;
- }
-
- // optional string key = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_key:
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->mutable_key()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->key().data(), this->key().length(),
- ::google::protobuf::internal::WireFormat::PARSE);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(26)) goto parse_atom;
- break;
- }
-
- // optional string atom = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_atom:
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->mutable_atom()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->atom().data(), this->atom().length(),
- ::google::protobuf::internal::WireFormat::PARSE);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(32)) goto parse_verbatim;
- break;
- }
-
- // optional bool verbatim = 4;
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_verbatim:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
- input, &verbatim_)));
- set_has_verbatim();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void JSONProto::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // repeated .JSONProto compound = 1;
- for (int i = 0; i < this->compound_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 1, this->compound(i), output);
- }
-
- // optional string key = 2;
- if (has_key()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->key().data(), this->key().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- ::google::protobuf::internal::WireFormatLite::WriteString(
- 2, this->key(), output);
- }
-
- // optional string atom = 3;
- if (has_atom()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->atom().data(), this->atom().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- ::google::protobuf::internal::WireFormatLite::WriteString(
- 3, this->atom(), output);
- }
-
- // optional bool verbatim = 4;
- if (has_verbatim()) {
- ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->verbatim(), output);
- }
-
- if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
- unknown_fields(), output);
- }
-}
-
-::google::protobuf::uint8* JSONProto::SerializeWithCachedSizesToArray(
- ::google::protobuf::uint8* target) const {
- // repeated .JSONProto compound = 1;
- for (int i = 0; i < this->compound_size(); i++) {
- target = ::google::protobuf::internal::WireFormatLite::
- WriteMessageNoVirtualToArray(
- 1, this->compound(i), target);
- }
-
- // optional string key = 2;
- if (has_key()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->key().data(), this->key().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- target =
- ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
- 2, this->key(), target);
- }
-
- // optional string atom = 3;
- if (has_atom()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->atom().data(), this->atom().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- target =
- ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
- 3, this->atom(), target);
- }
-
- // optional bool verbatim = 4;
- if (has_verbatim()) {
- target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->verbatim(), target);
- }
-
- if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
- unknown_fields(), target);
- }
- return target;
-}
-
-int JSONProto::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) {
- // optional string key = 2;
- if (has_key()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::StringSize(
- this->key());
- }
-
- // optional string atom = 3;
- if (has_atom()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::StringSize(
- this->atom());
- }
-
- // optional bool verbatim = 4;
- if (has_verbatim()) {
- total_size += 1 + 1;
- }
-
- }
- // repeated .JSONProto compound = 1;
- total_size += 1 * this->compound_size();
- for (int i = 0; i < this->compound_size(); i++) {
- total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->compound(i));
- }
-
- if (!unknown_fields().empty()) {
- total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
- unknown_fields());
- }
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void JSONProto::MergeFrom(const ::google::protobuf::Message& from) {
- GOOGLE_CHECK_NE(&from, this);
- const JSONProto* source =
- ::google::protobuf::internal::dynamic_cast_if_available<const JSONProto*>(
- &from);
- if (source == NULL) {
- ::google::protobuf::internal::ReflectionOps::Merge(from, this);
- } else {
- MergeFrom(*source);
- }
-}
-
-void JSONProto::MergeFrom(const JSONProto& from) {
- GOOGLE_CHECK_NE(&from, this);
- compound_.MergeFrom(from.compound_);
- if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) {
- if (from.has_key()) {
- set_key(from.key());
- }
- if (from.has_atom()) {
- set_atom(from.atom());
- }
- if (from.has_verbatim()) {
- set_verbatim(from.verbatim());
- }
- }
- mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void JSONProto::CopyFrom(const ::google::protobuf::Message& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-void JSONProto::CopyFrom(const JSONProto& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool JSONProto::IsInitialized() const {
-
- return true;
-}
-
-void JSONProto::Swap(JSONProto* other) {
- if (other != this) {
- compound_.Swap(&other->compound_);
- std::swap(key_, other->key_);
- std::swap(atom_, other->atom_);
- std::swap(verbatim_, other->verbatim_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- _unknown_fields_.Swap(&other->_unknown_fields_);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::google::protobuf::Metadata JSONProto::GetMetadata() const {
- protobuf_AssignDescriptorsOnce();
- ::google::protobuf::Metadata metadata;
- metadata.descriptor = JSONProto_descriptor_;
- metadata.reflection = JSONProto_reflection_;
- return metadata;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-// @@protoc_insertion_point(global_scope)
diff --git a/src/uscxml/plugins/invoker/umundo/JSON.pb.h b/src/uscxml/plugins/invoker/umundo/JSON.pb.h
deleted file mode 100644
index ff65656..0000000
--- a/src/uscxml/plugins/invoker/umundo/JSON.pb.h
+++ /dev/null
@@ -1,361 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: JSON.proto
-
-#ifndef PROTOBUF_JSON_2eproto__INCLUDED
-#define PROTOBUF_JSON_2eproto__INCLUDED
-
-#include <string>
-
-#include <google/protobuf/stubs/common.h>
-
-
-#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/message.h>
-#include <google/protobuf/repeated_field.h>
-#include <google/protobuf/extension_set.h>
-#include <google/protobuf/unknown_field_set.h>
-// @@protoc_insertion_point(includes)
-
-// Internal implementation detail -- do not call these.
-void protobuf_AddDesc_JSON_2eproto();
-void protobuf_AssignDesc_JSON_2eproto();
-void protobuf_ShutdownFile_JSON_2eproto();
-
-class JSONProto;
-
-// ===================================================================
-
-class JSONProto : public ::google::protobuf::Message {
-public:
- JSONProto();
- virtual ~JSONProto();
-
- JSONProto(const JSONProto& from);
-
- inline JSONProto& operator=(const JSONProto& from) {
- CopyFrom(from);
- return *this;
- }
-
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _unknown_fields_;
- }
-
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return &_unknown_fields_;
- }
-
- static const ::google::protobuf::Descriptor* descriptor();
- static const JSONProto& default_instance();
-
- void Swap(JSONProto* other);
-
- // implements Message ----------------------------------------------
-
- JSONProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const JSONProto& from);
- void MergeFrom(const JSONProto& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
- int GetCachedSize() const {
- return _cached_size_;
- }
-private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
-public:
-
- ::google::protobuf::Metadata GetMetadata() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // repeated .JSONProto compound = 1;
- inline int compound_size() const;
- inline void clear_compound();
- static const int kCompoundFieldNumber = 1;
- inline const ::JSONProto& compound(int index) const;
- inline ::JSONProto* mutable_compound(int index);
- inline ::JSONProto* add_compound();
- inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
- compound() const;
- inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
- mutable_compound();
-
- // optional string key = 2;
- inline bool has_key() const;
- inline void clear_key();
- static const int kKeyFieldNumber = 2;
- inline const ::std::string& key() const;
- inline void set_key(const ::std::string& value);
- inline void set_key(const char* value);
- inline void set_key(const char* value, size_t size);
- inline ::std::string* mutable_key();
- inline ::std::string* release_key();
- inline void set_allocated_key(::std::string* key);
-
- // optional string atom = 3;
- inline bool has_atom() const;
- inline void clear_atom();
- static const int kAtomFieldNumber = 3;
- inline const ::std::string& atom() const;
- inline void set_atom(const ::std::string& value);
- inline void set_atom(const char* value);
- inline void set_atom(const char* value, size_t size);
- inline ::std::string* mutable_atom();
- inline ::std::string* release_atom();
- inline void set_allocated_atom(::std::string* atom);
-
- // optional bool verbatim = 4;
- inline bool has_verbatim() const;
- inline void clear_verbatim();
- static const int kVerbatimFieldNumber = 4;
- inline bool verbatim() const;
- inline void set_verbatim(bool value);
-
- // @@protoc_insertion_point(class_scope:JSONProto)
-private:
- inline void set_has_key();
- inline void clear_has_key();
- inline void set_has_atom();
- inline void clear_has_atom();
- inline void set_has_verbatim();
- inline void clear_has_verbatim();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::RepeatedPtrField< ::JSONProto > compound_;
- ::std::string* key_;
- ::std::string* atom_;
- bool verbatim_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_JSON_2eproto();
- friend void protobuf_AssignDesc_JSON_2eproto();
- friend void protobuf_ShutdownFile_JSON_2eproto();
-
- void InitAsDefaultInstance();
- static JSONProto* default_instance_;
-};
-// ===================================================================
-
-
-// ===================================================================
-
-// JSONProto
-
-// repeated .JSONProto compound = 1;
-inline int JSONProto::compound_size() const {
- return compound_.size();
-}
-inline void JSONProto::clear_compound() {
- compound_.Clear();
-}
-inline const ::JSONProto& JSONProto::compound(int index) const {
- return compound_.Get(index);
-}
-inline ::JSONProto* JSONProto::mutable_compound(int index) {
- return compound_.Mutable(index);
-}
-inline ::JSONProto* JSONProto::add_compound() {
- return compound_.Add();
-}
-inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
-JSONProto::compound() const {
- return compound_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
-JSONProto::mutable_compound() {
- return &compound_;
-}
-
-// optional string key = 2;
-inline bool JSONProto::has_key() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void JSONProto::set_has_key() {
- _has_bits_[0] |= 0x00000002u;
-}
-inline void JSONProto::clear_has_key() {
- _has_bits_[0] &= ~0x00000002u;
-}
-inline void JSONProto::clear_key() {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- key_->clear();
- }
- clear_has_key();
-}
-inline const ::std::string& JSONProto::key() const {
- return *key_;
-}
-inline void JSONProto::set_key(const ::std::string& value) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(value);
-}
-inline void JSONProto::set_key(const char* value) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(value);
-}
-inline void JSONProto::set_key(const char* value, size_t size) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* JSONProto::mutable_key() {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- return key_;
-}
-inline ::std::string* JSONProto::release_key() {
- clear_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- return NULL;
- } else {
- ::std::string* temp = key_;
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- return temp;
- }
-}
-inline void JSONProto::set_allocated_key(::std::string* key) {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- delete key_;
- }
- if (key) {
- set_has_key();
- key_ = key;
- } else {
- clear_has_key();
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- }
-}
-
-// optional string atom = 3;
-inline bool JSONProto::has_atom() const {
- return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void JSONProto::set_has_atom() {
- _has_bits_[0] |= 0x00000004u;
-}
-inline void JSONProto::clear_has_atom() {
- _has_bits_[0] &= ~0x00000004u;
-}
-inline void JSONProto::clear_atom() {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- atom_->clear();
- }
- clear_has_atom();
-}
-inline const ::std::string& JSONProto::atom() const {
- return *atom_;
-}
-inline void JSONProto::set_atom(const ::std::string& value) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(value);
-}
-inline void JSONProto::set_atom(const char* value) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(value);
-}
-inline void JSONProto::set_atom(const char* value, size_t size) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* JSONProto::mutable_atom() {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- return atom_;
-}
-inline ::std::string* JSONProto::release_atom() {
- clear_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- return NULL;
- } else {
- ::std::string* temp = atom_;
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- return temp;
- }
-}
-inline void JSONProto::set_allocated_atom(::std::string* atom) {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- delete atom_;
- }
- if (atom) {
- set_has_atom();
- atom_ = atom;
- } else {
- clear_has_atom();
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- }
-}
-
-// optional bool verbatim = 4;
-inline bool JSONProto::has_verbatim() const {
- return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void JSONProto::set_has_verbatim() {
- _has_bits_[0] |= 0x00000008u;
-}
-inline void JSONProto::clear_has_verbatim() {
- _has_bits_[0] &= ~0x00000008u;
-}
-inline void JSONProto::clear_verbatim() {
- verbatim_ = false;
- clear_has_verbatim();
-}
-inline bool JSONProto::verbatim() const {
- return verbatim_;
-}
-inline void JSONProto::set_verbatim(bool value) {
- set_has_verbatim();
- verbatim_ = value;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-#ifndef SWIG
-namespace google {
-namespace protobuf {
-
-
-} // namespace google
-} // namespace protobuf
-#endif // SWIG
-
-// @@protoc_insertion_point(global_scope)
-
-#endif // PROTOBUF_JSON_2eproto__INCLUDED
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
deleted file mode 100644
index 0302d87..0000000
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ /dev/null
@@ -1,655 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "UmundoInvoker.h"
-#include <glog/logging.h>
-#include "uscxml/URL.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new UmundoInvokerProvider() );
- return true;
-}
-#endif
-
-UmundoInvoker::UmundoInvoker() : _node(NULL), _discovery(NULL), _pub(NULL), _sub(NULL) {
-}
-
-UmundoInvoker::~UmundoInvoker() {
- if (_node) {
- if (_sub) {
- _node->removeSubscriber(*_sub);
- delete _sub;
- }
- if (_pub) {
- _node->removePublisher(*_pub);
- delete _pub;
- }
- delete(_node);
- }
-};
-
-boost::shared_ptr<InvokerImpl> UmundoInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<UmundoInvoker> invoker = boost::shared_ptr<UmundoInvoker>(new UmundoInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data UmundoInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void UmundoInvoker::send(const SendRequest& req) {
- umundo::Message msg;
-
- if (req.name.length() > 0) {
- msg.putMeta("event", req.name);
- } else {
- msg.putMeta("event", "umundo");
- }
-
- try {
- Data data = req.data;
-
- if (data.empty() && req.content.length())
- data = _interpreter->getDataModel().getStringAsData(req.content);
-
- if (data.empty()) {
- LOG(ERROR) << "Cannot transform content to data object per datamodel or no data given";
- return;
- }
-
-// std::cout << Data::toJSON(data) << std::endl;
-
- std::string type;
- if (req.params.find("type") != req.params.end()) {
- // we are supposed to build a typed object
- type = req.params.find("type")->second.atom;
-
- const google::protobuf::Message* protoMsg = umundo::PBSerializer::getProto(type);
- if (protoMsg == NULL) {
- LOG(ERROR) << "No type '" << type << "' is known, pass a directory with proto .desc files via types param when invoking";
- return;
- }
-
- google::protobuf::Message* pbMsg = protoMsg->New();
- if (!dataToProtobuf(pbMsg, data)) {
- LOG(ERROR) << "Cannot create message from JSON - not sending";
- return;
- }
-
- if (!_isService) {
- // add all s11n properties
- _pub->prepareMsg(&msg, type, pbMsg);
- _pub->send(&msg);
- } else {
- // invoke as service
- std::map<umundo::ServiceDescription, umundo::ServiceStub*>::iterator svcIter = _svcs.begin();
- while(svcIter != _svcs.end()) {
- umundo::ServiceStub* stub = svcIter->second;
- Event event;
- void* rv = NULL;
- stub->callStubMethod(req.name, pbMsg, type, rv, "");
- protobufToData(event.data, *(const google::protobuf::Message*)rv);
-
- event.name = _invokeId + ".reply." + req.name;
- event.origin = msg.getMeta("um.channel");
- event.origintype = "umundo";
- event.eventType = Event::EXTERNAL;
-
- returnEvent(event);
- svcIter++;
- }
- }
- } else {
- // just encode JSON
- JSONProto* jsonProtoMsg = new JSONProto();
- if (!dataToJSONbuf(jsonProtoMsg, data)) {
- LOG(ERROR) << "Cannot create message from JSON - not sending";
- return;
- }
-
- if (!_isService) {
- // add all s11n properties
- _pub->prepareMsg(&msg, "JSON", jsonProtoMsg);
- _pub->send(&msg);
- } else {
- LOG(ERROR) << "Cannot invoke services with untyped JSON";
- return;
- }
-
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error when invoking umundo:" << std::endl << e << std::endl;
- return;
- }
-}
-
-void UmundoInvoker::cancel(const std::string sendId) {
- assert(false);
-}
-
-void UmundoInvoker::invoke(const InvokeRequest& req) {
-
- std::string domain;
- std::string channelName;
- std::string serviceName;
-
- if (req.params.find("channel") != req.params.end()) {
- channelName = req.params.find("channel")->second.atom;
- _isService = false;
- } else if (req.params.find("service") != req.params.end()) {
- serviceName = req.params.find("service")->second.atom;
- _isService = true;
- } else {
- LOG(ERROR) << "Invoking umundo needs a service or a channel param";
- return;
- }
- if (req.params.find("domain") != req.params.end()) {
- domain = req.params.find("domain")->second.atom;
- }
- _node = new umundo::Node();
-
- umundo::DiscoveryConfigMDNS discOpts;
- _discovery = new umundo::Discovery(&discOpts);
-
- _discovery->add(*_node);
-
- // add type from .proto or .desc files
- std::list<std::string> type;
- Event::getParam(req.params, "type", type);
- std::list<std::string>::const_iterator typeIter = type.begin();
- while(typeIter != type.end()) {
- URL typeURI(*typeIter);
- if (typeURI.toAbsolute(_interpreter->getBaseURL(req.elem))) {
- std::string filename = typeURI.asLocalFile(".proto");
- umundo::PBSerializer::addProto(filename);
- } else {
- LOG(ERROR) << "umundo invoker has relative type src but no baseURI set with interpreter.";
- }
- typeIter++;
- }
-
- // add directory with .proto or .desc files
- std::list<std::string> types;
- Event::getParam(req.params, "type", types);
- std::list<std::string>::const_iterator typesIter = types.begin();
- while(typesIter != types.end()) {
- URL typeURI(*typesIter);
- if (typeURI.toAbsolute(_interpreter->getBaseURL(req.elem))) {
- umundo::PBSerializer::addProto(typeURI.path());
- } else {
- LOG(ERROR) << "invoke element has relative src URI with no baseURI set.";
- }
- typesIter++;
- }
-
- if (!_isService) {
- // use umundo to publish objects on a channel
- _pub = new umundo::TypedPublisher(channelName);
- _sub = new umundo::TypedSubscriber(channelName, this);
-
- _pub->setGreeter(this);
- _sub->registerType("JSON", new JSONProto());
-
- _node->addPublisher(*_pub);
- _node->addSubscriber(*_sub);
-
- } else if (serviceName.length() > 0) {
- // use umundo to access services
- _svcFilter = new umundo::ServiceFilter(serviceName);
- _node->connect(_svcMgr);
- _svcMgr->startQuery(*_svcFilter, this);
- }
-}
-
-void UmundoInvoker::welcome(umundo::TypedPublisher atPub, const umundo::SubscriberStub& sub) {
- Event event;
- event.name = "umundo.sub.added";
- event.data.compound["subId"] = Data(sub.getUUID(), Data::VERBATIM);
- event.data.compound["channel"] = Data(atPub.getChannelName(), Data::VERBATIM);
- event.data.compound["totalSubs"] = Data(toStr(atPub.waitForSubscribers(0)), Data::VERBATIM);
- returnEvent(event);
-}
-
-void UmundoInvoker::farewell(umundo::TypedPublisher fromPub, const umundo::SubscriberStub& sub) {
- Event event;
- event.name = "umundo.sub.removed";
- event.data.compound["subId"] = Data(sub.getUUID(), Data::VERBATIM);
- event.data.compound["channel"] = Data(fromPub.getChannelName(), Data::VERBATIM);
- event.data.compound["totalSubs"] = Data(toStr(fromPub.waitForSubscribers(0)), Data::VERBATIM);
- returnEvent(event);
-}
-
-void UmundoInvoker::receive(void* object, umundo::Message* msg) {
- uscxml::Event event;
- if (msg->getMeta().find("event") != msg->getMeta().end()) {
- event.name = msg->getMeta("event");
- } else {
- event.name = "umundo.rcvd";
- }
-
- event.invokeid = _invokeId;
- event.origin = msg->getMeta("um.channel");
- event.origintype = "umundo";
- event.eventType = Event::EXTERNAL;
-
- if (object != NULL) {
- if (msg->getMeta().find("um.s11n.type") != msg->getMeta().end() &&
- boost::equals(msg->getMeta().find("um.s11n.type")->second, "JSON")) {
- jsonbufToData(event.data, *(JSONProto*)object);
- } else {
- 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 (isNumeric(metaIter->second.c_str(), 10)) {
- event.data.compound[metaIter->first] = Data(metaIter->second, Data::INTERPRETED);
- } else {
- event.data.compound[metaIter->first] = Data(metaIter->second, Data::VERBATIM);
- }
- metaIter++;
- }
-
- if (msg->size() > 0) {
- event.data.compound["protobuf"] = Data(msg->data(), msg->size(), "application/x-protobuf");
- }
-
- returnEvent(event);
-}
-
-void UmundoInvoker::added(umundo::ServiceDescription desc) {
- LOG(ERROR) << "Service found!";
-
- umundo::ServiceStub* stub = new umundo::ServiceStub(desc);
- _svcs[desc] = stub;
-
- Event addedEvent;
- addedEvent.invokeid = _invokeId;
- addedEvent.origin = desc.getName();
- addedEvent.origintype = "umundo";
- addedEvent.eventType = Event::EXTERNAL;
- addedEvent.name = _invokeId + ".added";
-
- std::map<std::string, std::string>::const_iterator propIter = desc.getProperties().begin();
- while(propIter != desc.getProperties().end()) {
- addedEvent.data.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
- propIter++;
- }
-
- returnEvent(addedEvent);
-}
-
-void UmundoInvoker::removed(umundo::ServiceDescription desc) {
- LOG(ERROR) << "Service lost!";
-
- if (_svcs.find(desc) == _svcs.end()) {
- return;
- }
-
- delete _svcs[desc];
- _svcs.erase(desc);
-
- Event addedEvent;
- addedEvent.invokeid = _invokeId;
- addedEvent.origin = desc.getName();
- addedEvent.origintype = "umundo";
- addedEvent.eventType = Event::EXTERNAL;
- addedEvent.name = _invokeId + ".removed";
-
- std::map<std::string, std::string>::const_iterator propIter = desc.getProperties().begin();
- while(propIter != desc.getProperties().end()) {
- addedEvent.data.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
- propIter++;
- }
-
- returnEvent(addedEvent);
-}
-
-void UmundoInvoker::changed(umundo::ServiceDescription desc, uint64_t what) {
-}
-
-bool UmundoInvoker::jsonbufToData(Data& data, const JSONProto& json) {
- if (json.compound_size() > 0) {
- if (json.compound(0).key().size() > 0) {
- // compound
- for (int i = 0; i < json.compound_size(); i++) {
- jsonbufToData(data.compound[json.compound(i).key()], json.compound(i));
- }
- } else {
- // array
- for (int i = 0; i < json.compound_size(); i++) {
- Data arrayData;
- data.array.push_back(arrayData);
- jsonbufToData(data.array.back(), json.compound(i));
- }
- }
- } else if (json.atom().size() > 0) {
- data.atom = json.atom();
- if (json.verbatim()) {
- data.type = Data::VERBATIM;
- } else {
- data.type = Data::INTERPRETED;
- }
- }
-
- return true;
-}
-
-bool UmundoInvoker::protobufToData(Data& data, const google::protobuf::Message& msg) {
- const google::protobuf::Descriptor* desc = msg.GetDescriptor();
- const google::protobuf::Reflection* reflect = msg.GetReflection();
-
- data.compound["protobufType"] = Data(desc->name(), Data::VERBATIM);
-
- for (int i = 0; i < desc->field_count(); i++) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->field(i);
- std::string key = fieldDesc->name();
-
- if (!fieldDesc->is_repeated() && !reflect->HasField(msg, fieldDesc))
- continue;
-
- switch(fieldDesc->type()) {
- case google::protobuf::FieldDescriptor::TYPE_BOOL:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(reflect->GetRepeatedBool(msg, fieldDesc, j) ? "true" : "false"));
- }
- } else {
- data.compound[key].atom = (reflect->GetBool(msg, fieldDesc) ? "true" : "false");
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_BYTES:
- case google::protobuf::FieldDescriptor::TYPE_STRING:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedString(msg, fieldDesc, j)), Data::VERBATIM));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetString(msg, fieldDesc));
- data.compound[key].type = Data::VERBATIM;
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedDouble(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetDouble(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_ENUM:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- const google::protobuf::EnumValueDescriptor* enumDesc = reflect->GetRepeatedEnum(msg, fieldDesc, j);
- data.compound[key].array.push_back(Data(toStr(enumDesc->name()), Data::VERBATIM));
- }
- } else {
- const google::protobuf::EnumValueDescriptor* enumDesc = reflect->GetEnum(msg, fieldDesc);
- data.compound[key] = Data(enumDesc->name(), Data::VERBATIM);
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED32:
- case google::protobuf::FieldDescriptor::TYPE_UINT32:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedUInt32(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetUInt32(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED64:
- case google::protobuf::FieldDescriptor::TYPE_UINT64:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedUInt64(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetUInt64(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FLOAT:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedFloat(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetFloat(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_GROUP:
- LOG(ERROR) << "TYPE_GROUP is unimplemented" << std::endl;
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT32:
- case google::protobuf::FieldDescriptor::TYPE_SINT32:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedInt32(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetInt32(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT64:
- case google::protobuf::FieldDescriptor::TYPE_SINT64:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedInt64(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetInt64(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data());
- protobufToData(data.compound[key].array.back(), reflect->GetRepeatedMessage(msg, fieldDesc, j));
- }
- } else {
- protobufToData(data.compound[key], reflect->GetMessage(msg, fieldDesc));
- }
- break;
- }
- }
- return true;
-}
-
-bool UmundoInvoker::dataToJSONbuf(JSONProto* msg, Data& data) {
- const google::protobuf::Descriptor* desc = msg->GetDescriptor();
- const google::protobuf::Reflection* reflect = msg->GetReflection();
-
- if (!data.compound.empty()) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->FindFieldByName("compound");
-
- std::map<std::string, Data>::iterator compoundIter = data.compound.begin();
- while(compoundIter != data.compound.end()) {
- JSONProto* compoundMsg = (JSONProto*)reflect->AddMessage(msg, fieldDesc);
- dataToJSONbuf(compoundMsg, compoundIter->second);
- compoundMsg->set_key(compoundIter->first);
- compoundIter++;
- }
- } else if (!data.array.empty()) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->FindFieldByName("compound");
-
- std::list<Data>::iterator arrayIter = data.array.begin();
- while(arrayIter != data.array.end()) {
- JSONProto* arrayMsg = (JSONProto*)reflect->AddMessage(msg, fieldDesc);
- dataToJSONbuf(arrayMsg, *arrayIter);
- arrayIter++;
- }
- } else if (!data.atom.empty()) {
- const google::protobuf::FieldDescriptor* atomDesc = desc->FindFieldByName("atom");
- const google::protobuf::FieldDescriptor* verbDesc = desc->FindFieldByName("verbatim");
-
- if (data.type == Data::VERBATIM) {
- reflect->SetBool(msg, verbDesc, true);
- } else {
- reflect->SetBool(msg, verbDesc, false);
- }
- reflect->SetString(msg, atomDesc, data.atom);
- }
- return true;
-}
-
-bool UmundoInvoker::dataToProtobuf(google::protobuf::Message* msg, Data& data) {
- const google::protobuf::Descriptor* desc = msg->GetDescriptor();
- const google::protobuf::Reflection* reflect = msg->GetReflection();
-
- for (int i = 0; i < desc->field_count(); i++) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->field(i);
- std::string key = fieldDesc->name();
-
- if (data.compound.find(key) == data.compound.end()) {
- if (fieldDesc->is_required()) {
- LOG(ERROR) << "required field " << key << " not given";
- return false;
- }
- continue;
- }
-
- std::list<Data>::iterator arrayIter = data.compound[key].array.begin();
-
- switch(fieldDesc->type()) {
- case google::protobuf::FieldDescriptor::TYPE_BOOL:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddBool(msg, fieldDesc, arrayIter->atom.compare("false") == 0 ? false : true);
- arrayIter++;
- }
- } else {
- reflect->SetBool(msg, fieldDesc, (data.compound[key].atom.compare("false") == 0 ? false : true));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_BYTES:
- case google::protobuf::FieldDescriptor::TYPE_STRING:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddString(msg, fieldDesc, arrayIter->atom);
- arrayIter++;
- }
- } else {
- reflect->SetString(msg, fieldDesc, data.compound[key].atom);
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddDouble(msg, fieldDesc, strTo<double>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetDouble(msg, fieldDesc, strTo<double>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_ENUM:
- LOG(ERROR) << "TYPE_ENUM is unimplemented" << std::endl;
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED32:
- case google::protobuf::FieldDescriptor::TYPE_UINT32:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddUInt32(msg, fieldDesc, strTo<uint32_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetUInt32(msg, fieldDesc, strTo<uint32_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED64:
- case google::protobuf::FieldDescriptor::TYPE_UINT64:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddUInt64(msg, fieldDesc, strTo<uint64_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetUInt64(msg, fieldDesc, strTo<uint64_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FLOAT:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddFloat(msg, fieldDesc, strTo<float>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetFloat(msg, fieldDesc, strTo<float>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_GROUP:
- LOG(ERROR) << "TYPE_GROUP is unimplemented" << std::endl;
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT32:
- case google::protobuf::FieldDescriptor::TYPE_SINT32:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddInt32(msg, fieldDesc, strTo<int32_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetInt32(msg, fieldDesc, strTo<int32_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT64:
- case google::protobuf::FieldDescriptor::TYPE_SINT64:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddInt64(msg, fieldDesc, strTo<int64_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetInt64(msg, fieldDesc, strTo<int64_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- dataToProtobuf(reflect->AddMessage(msg, fieldDesc), *arrayIter);
- arrayIter++;
- }
- } else {
- dataToProtobuf(reflect->MutableMessage(msg, fieldDesc), data.compound[key]);
- }
- break;
- }
- }
- return true;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
deleted file mode 100644
index 4c0e988..0000000
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#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 "JSON.pb.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class Interpreter;
-
-class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public umundo::ResultSet<umundo::ServiceDescription>, public umundo::TypedGreeter {
-public:
- UmundoInvoker();
- virtual ~UmundoInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("umundo");
- names.push_back("http://umundo.tk.informatik.tu-darmstadt.de/");
- names.push_back("http://umundo.tk.informatik.tu-darmstadt.de");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
- virtual void receive(void* object, umundo::Message* msg);
-
- virtual void added(umundo::ServiceDescription);
- virtual void removed(umundo::ServiceDescription);
- virtual void changed(umundo::ServiceDescription, uint64_t what);
-
- virtual void welcome(umundo::TypedPublisher atPub, const umundo::SubscriberStub& sub);
- virtual void farewell(umundo::TypedPublisher fromPub, const umundo::SubscriberStub& sub);
-
-protected:
- bool _isService;
-
- bool dataToJSONbuf(JSONProto* msg, Data& data);
- bool dataToProtobuf(google::protobuf::Message* msg, Data& data);
-
- bool jsonbufToData(Data& data, const JSONProto& json);
- bool protobufToData(Data& data, const google::protobuf::Message& msg);
-
- umundo::Node* _node;
- umundo::Discovery* _discovery;
- umundo::TypedPublisher* _pub;
- umundo::TypedSubscriber* _sub;
-
- umundo::ServiceFilter* _svcFilter;
- umundo::ServiceManager* _svcMgr;
- std::map<umundo::ServiceDescription, umundo::ServiceStub*> _svcs;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(UmundoInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: UMUNDOINVOKER_H_77YXQGU7 */
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
deleted file mode 100644
index 4c56a14..0000000
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "VoiceXMLInvoker.h"
-#include <glog/logging.h>
-#include "uscxml/UUID.h"
-
-#include <DOM/io/Stream.hpp>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#define ISSUE_REQUEST(name, block) {\
- Arabica::DOM::Document<std::string> name##XML = name.toXML(true);\
- name##XML.getDocumentElement().setPrefix("mmi");\
- std::stringstream name##XMLSS;\
- name##XMLSS << name##XML;\
- URL name##URL(name.target);\
- std::cout << "SEND: " << name##XMLSS.str() << std::endl; \
- name##URL.setOutContent(name##XMLSS.str());\
- name##URL.addOutHeader("Content-type", "application/xml");\
- name##URL.download(block);\
-}
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new VoiceXMLInvokerProvider() );
- return true;
-}
-#endif
-
-VoiceXMLInvoker::VoiceXMLInvoker() {
- _thread = NULL;
-}
-
-VoiceXMLInvoker::~VoiceXMLInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> VoiceXMLInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<VoiceXMLInvoker> invoker = boost::shared_ptr<VoiceXMLInvoker>(new VoiceXMLInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-bool VoiceXMLInvoker::httpRecvRequest(const HTTPServer::Request& request) {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
-
- if (!request.data.hasKey("content") || !request.data.at("content").node) {
- HTTPServer::Reply reply(request);
- reply.status = 500;
- HTTPServer::reply(reply);
- }
-
- const Arabica::DOM::Node<std::string>& node = request.data.at("content").node;
-// std::cout << "RCVD: " << node << std::endl;
-
- switch(MMIEvent::getType(node)) {
- case MMIEvent::NEWCONTEXTRESPONSE: {
- NewContextResponse resp = NewContextResponse::fromXML(node);
- if (_context.size() == 0) {
- _compState = MMI_IDLE;
- _context = resp.context;
-
- StartRequest startReq;
- startReq.context = _context;
- startReq.source = _url;
- startReq.target = _target;
- startReq.requestId = uscxml::UUID::getUUID();
-
- if (_invokeReq.src.size() > 0) {
- startReq.contentURL.href = _invokeReq.src;
- } else if(_invokeReq.content.size()) {
- startReq.content = _invokeReq.content;
- } else if(_invokeReq.dom) {
- std::stringstream contentSS;
- startReq.contentDOM = _invokeReq.dom;
- }
- ISSUE_REQUEST(startReq, false);
-
- } else {
- // already got a context!
- }
- break;
- }
- case MMIEvent::STARTRESPONSE: {
- StartResponse resp = StartResponse::fromXML(node);
- _compState = MMI_RUNNING;
- break;
- }
-
- case MMIEvent::DONENOTIFICATION: {
- DoneNotification resp = DoneNotification::fromXML(node);
- _compState = MMI_IDLE;
- break;
- }
-
- case MMIEvent::STATUSRESPONSE: {
- StatusResponse resp = StatusResponse::fromXML(node);
- switch (resp.status) {
- case StatusResponse::DEAD:
- _compState = MMI_DEAD;
- case StatusResponse::FAILURE: {
- Event ev = resp;
- returnEvent(ev);
- break;
- }
- default:
- break;
- }
- break;
- }
-
- case MMIEvent::EXTENSIONNOTIFICATION: {
- Event resp = ExtensionNotification::fromXML(node);
- returnEvent(resp);
- }
-
- default:
- break;
- }
-
-
- HTTPServer::Reply reply(request);
- HTTPServer::reply(reply);
- return true;
-}
-
-void VoiceXMLInvoker::setURL(const std::string& url) {
- _url = url;
-// boost::replace_first(_url, "epikur-2.local", "178.4.230.252");
-}
-
-Data VoiceXMLInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void VoiceXMLInvoker::send(const SendRequest& req) {
- _workQueue.push(req);
-}
-
-void VoiceXMLInvoker::invoke(const InvokeRequest& req) {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
-
- HTTPServer::getInstance()->registerServlet(req.invokeid, this);
-
- Event::getParam(req.params, "target", _target);
- if (_target.size() == 0) {
- LOG(ERROR) << "No target parameter given!";
- return;
- }
-
- _invokeReq = req;
-
- NewContextRequest newCtxReq;
- newCtxReq.source = _url;
- newCtxReq.target = _target;
- newCtxReq.requestId = uscxml::UUID::getUUID();
- ISSUE_REQUEST(newCtxReq, false);
-
- _isRunning = true;
- _thread = new tthread::thread(VoiceXMLInvoker::run, this);
-
-}
-
-void VoiceXMLInvoker::uninvoke() {
-
- ClearContextRequest clrCtxReq;
- clrCtxReq.source = _url;
- clrCtxReq.target = _target;
- clrCtxReq.requestId = uscxml::UUID::getUUID();
- ISSUE_REQUEST(clrCtxReq, false);
-
- if (_isRunning)
- _isRunning = false;
-
- // unblock queue
- SendRequest req;
- _workQueue.push(req);
-
- if (_thread) {
- _thread->join();
- delete _thread;
- }
-
- HTTPServer::getInstance()->unregisterServlet(this);
- _context = "";
-
-}
-
-void VoiceXMLInvoker::run(void* instance) {
- VoiceXMLInvoker* INSTANCE = (VoiceXMLInvoker*)instance;
- while(true) {
- SendRequest req = INSTANCE->_workQueue.pop();
- if (INSTANCE->_isRunning) {
- INSTANCE->process(req);
- } else {
- return;
- }
- }
-}
-
-void VoiceXMLInvoker::process(SendRequest& req) {
- tthread::lock_guard<tthread::mutex> lock(_mutex);
- while(_context.size() == 0 && _isRunning)
- _cond.wait_for(_mutex, 200);
-
- if (_context.size() == 0) {
- // we never acquired a context
- return;
- }
-
- if (_compState != MMI_RUNNING)
- // remote component is not running
- return;
-
- // dispatch over send request
- // Is there something special to do here?
-
- // if we did nothing else, send as ExtensionNotification
- ExtensionNotification extNotif;
- extNotif.context = _context;
- extNotif.source = _url;
- extNotif.target = _target;
- extNotif.requestId = uscxml::UUID::getUUID();
- extNotif.name = req.name;
-
- if (!req.namelist.empty()) {
- for (Event::namelist_t::iterator iter = req.namelist.begin(); iter != req.namelist.end(); iter++) {
- req.data.compound[iter->first] = iter->second;
- }
- } else if (!req.params.empty()) {
- for(Event::params_t::iterator it = req.params.begin(), end = req.params.end(); it != end; it = req.params.upper_bound(it->first)) {
- Event::getParam(req.params, it->first, req.data.compound[it->first]);
- }
- }
-
- if (req.dom) {
- extNotif.dataDOM = req.dom;
- } else if (req.content.size() > 0) {
- extNotif.data = req.content;
- } else if (!req.data.empty()) {
- extNotif.data = Data::toJSON(req.data);
- }
-
- ISSUE_REQUEST(extNotif, false);
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
deleted file mode 100644
index d6078cd..0000000
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef VOICEXMLINVOKER_H_W09J90F0
-#define VOICEXMLINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-#include <uscxml/messages/MMIMessages.h>
-#include "uscxml/server/HTTPServer.h"
-
-// #include <uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class VoiceXMLInvoker : public InvokerImpl, public HTTPServlet {
-public:
- enum ComponentState {
- MMI_IDLE,
- MMI_PAUSED,
- MMI_RUNNING,
- MMI_DEAD
- };
-
- VoiceXMLInvoker();
- virtual ~VoiceXMLInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("vxml");
- names.push_back("voicexml");
- names.push_back("http://www.w3.org/TR/voicexml21/");
- return names;
- }
-
- bool deleteOnUninvoke() {
- return false;
- }
-
- bool httpRecvRequest(const HTTPServer::Request& request);
- void setURL(const std::string& url);
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void invoke(const InvokeRequest& req);
- virtual void uninvoke();
-
- static void run(void*);
- void process(SendRequest& ctx);
-
-protected:
- std::string _url;
- std::string _context;
- std::string _target;
-
- InvokeRequest _invokeReq;
-
- ComponentState _compState;
-
- tthread::thread* _thread;
- tthread::condition_variable _cond;
- tthread::mutex _mutex;
- concurrency::BlockingQueue<SendRequest> _workQueue;
- bool _isRunning;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(VoiceXMLInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: VOICEXMLINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp b/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp
deleted file mode 100644
index 2d871c8..0000000
--- a/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * @file
- * @author 2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "WebRTCInvoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-//#include "talk/app/webrtc/peerconnection.h"
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new WebRTCInvokerProvider() );
- return true;
-}
-#endif
-
-WebRTCInvoker::WebRTCInvoker() {
-}
-
-WebRTCInvoker::~WebRTCInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> WebRTCInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<WebRTCInvoker> invoker = boost::shared_ptr<WebRTCInvoker>(new WebRTCInvoker());
- return invoker;
-}
-
-Data WebRTCInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void WebRTCInvoker::send(const SendRequest& req) {
-}
-
-void WebRTCInvoker::cancel(const std::string sendId) {
-}
-
-void WebRTCInvoker::invoke(const InvokeRequest& req) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h b/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h
deleted file mode 100644
index e4d7775..0000000
--- a/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author 2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef WEBRTCINVOKER_H_1E704623
-#define WEBRTCINVOKER_H_1E704623
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class WebRTCInvoker : public InvokerImpl {
-public:
- WebRTCInvoker();
- virtual ~WebRTCInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("webrtc");
- names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#webrtc");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(WebRTCInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: WEBRTCINVOKER_H_1E704623 */
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
deleted file mode 100644
index 9c85f37..0000000
--- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include <uscxml/config.h>
-#include "XHTMLInvoker.h"
-#include <glog/logging.h>
-#include "uscxml/dom/DOMUtils.h"
-#include <uscxml/plugins/ioprocessor/comet/CometIOProcessor.h>
-#include <DOM/io/Stream.hpp>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-#if __APPLE__
-# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
-# else
-# include <CoreFoundation/CFBundle.h>
-# include <ApplicationServices/ApplicationServices.h>
-# endif
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new XHTMLInvokerProvider() );
- return true;
-}
-#endif
-
-XHTMLInvoker::XHTMLInvoker() {
-}
-
-XHTMLInvoker::~XHTMLInvoker() {
- HTTPServer::unregisterServlet(this);
-};
-
-boost::shared_ptr<InvokerImpl> XHTMLInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<XHTMLInvoker> invoker = boost::shared_ptr<XHTMLInvoker>(new XHTMLInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- // these are the XHR requests
- if (iequals(req.data.at("header").at("X-Requested-With").atom, "XMLHttpRequest")) {
- if (iequals(req.data.at("type").atom, "get")) {
- // this is the incoming the long-polling GET
- if (_longPoll) {
- // cancel old longPoller
- evhttp_send_error(_longPoll.evhttpReq, 204, NULL);
- _longPoll.evhttpReq = NULL;
- }
-
- _longPoll = req;
- if (!_outQueue.empty()) {
- // do we have some send requests pending?
- HTTPServer::Reply reply =_outQueue.front();
- reply.setRequest(_longPoll);
- HTTPServer::reply(reply);
- _outQueue.pop_front();
- _longPoll.evhttpReq = NULL;
- }
- return true;
-
- } else {
- // an incomping event per POST request
- Event ev(req);
- if (ev.data["header"].hasKey("X-SCXML-Name")) {
- ev.name = ev.data["header"]["X-SCXML-Name"].atom;
- } else {
- ev.name = req.data.at("type").atom;
- }
-
- // initialize data
- ev.data = req.data.at("content");
- ev.eventType = Event::EXTERNAL;
-
- HTTPServer::Reply reply(req);
- HTTPServer::reply(reply);
-
- returnEvent(ev);
- return true;
- }
- }
-
- // initial request for a document
- if (!req.data.hasKey("query") && // no query parameters
- iequals(req.data.at("type").atom, "get") && // request type is GET
- req.content.length() == 0) { // no content
-
- // send template to establish long polling
- HTTPServer::Reply reply(req);
-
- // _invokeReq.content will contain the actual content as we needed to replace expressions in the interpreter thread
-
- if (!_invokeReq.data.empty()) {
- // just reply with given data as json, this time and for ever
- reply.content = _invokeReq.content;
- reply.headers["Content-type"] = "application/json";
- HTTPServer::reply(reply);
- return true;
-
- } else if (_invokeReq.dom) {
- // there is some XML given with the content
- if (HAS_ATTR_CAST(_invokeReq.dom, "type")) {
- // it's special XML to send per Comet later on, default to sending template and enqueue
- _longPoll.evhttpReq = NULL;
- _outQueue = std::deque<HTTPServer::Reply>();
-
- HTTPServer::Reply reply;
- reply.content = _invokeReq.content;
- reply.headers["Content-type"] = "application/xml";
- _outQueue.push_back(reply);
-
- // no return here - we wan to send the template below
-
- } else {
- // it's plain XML now and forever
- reply.content = _invokeReq.content;
- reply.headers["Content-type"] = "application/xml";
- HTTPServer::reply(reply);
- return true;
- }
- } else if (_invokeReq.content.size() > 0) {
-
- // just reply as text this time and for ever
- reply.content = _invokeReq.content;
- reply.headers["Content-type"] = "text/plain";
- HTTPServer::reply(reply);
- return true;
- }
-
- /*
- * Return our template to establish a two way communication via comet
- * If we want to replace expressions in the temaplte, we have to do it in invoke()
- * for thread safety of the datamodel.
- */
-
- // this file is generated from template/xhtml-invoker.xhtml via xxd
-#include "template/xhtml-invoker.inc.h"
-
- // aggressive caching in IE will return all XHR get requests instantenously otherwise
- reply.headers["Cache-Control"] = "no-cache";
- reply.headers["Content-Type"] = "text/html; charset=utf-8";
-
- reply.content = std::string((const char*)template_xhtml_invoker_html, template_xhtml_invoker_html_len);
- HTTPServer::reply(reply);
- return true;
- }
-
- // don't know what to do with other requests
- return false;
-}
-
-Data XHTMLInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void XHTMLInvoker::send(const SendRequest& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- HTTPServer::Reply reply;
-
- if (req.dom) {
- // XML
- std::stringstream ss;
- if (req.dom.getNodeType() == Arabica::DOM::Node_base::ELEMENT_NODE) {
- Arabica::DOM::Element<std::string> contentElem = Arabica::DOM::Element<std::string>(req.dom);
-
- if (HAS_ATTR(contentElem, "type"))
- reply.headers["X-SCXML-Type"] = ATTR(contentElem, "type");
- if (HAS_ATTR(contentElem, "xpath"))
- reply.headers["X-SCXML-XPath"] = ATTR(contentElem, "xpath");
- if (HAS_ATTR(contentElem, "attr"))
- reply.headers["X-SCXML-Attr"] = ATTR(contentElem, "attr");
- }
-
- ss << req.dom;
- reply.content = ss.str();
- reply.headers["Content-Type"] = "application/xml";
-
- } else if (!req.data.empty()) {
- // JSON
- reply.content = Data::toJSON(req.data);
- reply.headers["Content-Type"] = "application/json";
- } else if (req.content.length() > 0) {
- reply.content = req.content;
- reply.headers["Content-Type"] = "text/plain";
- }
-
- // TODO: Params to set variables?
-
- _interpreter->getDataModel().replaceExpressions(reply.content);
-
- if (!_longPoll) {
- _outQueue.push_back(reply);
- return;
- }
- reply.setRequest(_longPoll);
- HTTPServer::reply(reply);
- _longPoll.evhttpReq = NULL;
-}
-
-void XHTMLInvoker::cancel(const std::string sendId) {
- HTTPServer::unregisterServlet(this);
-}
-
-void XHTMLInvoker::invoke(const InvokeRequest& req) {
- _invokeReq = req;
-
- // make sure _invokeReq.content contains correct and substituted string
- if (!_invokeReq.data.empty()) {
- _invokeReq.content = Data::toJSON(_invokeReq.data);
- } else if (_invokeReq.dom) {
- std::stringstream ss;
- ss << _invokeReq.dom;
- _invokeReq.content = ss.str();
- }
- _interpreter->getDataModel().replaceExpressions(_invokeReq.content);
-
- std::string browserURL;
- if (req.src.size() > 0) {
- // no src given, send browser off to some remote url
- browserURL = req.src;
- } else {
- // invoke to talk to us
- HTTPServer::registerServlet(_interpreter->getName() + "/" + req.invokeid + ".html", this);
- if (_url.size() == 0) {
- returnErrorExecution("No HTTP server running");
- }
- browserURL = _url.c_str();
- }
-#if __APPLE__
-# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
-# else
- // see http://stackoverflow.com/questions/4177744/c-osx-open-default-browser
- CFURLRef url = CFURLCreateWithBytes (
- NULL, // allocator
- (UInt8*)browserURL.c_str(), // URLBytes
- browserURL.length(), // length
- kCFStringEncodingASCII, // encoding
- NULL // baseURL
- );
- if (LSOpenCFURLRef(url,0) == errSecSuccess) {
- if (url)
- CFRelease(url);
- return;
- }
-# endif
-#endif
-#ifdef _WIN32
-// see http://support.microsoft.com/kb/224816
- ShellExecute(NULL, "open", browserURL.c_str(), NULL, NULL, SW_SHOWNORMAL);
- return;
-#endif
-#ifdef HAS_XDG_OPEN
- std::string systemCmd;
- systemCmd = "xdg-open ";
- systemCmd += browserURL;
- if (system(systemCmd.c_str()) >= 0)
- return;
-#endif
- LOG(ERROR) << "Could not open a HTML browser, access '" << browserURL << "' yourself.";
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
deleted file mode 100644
index 386af3d..0000000
--- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef XHTMLINVOKER_H_W09J90F0
-#define XHTMLINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-#include "uscxml/server/HTTPServer.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class XHTMLInvoker : public InvokerImpl, public HTTPServlet {
-public:
- XHTMLInvoker();
- virtual ~XHTMLInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("xhtml");
- names.push_back("http://www.w3.org/1999/xhtml");
- 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 bool httpRecvRequest(const HTTPServer::Request& request);
- virtual void setURL(const std::string& url) {
- _url = url;
- }
-
- void reply(const SendRequest& req, const HTTPServer::Request& longPoll);
-
-protected:
- HTTPServer::Request _longPoll;
- std::deque<HTTPServer::Reply> _outQueue;
-
- tthread::recursive_mutex _mutex;
- InvokeRequest _invokeReq;
-
- std::string _url;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(XHTMLInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: XHTMLINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html b/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html
deleted file mode 100644
index 6d31b11..0000000
--- a/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-
- <!-- Get domLoaded event across browsers -->
- <script type="text/javascript">
- // see http://stackoverflow.com/questions/1206937/javascript-domready
- var domLoaded = function(callback) {
- /* Internet Explorer */
- /*@cc_on
- @if (@_win32 || @_win64)
- document.write('<script id="ieScriptLoad" defer src="//:"><\/script>');
- document.getElementById('ieScriptLoad').onreadystatechange = function() {
- if (this.readyState == 'complete') {
- var head= document.getElementsByTagName('head')[0];
- var script= document.createElement('script');
- script.type= 'text/javascript';
- script.src= 'http://wicked-good-xpath.googlecode.com/files/wgxpath.install.js';
- head.appendChild(script);
- wgxpath.install();
-
- // see http://stackoverflow.com/questions/1811116/ie-support-for-dom-importnode
- document.importNode = function(node, allChildren) {
- switch (node.nodeType) {
- case document.ELEMENT_NODE:
- var newNode = document.createElementNS(node.namespaceURI, node.nodeName);
- if(node.attributes && node.attributes.length > 0)
- for(var i = 0, il = node.attributes.length; i < il; i++)
- newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i].nodeName));
- if(allChildren && node.childNodes && node.childNodes.length > 0)
- for(var i = 0, il = node.childNodes.length; i < il; i++)
- newNode.appendChild(document.importNode(node.childNodes[i], allChildren));
- return newNode;
- break;
- case document.TEXT_NODE:
- case document.CDATA_SECTION_NODE:
- case document.COMMENT_NODE:
- return document.createTextNode(node.nodeValue);
- break;
- }
- }
-
- callback();
- }
- };
- @end @*/
- /* Mozilla, Chrome, Opera */
- if (document.addEventListener) {
- document.addEventListener('DOMContentLoaded', callback, false);
- return;
- }
- /* Safari, iCab, Konqueror */
- if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) {
- var DOMLoadTimer = setInterval(function () {
- if (/loaded|complete/i.test(document.readyState)) {
- callback();
- clearInterval(DOMLoadTimer);
- }
- }, 10);
- return;
- }
- /* Other web browsers */
- window.onload = callback;
- };
- </script>
-
- <script type="text/javascript">
-
- function CometSession(options) {
- /**
- * Support for two-channel asynchronous http communication
- */
- for (var key in options) {
- if (options.hasOwnProperty(key)) {
- this[key] = options[key];
- }
- }
- var self = this;
-
- this.xhr = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0"));
- this.cometPoll = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0"));
-
- this.createUUID = function() {
- // http://www.ietf.org/rfc/rfc4122.txt
- var s = [];
- var hexDigits = "0123456789abcdef";
- for (var i = 0; i < 36; i++) {
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
- }
- s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
- s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
- s[8] = s[13] = s[18] = s[23] = "-";
- var uuid = s.join("");
- return uuid;
- }
-
- this.longpoll = function() {
- self.cometPoll.onreadystatechange = function() {
- if (self.cometPoll.readyState === 4) {
- if (self.cometPoll.status !== 200) {
- self.longpoll();
- return;
- }
- self.onRcvd(self.cometPoll);
- self.longpoll();
- }
- };
- // use token until we have a context
- self.cometPoll.open("GET", self.server + (self.query ? "?" + self.query : ""));
- self.cometPoll.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- // self.cometPoll.setRequestHeader("Connection", "close");
- self.cometPoll.send(null);
- };
-
- this.disconnect = function() {
- self.xhr.open("POST", self.server + (self.query ? "?" + self.query : ""), false);
- self.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- self.xhr.setRequestHeader('X-SCXML-Name', "done.invoke");
- self.xhr.send(NULL);
- };
-
- this.post = function(name, data, contentType) {
- self.xhr.open("POST", self.server + (self.query ? "?" + self.query : ""));
- self.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- self.xhr.setRequestHeader('X-SCXML-Name', name);
- if (contentType) {
- self.xhr.setRequestHeader('Content-Type', contentType);
- }
- self.xhr.send(data);
- }
-
- // serialize an object to be send
- this.send = function(name, thing) {
- var data;
- // see also: https://raw.github.com/douglascrockford/JSON-js/master/cycle.js
- // dispatch over thingy type here
- if (typeof thing === "object") {
- var seen = [];
- // will not work on opera as thing is checked for cycles first
- data = JSON.stringify(thing, function(key, val) {
- if (isNode(val)) {
- // return a selection of attributes
- return {
- id: val.id,
- tagName: val.tagName,
- localName: val.localName
- };
- }
- if (isWindow(val)) {
- return;
- }
- if (typeof val === "object") {
- if (seen.indexOf(val) >= 0)
- return;
- seen.push(val)
- }
- return val
- });
- } else {
- data = thing;
- }
- this.post(name, data, "application/json");
- }
-
- // helper function to determine whether something is a html node
- var isNode = function(o){
- return (
- typeof Node === "object" ? o instanceof Node :
- o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
- );
- }
-
- // helper function to determine whether something is a window
- var isWindow = function(o){
- return (
- typeof Window === "object" ? o instanceof Window :
- o && typeof o === "object" && typeof o.menubar === "object"
- );
- }
-
- }
-
- </script>
-
- <script type="text/javascript">
- domLoaded(function () {
- scxml = new CometSession({
- //element: document.getElementById("${scxml.invokeId}"),
- server: document.URL,
- onRcvd : function(data) {
- if (data.responseXML) {
- var type = data.getResponseHeader("X-SCXML-Type") || "replacechildren";
- var domTarget = data.getResponseHeader("X-SCXML-XPath") || "/html/body";
- var domAttr = data.getResponseHeader("X-SCXML-Attr");
- var result = document.evaluate(domTarget, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
-
- for (var i = 0, l = result.snapshotLength; i < l; i++) {
- var item = result.snapshotItem(i);
- var node = document.importNode(data.responseXML.firstChild, true);
- switch (type) {
- case "firstchild":
- item.insertBefore(node, item.firstChild);
- break;
- case "lastchild":
- item.appendChild(node);
- break;
- case "previoussibling":
- item.parentNode.insertBefore(node, item);
- break;
- case "nextsibling":
- item.parentNode.insertBefore(node, item.nextSibling);
- break;
- case "replace":
- item.parentNode.replaceChild(node, item);
- break;
- case "delete":
- item.parentNode.removeChild(item);
- break;
- case "addattribute":
- item.setAttribute(domAttr, node);
- break;
- case "replacechildren":
- while(item.hasChildNodes()) {
- item.removeChild(item.firstChild);
- }
- item.appendChild(node);
- default:
- break;
- }
- }
- }
- }
- });
- scxml.longpoll();
- _parent = scxml;
-
- window.onbeforeunload = function (e) {
- scxml.disconnect();
- // return 'You have unsaved changes!';
- };
- });
- </script>
-
- </head>
- <body></body>
-</html>
diff --git a/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.inc.h b/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.inc.h
deleted file mode 100644
index 971260b..0000000
--- a/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.inc.h
+++ /dev/null
@@ -1,691 +0,0 @@
-unsigned char template_xhtml_invoker_html[] = {
- 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3d,
- 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e,
- 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x31, 0x39, 0x39, 0x39, 0x2f,
- 0x78, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x0a, 0x09, 0x3c, 0x68, 0x65,
- 0x61, 0x64, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x6d, 0x65, 0x74, 0x61, 0x20,
- 0x68, 0x74, 0x74, 0x70, 0x2d, 0x65, 0x71, 0x75, 0x69, 0x76, 0x3d, 0x22,
- 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65,
- 0x22, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3d, 0x22, 0x74,
- 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3b, 0x63, 0x68, 0x61,
- 0x72, 0x73, 0x65, 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x22, 0x20,
- 0x2f, 0x3e, 0x0a, 0x0a, 0x09, 0x09, 0x3c, 0x21, 0x2d, 0x2d, 0x20, 0x47,
- 0x65, 0x74, 0x20, 0x64, 0x6f, 0x6d, 0x4c, 0x6f, 0x61, 0x64, 0x65, 0x64,
- 0x20, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x63, 0x72, 0x6f, 0x73,
- 0x73, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x73, 0x20, 0x2d,
- 0x2d, 0x3e, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f,
- 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x3e,
- 0x0a, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x65, 0x20, 0x68,
- 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x6f,
- 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x31, 0x32,
- 0x30, 0x36, 0x39, 0x33, 0x37, 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63,
- 0x72, 0x69, 0x70, 0x74, 0x2d, 0x64, 0x6f, 0x6d, 0x72, 0x65, 0x61, 0x64,
- 0x79, 0x0a, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x64, 0x6f, 0x6d,
- 0x4c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61,
- 0x63, 0x6b, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2a,
- 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x45, 0x78,
- 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, 0x2a, 0x2f, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x2f, 0x2a, 0x40, 0x63, 0x63, 0x5f, 0x6f, 0x6e, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x40, 0x69, 0x66, 0x20, 0x28, 0x40, 0x5f, 0x77, 0x69,
- 0x6e, 0x33, 0x32, 0x20, 0x7c, 0x7c, 0x20, 0x40, 0x5f, 0x77, 0x69, 0x6e,
- 0x36, 0x34, 0x29, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x77,
- 0x72, 0x69, 0x74, 0x65, 0x28, 0x27, 0x3c, 0x73, 0x63, 0x72, 0x69, 0x70,
- 0x74, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x69, 0x65, 0x53, 0x63, 0x72, 0x69,
- 0x70, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x22, 0x20, 0x64, 0x65, 0x66, 0x65,
- 0x72, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x2f, 0x3a, 0x22, 0x3e,
- 0x3c, 0x5c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3e, 0x27, 0x29,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d,
- 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65,
- 0x6e, 0x74, 0x42, 0x79, 0x49, 0x64, 0x28, 0x27, 0x69, 0x65, 0x53, 0x63,
- 0x72, 0x69, 0x70, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x27, 0x29, 0x2e, 0x6f,
- 0x6e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x73, 0x74, 0x61, 0x74, 0x65, 0x63,
- 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2e,
- 0x72, 0x65, 0x61, 0x64, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3d,
- 0x3d, 0x20, 0x27, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x27,
- 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76,
- 0x61, 0x72, 0x20, 0x68, 0x65, 0x61, 0x64, 0x3d, 0x20, 0x64, 0x6f, 0x63,
- 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x6c, 0x65,
- 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x79, 0x54, 0x61, 0x67, 0x4e, 0x61,
- 0x6d, 0x65, 0x28, 0x27, 0x68, 0x65, 0x61, 0x64, 0x27, 0x29, 0x5b, 0x30,
- 0x5d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61,
- 0x72, 0x20, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3d, 0x20, 0x64, 0x6f,
- 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74,
- 0x65, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x28, 0x27, 0x73, 0x63,
- 0x72, 0x69, 0x70, 0x74, 0x27, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2e, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x20, 0x27, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x6a, 0x61,
- 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x27, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
- 0x2e, 0x73, 0x72, 0x63, 0x3d, 0x20, 0x27, 0x68, 0x74, 0x74, 0x70, 0x3a,
- 0x2f, 0x2f, 0x77, 0x69, 0x63, 0x6b, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x6f,
- 0x64, 0x2d, 0x78, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
- 0x6c, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66,
- 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x77, 0x67, 0x78, 0x70, 0x61, 0x74, 0x68,
- 0x2e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x2e, 0x6a, 0x73, 0x27,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x68, 0x65, 0x61,
- 0x64, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x69, 0x6c,
- 0x64, 0x28, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x77, 0x67, 0x78, 0x70, 0x61, 0x74,
- 0x68, 0x2e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x28, 0x29, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x65, 0x20, 0x68,
- 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x6f,
- 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x31, 0x38,
- 0x31, 0x31, 0x31, 0x31, 0x36, 0x2f, 0x69, 0x65, 0x2d, 0x73, 0x75, 0x70,
- 0x70, 0x6f, 0x72, 0x74, 0x2d, 0x66, 0x6f, 0x72, 0x2d, 0x64, 0x6f, 0x6d,
- 0x2d, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x6e, 0x6f, 0x64, 0x65, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d,
- 0x65, 0x6e, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4e, 0x6f,
- 0x64, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
- 0x6e, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x61, 0x6c, 0x6c, 0x43,
- 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x29, 0x20, 0x7b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x73, 0x77, 0x69, 0x74,
- 0x63, 0x68, 0x20, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64,
- 0x65, 0x54, 0x79, 0x70, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65,
- 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x4c,
- 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x3a, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x76, 0x61, 0x72, 0x20, 0x6e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65,
- 0x20, 0x3d, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
- 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e,
- 0x74, 0x4e, 0x53, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x61, 0x6d,
- 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x55, 0x52, 0x49, 0x2c, 0x20, 0x6e,
- 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65,
- 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
- 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x20, 0x26,
- 0x26, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69,
- 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68,
- 0x20, 0x3e, 0x20, 0x30, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72,
- 0x28, 0x76, 0x61, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30, 0x2c, 0x20,
- 0x69, 0x6c, 0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x61, 0x74,
- 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6c, 0x65, 0x6e,
- 0x67, 0x74, 0x68, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x69, 0x6c, 0x3b,
- 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6e,
- 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x73, 0x65, 0x74, 0x41, 0x74,
- 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x6e, 0x6f, 0x64, 0x65,
- 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5b,
- 0x69, 0x5d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x2c,
- 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x65, 0x74, 0x41, 0x74, 0x74,
- 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
- 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5b, 0x69,
- 0x5d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x29, 0x29,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x61, 0x6c, 0x6c, 0x43, 0x68, 0x69,
- 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x20, 0x26, 0x26, 0x20, 0x6e, 0x6f, 0x64,
- 0x65, 0x2e, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73,
- 0x20, 0x26, 0x26, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x69,
- 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x67,
- 0x74, 0x68, 0x20, 0x3e, 0x20, 0x30, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66,
- 0x6f, 0x72, 0x28, 0x76, 0x61, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30,
- 0x2c, 0x20, 0x69, 0x6c, 0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x2e,
- 0x63, 0x68, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x2e, 0x6c,
- 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x69,
- 0x6c, 0x3b, 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x6e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x61, 0x70, 0x70,
- 0x65, 0x6e, 0x64, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x28, 0x64, 0x6f, 0x63,
- 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74,
- 0x4e, 0x6f, 0x64, 0x65, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68,
- 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x5b, 0x69, 0x5d, 0x2c,
- 0x20, 0x61, 0x6c, 0x6c, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e,
- 0x29, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
- 0x6e, 0x65, 0x77, 0x4e, 0x6f, 0x64, 0x65, 0x3b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72,
- 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x64, 0x6f, 0x63,
- 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x45, 0x58, 0x54, 0x5f, 0x4e,
- 0x4f, 0x44, 0x45, 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x64, 0x6f, 0x63,
- 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5f,
- 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x44, 0x45,
- 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20,
- 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65,
- 0x6e, 0x74, 0x2e, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x4e,
- 0x4f, 0x44, 0x45, 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
- 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x78, 0x74, 0x4e, 0x6f, 0x64, 0x65,
- 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x56, 0x61,
- 0x6c, 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x7d,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x40, 0x65, 0x6e,
- 0x64, 0x20, 0x40, 0x2a, 0x2f, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2a,
- 0x20, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0x2c, 0x20, 0x43, 0x68,
- 0x72, 0x6f, 0x6d, 0x65, 0x2c, 0x20, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x20,
- 0x2a, 0x2f, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x64,
- 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x64, 0x64, 0x45,
- 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72,
- 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x64, 0x6f, 0x63,
- 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x64, 0x64, 0x45, 0x76, 0x65,
- 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x28, 0x27,
- 0x44, 0x4f, 0x4d, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x6f,
- 0x61, 0x64, 0x65, 0x64, 0x27, 0x2c, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x62,
- 0x61, 0x63, 0x6b, 0x2c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x29, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x2f, 0x2a, 0x20, 0x53, 0x61, 0x66, 0x61, 0x72, 0x69, 0x2c, 0x20, 0x69,
- 0x43, 0x61, 0x62, 0x2c, 0x20, 0x4b, 0x6f, 0x6e, 0x71, 0x75, 0x65, 0x72,
- 0x6f, 0x72, 0x20, 0x2a, 0x2f, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66,
- 0x20, 0x28, 0x2f, 0x4b, 0x48, 0x54, 0x4d, 0x4c, 0x7c, 0x57, 0x65, 0x62,
- 0x4b, 0x69, 0x74, 0x7c, 0x69, 0x43, 0x61, 0x62, 0x2f, 0x69, 0x2e, 0x74,
- 0x65, 0x73, 0x74, 0x28, 0x6e, 0x61, 0x76, 0x69, 0x67, 0x61, 0x74, 0x6f,
- 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x29,
- 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72,
- 0x20, 0x44, 0x4f, 0x4d, 0x4c, 0x6f, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65,
- 0x72, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72,
- 0x76, 0x61, 0x6c, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x20, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x69, 0x66, 0x20, 0x28, 0x2f, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x7c,
- 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x2f, 0x69, 0x2e, 0x74,
- 0x65, 0x73, 0x74, 0x28, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74,
- 0x2e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x29,
- 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x63,
- 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x49,
- 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x28, 0x44, 0x4f, 0x4d, 0x4c,
- 0x6f, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x2c, 0x20, 0x31, 0x30, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x3b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2a, 0x20, 0x4f, 0x74,
- 0x68, 0x65, 0x72, 0x20, 0x77, 0x65, 0x62, 0x20, 0x62, 0x72, 0x6f, 0x77,
- 0x73, 0x65, 0x72, 0x73, 0x20, 0x2a, 0x2f, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x6f, 0x6e, 0x6c, 0x6f, 0x61,
- 0x64, 0x20, 0x3d, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x3c,
- 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3e, 0x0a, 0x0a, 0x09, 0x09,
- 0x3c, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73,
- 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x0a,
- 0x09, 0x09, 0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20,
- 0x43, 0x6f, 0x6d, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x28, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x29, 0x20, 0x7b, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2a, 0x2a, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x20, 0x2a, 0x20, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x66,
- 0x6f, 0x72, 0x20, 0x74, 0x77, 0x6f, 0x2d, 0x63, 0x68, 0x61, 0x6e, 0x6e,
- 0x65, 0x6c, 0x20, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e,
- 0x6f, 0x75, 0x73, 0x20, 0x68, 0x74, 0x74, 0x70, 0x20, 0x63, 0x6f, 0x6d,
- 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x20, 0x2a, 0x2f, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x66,
- 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x6b, 0x65, 0x79, 0x20,
- 0x69, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x29, 0x20,
- 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28,
- 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x68, 0x61, 0x73, 0x4f,
- 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x28, 0x6b,
- 0x65, 0x79, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20,
- 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x5b, 0x6b, 0x65, 0x79, 0x5d,
- 0x20, 0x3d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5b, 0x6b,
- 0x65, 0x79, 0x5d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x7d,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x76,
- 0x61, 0x72, 0x20, 0x73, 0x65, 0x6c, 0x66, 0x20, 0x3d, 0x20, 0x74, 0x68,
- 0x69, 0x73, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x78, 0x68, 0x72, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x3d, 0x20, 0x28, 0x77, 0x69, 0x6e, 0x64, 0x6f,
- 0x77, 0x2e, 0x58, 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x20, 0x3f, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x58,
- 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x28, 0x29, 0x20, 0x3a, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x41, 0x63,
- 0x74, 0x69, 0x76, 0x65, 0x58, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x28,
- 0x22, 0x4d, 0x53, 0x58, 0x4d, 0x4c, 0x32, 0x2e, 0x58, 0x4d, 0x4c, 0x48,
- 0x54, 0x54, 0x50, 0x2e, 0x33, 0x2e, 0x30, 0x22, 0x29, 0x29, 0x3b, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d,
- 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x20, 0x3d, 0x20, 0x28, 0x77, 0x69,
- 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x58, 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x3f, 0x20, 0x6e, 0x65,
- 0x77, 0x20, 0x58, 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x28, 0x29, 0x20, 0x3a, 0x20, 0x6e, 0x65, 0x77,
- 0x20, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x58, 0x4f, 0x62, 0x6a, 0x65,
- 0x63, 0x74, 0x28, 0x22, 0x4d, 0x53, 0x58, 0x4d, 0x4c, 0x32, 0x2e, 0x58,
- 0x4d, 0x4c, 0x48, 0x54, 0x54, 0x50, 0x2e, 0x33, 0x2e, 0x30, 0x22, 0x29,
- 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x74, 0x68, 0x69, 0x73, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55,
- 0x55, 0x49, 0x44, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
- 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77,
- 0x77, 0x2e, 0x69, 0x65, 0x74, 0x66, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x72,
- 0x66, 0x63, 0x2f, 0x72, 0x66, 0x63, 0x34, 0x31, 0x32, 0x32, 0x2e, 0x74,
- 0x78, 0x74, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20,
- 0x73, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x76, 0x61, 0x72, 0x20, 0x68, 0x65, 0x78, 0x44, 0x69, 0x67, 0x69,
- 0x74, 0x73, 0x20, 0x3d, 0x20, 0x22, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
- 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x22, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x76,
- 0x61, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x20, 0x69, 0x20,
- 0x3c, 0x20, 0x33, 0x36, 0x3b, 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, 0x7b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x5b, 0x69, 0x5d, 0x20,
- 0x3d, 0x20, 0x68, 0x65, 0x78, 0x44, 0x69, 0x67, 0x69, 0x74, 0x73, 0x2e,
- 0x73, 0x75, 0x62, 0x73, 0x74, 0x72, 0x28, 0x4d, 0x61, 0x74, 0x68, 0x2e,
- 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x28, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x72,
- 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x78,
- 0x31, 0x30, 0x29, 0x2c, 0x20, 0x31, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x5b, 0x31,
- 0x34, 0x5d, 0x20, 0x3d, 0x20, 0x22, 0x34, 0x22, 0x3b, 0x20, 0x20, 0x2f,
- 0x2f, 0x20, 0x62, 0x69, 0x74, 0x73, 0x20, 0x31, 0x32, 0x2d, 0x31, 0x35,
- 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65,
- 0x5f, 0x68, 0x69, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73,
- 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x6f,
- 0x20, 0x30, 0x30, 0x31, 0x30, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73,
- 0x5b, 0x31, 0x39, 0x5d, 0x20, 0x3d, 0x20, 0x68, 0x65, 0x78, 0x44, 0x69,
- 0x67, 0x69, 0x74, 0x73, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x74, 0x72, 0x28,
- 0x28, 0x73, 0x5b, 0x31, 0x39, 0x5d, 0x20, 0x26, 0x20, 0x30, 0x78, 0x33,
- 0x29, 0x20, 0x7c, 0x20, 0x30, 0x78, 0x38, 0x2c, 0x20, 0x31, 0x29, 0x3b,
- 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x69, 0x74, 0x73, 0x20, 0x36, 0x2d,
- 0x37, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x6f,
- 0x63, 0x6b, 0x5f, 0x73, 0x65, 0x71, 0x5f, 0x68, 0x69, 0x5f, 0x61, 0x6e,
- 0x64, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x74,
- 0x6f, 0x20, 0x30, 0x31, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x5b,
- 0x38, 0x5d, 0x20, 0x3d, 0x20, 0x73, 0x5b, 0x31, 0x33, 0x5d, 0x20, 0x3d,
- 0x20, 0x73, 0x5b, 0x31, 0x38, 0x5d, 0x20, 0x3d, 0x20, 0x73, 0x5b, 0x32,
- 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x22, 0x2d, 0x22, 0x3b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x75, 0x75, 0x69, 0x64, 0x20,
- 0x3d, 0x20, 0x73, 0x2e, 0x6a, 0x6f, 0x69, 0x6e, 0x28, 0x22, 0x22, 0x29,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72,
- 0x6e, 0x20, 0x75, 0x75, 0x69, 0x64, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x74,
- 0x68, 0x69, 0x73, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x70, 0x6f, 0x6c, 0x6c,
- 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28,
- 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c,
- 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e,
- 0x6f, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x73, 0x74, 0x61, 0x74, 0x65,
- 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x73, 0x65, 0x6c, 0x66,
- 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e, 0x72,
- 0x65, 0x61, 0x64, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3d, 0x3d,
- 0x3d, 0x20, 0x34, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x63,
- 0x6f, 0x6d, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x20, 0x21, 0x3d, 0x3d, 0x20, 0x32, 0x30, 0x30, 0x29,
- 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73,
- 0x65, 0x6c, 0x66, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x70, 0x6f, 0x6c, 0x6c,
- 0x28, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x6f, 0x6e, 0x52, 0x63, 0x76, 0x64, 0x28,
- 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x50, 0x6f,
- 0x6c, 0x6c, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x70, 0x6f, 0x6c,
- 0x6c, 0x28, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x6f, 0x6b,
- 0x65, 0x6e, 0x20, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x20, 0x77, 0x65, 0x20,
- 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65,
- 0x78, 0x74, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66,
- 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e, 0x6f,
- 0x70, 0x65, 0x6e, 0x28, 0x22, 0x47, 0x45, 0x54, 0x22, 0x2c, 0x20, 0x73,
- 0x65, 0x6c, 0x66, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x2b,
- 0x20, 0x28, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79,
- 0x20, 0x3f, 0x20, 0x22, 0x3f, 0x22, 0x20, 0x2b, 0x20, 0x73, 0x65, 0x6c,
- 0x66, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x3a, 0x20, 0x22, 0x22,
- 0x29, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c,
- 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e,
- 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65,
- 0x61, 0x64, 0x65, 0x72, 0x28, 0x27, 0x58, 0x2d, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x65, 0x64, 0x2d, 0x57, 0x69, 0x74, 0x68, 0x27, 0x2c,
- 0x20, 0x27, 0x58, 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x27, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x63, 0x6f, 0x6d,
- 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x74, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x28,
- 0x22, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22,
- 0x2c, 0x20, 0x22, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x22, 0x29, 0x3b, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x63, 0x6f,
- 0x6d, 0x65, 0x74, 0x50, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x6e, 0x64,
- 0x28, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x74, 0x68, 0x69, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e,
- 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
- 0x6f, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72, 0x2e, 0x6f, 0x70, 0x65,
- 0x6e, 0x28, 0x22, 0x50, 0x4f, 0x53, 0x54, 0x22, 0x2c, 0x20, 0x73, 0x65,
- 0x6c, 0x66, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x2b, 0x20,
- 0x28, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20,
- 0x3f, 0x20, 0x22, 0x3f, 0x22, 0x20, 0x2b, 0x20, 0x73, 0x65, 0x6c, 0x66,
- 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x3a, 0x20, 0x22, 0x22, 0x29,
- 0x2c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72, 0x2e,
- 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65,
- 0x61, 0x64, 0x65, 0x72, 0x28, 0x27, 0x58, 0x2d, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x65, 0x64, 0x2d, 0x57, 0x69, 0x74, 0x68, 0x27, 0x2c,
- 0x20, 0x27, 0x58, 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x27, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72, 0x2e, 0x73, 0x65,
- 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x28, 0x27, 0x58, 0x2d, 0x53, 0x43, 0x58, 0x4d, 0x4c, 0x2d,
- 0x4e, 0x61, 0x6d, 0x65, 0x27, 0x2c, 0x20, 0x22, 0x64, 0x6f, 0x6e, 0x65,
- 0x2e, 0x69, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x22, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72,
- 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x28, 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x6f,
- 0x73, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
- 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x64, 0x61, 0x74, 0x61,
- 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70,
- 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65,
- 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x28,
- 0x22, 0x50, 0x4f, 0x53, 0x54, 0x22, 0x2c, 0x20, 0x73, 0x65, 0x6c, 0x66,
- 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x2b, 0x20, 0x28, 0x73,
- 0x65, 0x6c, 0x66, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x3f, 0x20,
- 0x22, 0x3f, 0x22, 0x20, 0x2b, 0x20, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x71,
- 0x75, 0x65, 0x72, 0x79, 0x20, 0x3a, 0x20, 0x22, 0x22, 0x29, 0x29, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x78,
- 0x68, 0x72, 0x2e, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x28, 0x27, 0x58, 0x2d, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x2d, 0x57, 0x69, 0x74,
- 0x68, 0x27, 0x2c, 0x20, 0x27, 0x58, 0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x27, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72,
- 0x2e, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48,
- 0x65, 0x61, 0x64, 0x65, 0x72, 0x28, 0x27, 0x58, 0x2d, 0x53, 0x43, 0x58,
- 0x4d, 0x4c, 0x2d, 0x4e, 0x61, 0x6d, 0x65, 0x27, 0x2c, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66,
- 0x20, 0x28, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70,
- 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73,
- 0x65, 0x6c, 0x66, 0x2e, 0x78, 0x68, 0x72, 0x2e, 0x73, 0x65, 0x74, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
- 0x28, 0x27, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79,
- 0x70, 0x65, 0x27, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
- 0x54, 0x79, 0x70, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x2e,
- 0x78, 0x68, 0x72, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x28, 0x64, 0x61, 0x74,
- 0x61, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x73, 0x65,
- 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x6f,
- 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20,
- 0x73, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x74, 0x68, 0x69,
- 0x73, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20,
- 0x74, 0x68, 0x69, 0x6e, 0x67, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x3b, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x65, 0x20,
- 0x61, 0x6c, 0x73, 0x6f, 0x3a, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a,
- 0x2f, 0x2f, 0x72, 0x61, 0x77, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x6f, 0x75, 0x67, 0x6c, 0x61, 0x73,
- 0x63, 0x72, 0x6f, 0x63, 0x6b, 0x66, 0x6f, 0x72, 0x64, 0x2f, 0x4a, 0x53,
- 0x4f, 0x4e, 0x2d, 0x6a, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72,
- 0x2f, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x6a, 0x73, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74,
- 0x63, 0x68, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x69, 0x6e,
- 0x67, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x74, 0x79,
- 0x70, 0x65, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x3d,
- 0x3d, 0x3d, 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x29,
- 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72,
- 0x20, 0x73, 0x65, 0x65, 0x6e, 0x20, 0x3d, 0x20, 0x5b, 0x5d, 0x3b, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x6c,
- 0x6c, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x6f,
- 0x6e, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x20, 0x61, 0x73, 0x20, 0x74,
- 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20, 0x63, 0x68, 0x65, 0x63,
- 0x6b, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x79, 0x63, 0x6c,
- 0x65, 0x73, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x64, 0x61, 0x74, 0x61, 0x20, 0x3d, 0x20, 0x4a, 0x53,
- 0x4f, 0x4e, 0x2e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79,
- 0x28, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x66, 0x75, 0x6e, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6b, 0x65, 0x79, 0x2c, 0x20, 0x76, 0x61,
- 0x6c, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x69, 0x66, 0x20, 0x28, 0x69, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x28, 0x76,
- 0x61, 0x6c, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
- 0x20, 0x61, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x20, 0x6f, 0x66, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
- 0x65, 0x73, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72,
- 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x64, 0x3a, 0x20, 0x76, 0x61, 0x6c,
- 0x2e, 0x69, 0x64, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x74, 0x61, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x76,
- 0x61, 0x6c, 0x2e, 0x74, 0x61, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x2c, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x6c, 0x6f, 0x63,
- 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x76, 0x61, 0x6c, 0x2e,
- 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x69, 0x66, 0x20, 0x28, 0x69, 0x73, 0x57, 0x69, 0x6e, 0x64, 0x6f,
- 0x77, 0x28, 0x76, 0x61, 0x6c, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x74, 0x79,
- 0x70, 0x65, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x20, 0x3d, 0x3d, 0x3d,
- 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x29, 0x20, 0x7b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20,
- 0x28, 0x73, 0x65, 0x65, 0x6e, 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f,
- 0x66, 0x28, 0x76, 0x61, 0x6c, 0x29, 0x20, 0x3e, 0x3d, 0x20, 0x30, 0x29,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65,
- 0x74, 0x75, 0x72, 0x6e, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x73, 0x65, 0x65, 0x6e, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x28,
- 0x76, 0x61, 0x6c, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74,
- 0x75, 0x72, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x7d, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d,
- 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x64, 0x61, 0x74, 0x61, 0x20, 0x3d, 0x20, 0x74, 0x68, 0x69,
- 0x6e, 0x67, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x6f, 0x73,
- 0x74, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x64, 0x61, 0x74, 0x61,
- 0x2c, 0x20, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
- 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x22, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x68, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x20,
- 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20,
- 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x20, 0x77, 0x68,
- 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x68, 0x74, 0x6d,
- 0x6c, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x76,
- 0x61, 0x72, 0x20, 0x69, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x20, 0x3d, 0x20,
- 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x29, 0x7b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
- 0x6e, 0x20, 0x28, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20,
- 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x4e, 0x6f, 0x64, 0x65, 0x20,
- 0x3d, 0x3d, 0x3d, 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22,
- 0x20, 0x3f, 0x20, 0x6f, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
- 0x65, 0x6f, 0x66, 0x20, 0x4e, 0x6f, 0x64, 0x65, 0x20, 0x3a, 0x20, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x20, 0x26, 0x26,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6f, 0x20, 0x3d, 0x3d,
- 0x3d, 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x20, 0x26,
- 0x26, 0x20, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6f, 0x2e, 0x6e,
- 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x3d, 0x20,
- 0x22, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x20, 0x26, 0x26, 0x20,
- 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6f, 0x2e, 0x6e, 0x6f, 0x64,
- 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x3d, 0x3d, 0x3d, 0x22, 0x73, 0x74, 0x72,
- 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x29,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x2f, 0x2f, 0x20, 0x68, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x20, 0x66,
- 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x64,
- 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x20, 0x77, 0x68, 0x65,
- 0x74, 0x68, 0x65, 0x72, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69,
- 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x77, 0x69, 0x6e, 0x64,
- 0x6f, 0x77, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x69,
- 0x73, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x75,
- 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6f, 0x29, 0x7b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
- 0x28, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x6f, 0x66, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20,
- 0x3d, 0x3d, 0x3d, 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22,
- 0x20, 0x3f, 0x20, 0x6f, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
- 0x65, 0x6f, 0x66, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x3a,
- 0x20, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x20,
- 0x26, 0x26, 0x20, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6f, 0x20,
- 0x3d, 0x3d, 0x3d, 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22,
- 0x20, 0x26, 0x26, 0x20, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x6f,
- 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x61, 0x72, 0x20, 0x3d, 0x3d, 0x3d,
- 0x20, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x20, 0x20, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09,
- 0x09, 0x0a, 0x09, 0x09, 0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
- 0x3e, 0x0a, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x3c, 0x73, 0x63, 0x72, 0x69,
- 0x70, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x74, 0x65, 0x78,
- 0x74, 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
- 0x22, 0x3e, 0x0a, 0x09, 0x09, 0x09, 0x64, 0x6f, 0x6d, 0x4c, 0x6f, 0x61,
- 0x64, 0x65, 0x64, 0x28, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x20, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x73, 0x63,
- 0x78, 0x6d, 0x6c, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x43, 0x6f,
- 0x6d, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x28, 0x7b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x65, 0x6c, 0x65, 0x6d,
- 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e,
- 0x74, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
- 0x42, 0x79, 0x49, 0x64, 0x28, 0x22, 0x24, 0x7b, 0x73, 0x63, 0x78, 0x6d,
- 0x6c, 0x2e, 0x69, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x49, 0x64, 0x7d, 0x22,
- 0x29, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x72, 0x76,
- 0x65, 0x72, 0x3a, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74,
- 0x2e, 0x55, 0x52, 0x4c, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x6f,
- 0x6e, 0x52, 0x63, 0x76, 0x64, 0x20, 0x3a, 0x20, 0x66, 0x75, 0x6e, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x64, 0x61, 0x74, 0x61, 0x29, 0x20, 0x7b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x64,
- 0x61, 0x74, 0x61, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x58, 0x4d, 0x4c, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d,
- 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73,
- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x28,
- 0x22, 0x58, 0x2d, 0x53, 0x43, 0x58, 0x4d, 0x4c, 0x2d, 0x54, 0x79, 0x70,
- 0x65, 0x22, 0x29, 0x20, 0x7c, 0x7c, 0x20, 0x22, 0x72, 0x65, 0x70, 0x6c,
- 0x61, 0x63, 0x65, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72,
- 0x20, 0x64, 0x6f, 0x6d, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x3d,
- 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73,
- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x28,
- 0x22, 0x58, 0x2d, 0x53, 0x43, 0x58, 0x4d, 0x4c, 0x2d, 0x58, 0x50, 0x61,
- 0x74, 0x68, 0x22, 0x29, 0x20, 0x7c, 0x7c, 0x20, 0x22, 0x2f, 0x68, 0x74,
- 0x6d, 0x6c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x3b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x64, 0x6f, 0x6d,
- 0x41, 0x74, 0x74, 0x72, 0x20, 0x3d, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e,
- 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48,
- 0x65, 0x61, 0x64, 0x65, 0x72, 0x28, 0x22, 0x58, 0x2d, 0x53, 0x43, 0x58,
- 0x4d, 0x4c, 0x2d, 0x41, 0x74, 0x74, 0x72, 0x22, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65,
- 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d,
- 0x65, 0x6e, 0x74, 0x2e, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65,
- 0x28, 0x64, 0x6f, 0x6d, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2c, 0x20,
- 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x6e, 0x75,
- 0x6c, 0x6c, 0x2c, 0x20, 0x58, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73,
- 0x75, 0x6c, 0x74, 0x2e, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x45, 0x44, 0x5f,
- 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f,
- 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2c, 0x20, 0x6e, 0x75, 0x6c, 0x6c,
- 0x29, 0x3b, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x66,
- 0x6f, 0x72, 0x20, 0x28, 0x76, 0x61, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20,
- 0x30, 0x2c, 0x20, 0x6c, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c,
- 0x74, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x4c, 0x65,
- 0x6e, 0x67, 0x74, 0x68, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x6c, 0x3b,
- 0x20, 0x69, 0x2b, 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, 0x6d,
- 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x73, 0x6e,
- 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x28, 0x69,
- 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x76,
- 0x61, 0x72, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x3d, 0x20, 0x64, 0x6f,
- 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72,
- 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x28, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x58, 0x4d, 0x4c, 0x2e, 0x66,
- 0x69, 0x72, 0x73, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x2c, 0x20, 0x74,
- 0x72, 0x75, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x20, 0x28, 0x74, 0x79,
- 0x70, 0x65, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x63, 0x61, 0x73, 0x65, 0x20, 0x22, 0x66, 0x69, 0x72,
- 0x73, 0x74, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x22, 0x3a, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d,
- 0x2e, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72,
- 0x65, 0x28, 0x6e, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x6d,
- 0x2e, 0x66, 0x69, 0x72, 0x73, 0x74, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x29,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x62,
- 0x72, 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x63, 0x61, 0x73, 0x65, 0x20, 0x22, 0x6c, 0x61, 0x73,
- 0x74, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x22, 0x3a, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x2e,
- 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x28,
- 0x6e, 0x6f, 0x64, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x63, 0x61, 0x73, 0x65,
- 0x20, 0x22, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x73, 0x69,
- 0x62, 0x6c, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x70,
- 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x69, 0x6e,
- 0x73, 0x65, 0x72, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x28, 0x6e,
- 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x29, 0x3b, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x62, 0x72, 0x65,
- 0x61, 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x63, 0x61, 0x73, 0x65, 0x20, 0x22, 0x6e, 0x65, 0x78, 0x74, 0x73,
- 0x69, 0x62, 0x6c, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x2e,
- 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x69,
- 0x6e, 0x73, 0x65, 0x72, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x28,
- 0x6e, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x6e,
- 0x65, 0x78, 0x74, 0x53, 0x69, 0x62, 0x6c, 0x69, 0x6e, 0x67, 0x29, 0x3b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x62, 0x72,
- 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x63, 0x61, 0x73, 0x65, 0x20, 0x22, 0x72, 0x65, 0x70, 0x6c,
- 0x61, 0x63, 0x65, 0x22, 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x61, 0x72,
- 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x72, 0x65, 0x70, 0x6c,
- 0x61, 0x63, 0x65, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x28, 0x6e, 0x6f, 0x64,
- 0x65, 0x2c, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x29, 0x3b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x62, 0x72, 0x65, 0x61, 0x6b,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x63,
- 0x61, 0x73, 0x65, 0x20, 0x22, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22,
- 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4e,
- 0x6f, 0x64, 0x65, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68,
- 0x69, 0x6c, 0x64, 0x28, 0x69, 0x74, 0x65, 0x6d, 0x29, 0x3b, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x62, 0x72, 0x65, 0x61,
- 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x63, 0x61, 0x73, 0x65, 0x20, 0x22, 0x61, 0x64, 0x64, 0x61, 0x74, 0x74,
- 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x22, 0x3a, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x2e,
- 0x73, 0x65, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
- 0x28, 0x64, 0x6f, 0x6d, 0x41, 0x74, 0x74, 0x72, 0x2c, 0x20, 0x6e, 0x6f,
- 0x64, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x63, 0x61, 0x73, 0x65, 0x20, 0x22,
- 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x63, 0x68, 0x69, 0x6c, 0x64,
- 0x72, 0x65, 0x6e, 0x22, 0x3a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x28, 0x69, 0x74,
- 0x65, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x4e,
- 0x6f, 0x64, 0x65, 0x73, 0x28, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65,
- 0x6d, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x69, 0x6c,
- 0x64, 0x28, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x66, 0x69, 0x72, 0x73, 0x74,
- 0x43, 0x68, 0x69, 0x6c, 0x64, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x61,
- 0x70, 0x70, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x28, 0x6e,
- 0x6f, 0x64, 0x65, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x0a,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x62, 0x72, 0x65,
- 0x61, 0x6b, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
- 0x7d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x7d, 0x29, 0x3b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x73, 0x63, 0x78, 0x6d, 0x6c, 0x2e, 0x6c, 0x6f, 0x6e, 0x67,
- 0x70, 0x6f, 0x6c, 0x6c, 0x28, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09,
- 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x73, 0x63,
- 0x78, 0x6d, 0x6c, 0x3b, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x77, 0x69,
- 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x6f, 0x6e, 0x62, 0x65, 0x66, 0x6f, 0x72,
- 0x65, 0x75, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75,
- 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x65, 0x29, 0x20, 0x7b,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x73, 0x63, 0x78, 0x6d, 0x6c, 0x2e,
- 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x28, 0x29,
- 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x72, 0x65,
- 0x74, 0x75, 0x72, 0x6e, 0x20, 0x27, 0x59, 0x6f, 0x75, 0x20, 0x68, 0x61,
- 0x76, 0x65, 0x20, 0x75, 0x6e, 0x73, 0x61, 0x76, 0x65, 0x64, 0x20, 0x63,
- 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x21, 0x27, 0x3b, 0x0a, 0x09, 0x09,
- 0x09, 0x09, 0x7d, 0x3b, 0x0a, 0x09, 0x09, 0x09, 0x7d, 0x29, 0x3b, 0x0a,
- 0x09, 0x09, 0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3e, 0x0a,
- 0x0a, 0x09, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, 0x0a, 0x09, 0x3c,
- 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e,
- 0x0a, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x0a
-};
-unsigned int template_xhtml_invoker_html_len = 8253;
diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
index 3c882ed..1171d73 100644
--- a/src/uscxml/plugins/ioprocessor/CMakeLists.txt
+++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
@@ -1,25 +1,3 @@
-# LIBEVENT basichttp ioprocessor - this one is already required above
-
-set(USCXML_IOPROCESSORS "basichttp ${USCXML_IOPROCESSORS}")
-file(GLOB_RECURSE BASICHTTP_IOPROCESSOR
- basichttp/*.cpp
- basichttp/*.h
-)
-if (BUILD_AS_PLUGINS)
- source_group("" FILES ${BASICHTTP_IOPROCESSOR})
- add_library(
- ioprocessor_basichttp SHARED
- ${BASICHTTP_IOPROCESSOR}
- "../Plugins.cpp")
- target_link_libraries(ioprocessor_basichttp uscxml)
- set_target_properties(ioprocessor_basichttp PROPERTIES FOLDER "Plugin IOProcessor")
- set_target_properties(ioprocessor_basichttp PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(ioprocessor_basichttp PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
-else()
- list (APPEND USCXML_FILES ${BASICHTTP_IOPROCESSOR})
-endif()
-
-
# scxml ioprocessor
set(USCXML_IOPROCESSORS "scxml ${USCXML_IOPROCESSORS}")
@@ -27,110 +5,16 @@ file(GLOB_RECURSE SCXML_IOPROCESSOR
scxml/*.cpp
scxml/*.h
)
+list (APPEND USCXML_FILES ${SCXML_IOPROCESSOR})
+
+set(USCXML_IOPROCESSORS "basichttp ${USCXML_IOPROCESSORS}")
file(GLOB_RECURSE BASICHTTP_IOPROCESSOR
basichttp/*.cpp
basichttp/*.h
)
-if (BUILD_AS_PLUGINS)
- source_group("" FILES ${SCXML_IOPROCESSOR})
- add_library(
- ioprocessor_scxml SHARED
- ${SCXML_IOPROCESSOR}
- ${BASICHTTP_IOPROCESSOR}
- "../Plugins.cpp")
- # scxml ioprocessor is a basichttp ioprocessor
- target_link_libraries(ioprocessor_scxml uscxml)
- set_target_properties(ioprocessor_scxml PROPERTIES FOLDER "Plugin IOProcessor")
- set_target_properties(ioprocessor_scxml PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(ioprocessor_scxml PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
-else()
- list (APPEND USCXML_FILES ${SCXML_IOPROCESSOR})
-endif()
-
-
-if (NOT BUILD_MINIMAL)
-
- set(USCXML_IOPROCESSORS "sample ${USCXML_IOPROCESSORS}")
- file(GLOB_RECURSE SAMPLE_IOPROCESSOR
- sample/*.cpp
- sample/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${SAMPLE_IOPROCESSOR})
- add_library(
- ioprocessor_sample SHARED
- ${SAMPLE_IOPROCESSOR}
- "../Plugins.cpp")
- target_link_libraries(ioprocessor_sample uscxml)
- set_target_properties(ioprocessor_sample PROPERTIES FOLDER "Plugin IOProcessor")
- set_target_properties(ioprocessor_sample PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(ioprocessor_sample PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${SAMPLE_IOPROCESSOR})
- endif()
-
- set(USCXML_IOPROCESSORS "comet ${USCXML_IOPROCESSORS}")
- file(GLOB_RECURSE COMET_IOPROCESSOR
- comet/*.cpp
- comet/*.h
- )
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${COMET_IOPROCESSOR})
- add_library(
- ioprocessor_comet SHARED
- ${COMET_IOPROCESSOR}
- "../Plugins.cpp")
- target_link_libraries(ioprocessor_comet uscxml)
- set_target_properties(ioprocessor_comet PROPERTIES FOLDER "Plugin IOProcessor")
- set_target_properties(ioprocessor_comet PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(ioprocessor_comet PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${COMET_IOPROCESSOR})
- endif()
-
-
- # mmi ioprocessor
-
- if (PROTOBUF_FOUND AND OFF)
-
- if (NOT PROTOBUF_PROTOC_EXECUTABLE)
- message(FATAL_ERROR "protoc binary required for serialization")
- endif()
-
- set(USCXML_IOPROCESSORS "mmi ${USCXML_IOPROCESSORS}")
- file(GLOB_RECURSE MMI_IOPROCESSOR
- modality/*.cpp
- modality/*.h
- )
-
- # process .proto files
- file(GLOB_RECURSE PROTOBUF_INTERFACES ${PROJECT_SOURCE_DIR}/contrib/proto/*.proto)
- list (APPEND USCXML_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
-
- PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTOBUF_INTERFACES})
- # set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE)
-
- # this needs to be here for dependencies on the generated proto files
- add_library(mmi_proto STATIC ${PROTO_SRCS})
- set_target_properties(mmi_proto PROPERTIES FOLDER "Generated")
-
- if (BUILD_AS_PLUGINS)
- source_group("" FILES ${MMI_IOPROCESSOR})
- add_library(
- ioprocessor_mmi SHARED
- ${MMI_IOPROCESSOR}
- "../Plugins.cpp")
- target_link_libraries(ioprocessor_mmi uscxml mmi_proto)
- set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor")
- set_target_properties(ioprocessor_mmi PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(ioprocessor_mmi PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
- else()
- list (APPEND USCXML_FILES ${MMI_IOPROCESSOR})
- list (APPEND USCXML_OPT_LIBS mmi_proto)
- endif()
- endif()
+list (APPEND BASICHTTP_IOPROCESSOR "")
-endif() # BUILD_MINIMAL
+list (APPEND USCXML_FILES ${BASICHTTP_IOPROCESSOR})
set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE)
set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE)
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 1bced48..f81cf54 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -20,9 +20,8 @@
#include "uscxml/Common.h"
#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
-#include "uscxml/Message.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/dom/NameSpacingParser.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/util/DOM.h"
#include <iostream>
#include <event2/dns.h>
@@ -31,8 +30,7 @@
#include <string.h>
-#include <io/uri.hpp>
-#include <glog/logging.h>
+#include <easylogging++.h>
#include <boost/algorithm/string.hpp>
#ifdef _WIN32
@@ -65,6 +63,7 @@ bool pluginConnect(pluma::Host& host) {
// see http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor
BasicHTTPIOProcessor::BasicHTTPIOProcessor() {
+ HTTPServer::getInstance();
}
BasicHTTPIOProcessor::~BasicHTTPIOProcessor() {
@@ -73,8 +72,8 @@ BasicHTTPIOProcessor::~BasicHTTPIOProcessor() {
}
-boost::shared_ptr<IOProcessorImpl> BasicHTTPIOProcessor::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<BasicHTTPIOProcessor> io = boost::shared_ptr<BasicHTTPIOProcessor>(new BasicHTTPIOProcessor());
+std::shared_ptr<IOProcessorImpl> BasicHTTPIOProcessor::create(InterpreterImpl* interpreter) {
+ std::shared_ptr<BasicHTTPIOProcessor> io(new BasicHTTPIOProcessor());
io->_interpreter = interpreter;
// register at http server
@@ -104,19 +103,19 @@ Data BasicHTTPIOProcessor::getDataModelVariables() {
data.compound["path"] = Data(url.path(), Data::VERBATIM);
data.compound["scheme"] = Data(url.scheme(), Data::VERBATIM);
- std::vector<std::string> pathComps = url.pathComponents();
- std::vector<std::string>::const_iterator pathCompIter = pathComps.begin();
+ std::list<std::string> pathComps = url.pathComponents();
+ std::list<std::string>::const_iterator pathCompIter = pathComps.begin();
while(pathCompIter != pathComps.end()) {
- data.compound["pathComponens"].array.push_back(Data(*pathCompIter, Data::VERBATIM));
+ data.compound["pathComponents"].array.push_back(Data(*pathCompIter, Data::VERBATIM));
pathCompIter++;
}
return data;
}
-bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
- Event reqEvent = req;
- reqEvent.eventType = Event::EXTERNAL;
+bool BasicHTTPIOProcessor::requestFromHTTP(const HTTPServer::Request& req) {
+ Event event = req;
+ event.eventType = Event::EXTERNAL;
// std::cout << req.raw << std::endl;
@@ -130,10 +129,10 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
// if we sent ourself an event it will end up here
// this will call the const subscript operator
if (req.data.at("content").hasKey("_scxmleventname")) {
- reqEvent.name = req.data.at("content").at("_scxmleventname").atom;
+ event.name = req.data.at("content").at("_scxmleventname").atom;
}
if (req.data.at("content").hasKey("content")) {
- reqEvent.content = req.data.at("content").at("content").atom;
+ event.data.atom = req.data.at("content").at("content").atom;
}
}
@@ -143,9 +142,9 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
for(std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
compIter!= data.compound.end(); compIter++) {
if (compIter->first == "content") {
- reqEvent.content = compIter->second.atom;
+ event.data.atom = compIter->second.atom;
} else {
- reqEvent.data[compIter->first] = compIter->second;
+ event.data[compIter->first] = compIter->second;
}
}
}
@@ -155,62 +154,60 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
for(std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
compIter!= data.compound.end(); compIter++) {
if (compIter->first == "_scxmleventname") {
- reqEvent.name = compIter->second.atom;
+ event.name = compIter->second.atom;
}
}
}
- // check whether we can parse it as XML
- if (reqEvent.content.length() > 0) {
- NameSpacingParser parser = NameSpacingParser::fromXML(reqEvent.content);
- if (!parser.errorsReported()) {
- reqEvent.dom = parser.getDocument();
- }
- }
-
- /// test532
- if (reqEvent.name.length() == 0)
- reqEvent.name = "http." + req.data.compound.at("type").atom;
+ // test 532
+ if (event.name.length() == 0)
+ event.name = "http." + req.data.compound.at("type").atom;
- returnEvent(reqEvent);
+ eventToSCXML(event, USCXML_IOPROC_BASICHTTP_TYPE, _url);
evhttp_send_reply(req.evhttpReq, 200, "OK", NULL);
return true;
}
-void BasicHTTPIOProcessor::send(const SendRequest& req) {
+bool BasicHTTPIOProcessor::isValidTarget(const std::string& target) {
+ try {
+ URL url(target);
+ if (url.scheme().compare("http") != 0)
+ return false;
- if (req.target.length() == 0) {
- _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM));
- return;
+ return true;
+ } catch (ErrorEvent e) {
}
+ return false;
+}
- bool isLocal = false;
- std::string target;
- if (!boost::equals(req.target, _url)) {
- target = req.target;
- } else {
- isLocal = true;
- target = _url;
+void BasicHTTPIOProcessor::eventFromSCXML(const std::string& target, const Event& event) {
+
+ // TODO: is this still needed with isValidTarget()?
+ if (target.length() == 0) {
+ _interpreter->enqueueInternal(Event("error.communication", Event::PLATFORM));
+ return;
}
+
+ bool isLocal = target == _url;
URL targetURL(target);
std::stringstream kvps;
std::string kvpSeperator;
// event name
- if (req.name.size() > 0) {
+ if (event.name.size() > 0) {
char* eventNameCStr = evhttp_encode_uri("_scxmleventname");
- char* eventValueCStr = evhttp_encode_uri(req.name.c_str());
+ char* eventValueCStr = evhttp_encode_uri(event.name.c_str());
kvps << kvpSeperator << eventNameCStr << "=" << eventValueCStr;
kvpSeperator = "&";
free(eventNameCStr);
free(eventValueCStr);
-// targetURL.addOutHeader("_scxmleventname", evhttp_encode_uri(req.name.c_str()));
+ targetURL.addOutHeader("_scxmleventname", evhttp_encode_uri(event.name.c_str()));
}
// event namelist
- if (req.namelist.size() > 0) {
- std::map<std::string, Data>::const_iterator namelistIter = req.namelist.begin();
- while (namelistIter != req.namelist.end()) {
+ if (event.namelist.size() > 0) {
+ std::map<std::string, Data>::const_iterator namelistIter = event.namelist.begin();
+ while (namelistIter != event.namelist.end()) {
char* keyCStr = evhttp_encode_uri(namelistIter->first.c_str());
// this is simplified - Data might be more elaborate than a simple string atom
char* valueCStr = evhttp_encode_uri(namelistIter->second.atom.c_str());
@@ -218,15 +215,15 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) {
free(keyCStr);
free(valueCStr);
kvpSeperator = "&";
-// targetURL.addOutHeader(namelistIter->first, namelistIter->second);
+ targetURL.addOutHeader(namelistIter->first, namelistIter->second);
namelistIter++;
}
}
// event params
- if (req.params.size() > 0) {
- std::multimap<std::string, Data>::const_iterator paramIter = req.params.begin();
- while (paramIter != req.params.end()) {
+ if (event.params.size() > 0) {
+ std::multimap<std::string, Data>::const_iterator paramIter = event.params.begin();
+ while (paramIter != event.params.end()) {
char* keyCStr = evhttp_encode_uri(paramIter->first.c_str());
// this is simplified - Data might be more elaborate than a simple string atom
char* valueCStr = evhttp_encode_uri(paramIter->second.atom.c_str());
@@ -234,35 +231,23 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) {
free(keyCStr);
free(valueCStr);
kvpSeperator = "&";
-// targetURL.addOutHeader(paramIter->first, paramIter->second);
+ targetURL.addOutHeader(paramIter->first, paramIter->second);
paramIter++;
}
}
// try hard to find actual content
char* keyCStr = evhttp_encode_uri("content");
- if (req.content.size() > 0) {
- char* valueCStr = evhttp_encode_uri(req.content.c_str());
- kvps << kvpSeperator << keyCStr << "=" << valueCStr;
- free(valueCStr);
- kvpSeperator = "&";
- } else if (req.dom) {
- std::stringstream xmlStream;
- xmlStream << req.dom;
- char* valueCStr = evhttp_encode_uri(xmlStream.str().c_str());
- kvps << kvpSeperator << keyCStr << "=" << valueCStr;
- free(valueCStr);
- kvpSeperator = "&";
- } else if (!req.data.empty()) {
+ if (!event.data.empty()) {
char* valueCStr = NULL;
- if (req.data.atom.length() || req.data.array.size() || req.data.compound.size()) {
- valueCStr = evhttp_encode_uri(Data::toJSON(req.data).c_str());
- } else if(req.data.node) {
+ if (event.data.atom.length() || event.data.array.size() || event.data.compound.size()) {
+ valueCStr = evhttp_encode_uri(Data::toJSON(event.data).c_str());
+ } else if(event.data.node) {
std::stringstream xmlStream;
- xmlStream << req.data.node;
+ xmlStream << event.data.node;
valueCStr = evhttp_encode_uri(xmlStream.str().c_str());
- } else if(req.data.binary) {
- valueCStr = evhttp_encode_uri(req.data.binary.base64().c_str());
+ } else if(event.data.binary) {
+ valueCStr = evhttp_encode_uri(event.data.binary.base64().c_str());
}
if (valueCStr != NULL) {
kvps << kvpSeperator << keyCStr << "=" << valueCStr;
@@ -273,13 +258,12 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) {
free(keyCStr);
targetURL.setOutContent(kvps.str());
+ targetURL.addOutHeader("Content-Type", "application/x-www-form-urlencoded");
-// targetURL.addOutHeader("Content-Type", "application/x-www-form-urlencoded");
-
- targetURL.setRequestType("post");
+ targetURL.setRequestType(URLRequestType::POST);
targetURL.addMonitor(this);
- _sendRequests[req.sendid] = std::make_pair(targetURL, req);
+ _sendRequests[event.sendid] = std::make_pair(targetURL, event);
if (isLocal) {
// test201 use a blocking request with local communication
targetURL.download(true);
@@ -291,7 +275,7 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) {
void BasicHTTPIOProcessor::downloadStarted(const URL& url) {}
void BasicHTTPIOProcessor::downloadCompleted(const URL& url) {
- std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin();
+ std::map<std::string, std::pair<URL, Event> >::iterator reqIter = _sendRequests.begin();
while(reqIter != _sendRequests.end()) {
if (reqIter->second.first == url) {
// test513
@@ -302,7 +286,7 @@ void BasicHTTPIOProcessor::downloadCompleted(const URL& url) {
Event event;
event.data = url;
event.name = "HTTP." + statusPrefix + "." + statusRest;
-// returnEvent(event);
+ eventToSCXML(event, USCXML_IOPROC_BASICHTTP_TYPE, std::string(_url));
}
_sendRequests.erase(reqIter);
return;
@@ -314,12 +298,12 @@ void BasicHTTPIOProcessor::downloadCompleted(const URL& url) {
void BasicHTTPIOProcessor::downloadFailed(const URL& url, int errorCode) {
- std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin();
+ std::map<std::string, std::pair<URL, Event> >::iterator reqIter = _sendRequests.begin();
while(reqIter != _sendRequests.end()) {
if (reqIter->second.first == url) {
Event failEvent;
failEvent.name = "error.communication";
- returnEvent(failEvent);
+ eventToSCXML(failEvent, USCXML_IOPROC_BASICHTTP_TYPE, std::string(_url));
_sendRequests.erase(reqIter);
return;
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
index 3a43e49..f7e9f10 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
@@ -35,10 +35,9 @@ extern "C" {
# define USCXML_PLUGIN_API
#endif
-#include "uscxml/concurrency/DelayedEventQueue.h"
#include "uscxml/server/HTTPServer.h"
#include "uscxml/Interpreter.h"
-#include "uscxml/Factory.h"
+#include "uscxml/plugins/Factory.h"
#ifndef _WIN32
#include <sys/time.h>
#endif
@@ -47,27 +46,30 @@ extern "C" {
#include "uscxml/plugins/Plugins.h"
#endif
+#define USCXML_IOPROC_BASICHTTP_TYPE "http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"
+
namespace uscxml {
class USCXML_PLUGIN_API BasicHTTPIOProcessor : public IOProcessorImpl, public HTTPServlet, public URLMonitor {
public:
BasicHTTPIOProcessor();
virtual ~BasicHTTPIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+ virtual std::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
virtual std::list<std::string> getNames() {
std::list<std::string> names;
names.push_back("basichttp");
- names.push_back("http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor");
+ names.push_back(USCXML_IOPROC_BASICHTTP_TYPE);
return names;
}
- virtual void send(const SendRequest& req);
+ virtual void eventFromSCXML(const std::string& target, const Event& event);
+ virtual bool isValidTarget(const std::string& target);
Data getDataModelVariables();
/// HTTPServlet
- bool httpRecvRequest(const HTTPServer::Request& req);
+ bool requestFromHTTP(const HTTPServer::Request& req);
void setURL(const std::string& url) {
_url = url;
}
@@ -83,7 +85,7 @@ public:
protected:
std::string _url;
- std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
+ std::map<std::string, std::pair<URL, Event> > _sendRequests;
};
// do not implement pluma plugins if we build an inherited plugin
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp
deleted file mode 100644
index 9ec5c00..0000000
--- a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <uscxml/Common.h>
-#include "uscxml/plugins/ioprocessor/comet/CometIOProcessor.h"
-#include "uscxml/Message.h"
-#include <iostream>
-
-#include <DOM/io/Stream.hpp>
-#include <string.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new CometIOProcessorProvider() );
- return true;
-}
-#endif
-
-CometIOProcessor::CometIOProcessor() {
-}
-
-CometIOProcessor::~CometIOProcessor() {
- HTTPServer::unregisterServlet(this);
-}
-
-boost::shared_ptr<IOProcessorImpl> CometIOProcessor::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<CometIOProcessor> io = boost::shared_ptr<CometIOProcessor>(new CometIOProcessor());
- io->_interpreter = interpreter;
-
- // register at http server
- std::string path = interpreter->getName();
- int i = 2;
- while (!HTTPServer::registerServlet(path + "/comet", io.get())) {
- std::stringstream ss;
- ss << interpreter->getName() << i++;
- path = ss.str();
- }
-
- return io;
-}
-
-Data CometIOProcessor::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void CometIOProcessor::send(const SendRequest& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- if (!_longPollingReq) {
- _outQueue.push_back(req);
- return;
- }
- reply(req, _longPollingReq);
-}
-
-void CometIOProcessor::reply(const SendRequest& req, const HTTPServer::Request& longPoll) {
- HTTPServer::Reply reply(longPoll);
-
- if (req.dom) {
- std::stringstream ss;
- ss << req.dom;
- reply.content = ss.str();
- reply.headers["Content-Type"] = "application/xml";
- } else if (!req.data.empty()) {
- reply.content = Data::toJSON(req.data);
- reply.headers["Content-Type"] = "application/json";
- } else if (req.content.length() > 0) {
- reply.content = req.content;
- reply.headers["Content-Type"] = "text/plain";
- }
-
- if (req.params.find("Content-Type") != req.params.end())
- reply.headers["Content-Type"] = req.params.find("Content-Type")->first;
-
- HTTPServer::reply(reply);
-}
-
-bool CometIOProcessor::httpRecvRequest(const HTTPServer::Request& request) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- if (_longPollingReq)
- // send 204 to last request and remember new one
- evhttp_send_error(_longPollingReq.evhttpReq, 204, NULL);
- _longPollingReq = request;
- if (!_outQueue.empty()) {
- send(_outQueue.front());
- _outQueue.pop_front();
- }
- return true;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
deleted file mode 100644
index 0a57d70..0000000
--- a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef COMETIOPROCESSOR_H_2CUY93KU
-#define COMETIOPROCESSOR_H_2CUY93KU
-
-#include "uscxml/concurrency/DelayedEventQueue.h"
-#include "uscxml/server/HTTPServer.h"
-#include "uscxml/Interpreter.h"
-#include "uscxml/Factory.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class CometIOProcessor : public IOProcessorImpl, public HTTPServlet {
-public:
- CometIOProcessor();
- virtual ~CometIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("comet");
- names.push_back("http://www.w3.org/TR/scxml/#CometEventProcessor");
- return names;
- }
-
- /// This method can be overridden for specific replies
- virtual void reply(const SendRequest& req, const HTTPServer::Request& longPoll);
-
- virtual void send(const SendRequest& req);
- Data getDataModelVariables();
-
- virtual bool httpRecvRequest(const HTTPServer::Request& request);
- virtual void setURL(const std::string& url) {
- _url = url;
- }
-
-protected:
- tthread::recursive_mutex _mutex;
- std::string _url;
- std::deque<SendRequest> _outQueue;
- HTTPServer::Request _longPollingReq;
-
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(CometIOProcessor, IOProcessorImpl);
-#endif
-
-}
-
-#endif /* end of include guard: COMETIOPROCESSOR_H_2CUY93KU */ \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp
deleted file mode 100644
index 1a3417a..0000000
--- a/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
diff --git a/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h b/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h
deleted file mode 100644
index 1a3417a..0000000
--- a/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
deleted file mode 100644
index 15c05c0..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h"
-#include "uscxml/Message.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new MMIHTTPIOProcessorProvider() );
- return true;
-}
-#endif
-
-MMIHTTPIOProcessor::MMIHTTPIOProcessor() {
-}
-
-MMIHTTPIOProcessor::~MMIHTTPIOProcessor() {
-}
-
-boost::shared_ptr<IOProcessorImpl> MMIHTTPIOProcessor::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<MMIHTTPIOProcessor> io = boost::shared_ptr<MMIHTTPIOProcessor>(new MMIHTTPIOProcessor());
- io->_interpreter = interpreter;
-
- // register at http server
- std::string path = interpreter->getName();
- int i = 2;
- while (!HTTPServer::registerServlet(path + "/mmihttp", io.get())) {
- std::stringstream ss;
- ss << interpreter->getName() << i++;
- path = ss.str();
- }
-
- return io;
-}
-
-bool MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
- Event reqEvent = req;
- reqEvent.eventType = Event::EXTERNAL;
- bool scxmlStructFound = false;
-
- if (reqEvent.data.compound["header"].compound.find("Content-Type") != reqEvent.data.compound["header"].compound.end() &&
- boost::iequals(reqEvent.data.compound["header"].compound["Content-Type"].atom, "application/x-www-form-urlencoded")) {
- std::stringstream ss(reqEvent.data.compound["content"].atom);
- std::string term;
- while(std::getline(ss, term, '&')) {
- size_t split = term.find_first_of("=");
- if (split != std::string::npos) {
- std::string key = evhttp_decode_uri(term.substr(0, split).c_str());
- std::string value = evhttp_decode_uri(term.substr(split + 1).c_str());
- if (boost::iequals(key, "_scxmleventname")) {
- reqEvent.name = value;
- } else if (boost::iequals(key, "content")) {
- reqEvent.initContent(value);
- } else {
- reqEvent.data.compound[key] = value;
- reqEvent.params.insert(std::make_pair(key, value));
- }
- } else {
- // this is most likely wrong
- reqEvent.content = evhttp_decode_uri(term.c_str());
- }
- }
- } else {
- if (reqEvent.data.compound["header"].compound.find("_scxmleventstruct") != reqEvent.data.compound["header"].compound.end()) {
- // TODO: this looses all other information
- reqEvent = Event::fromXML(evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventstruct"].atom.c_str()));
- scxmlStructFound = true;
- }
- if (reqEvent.data.compound["header"].compound.find("_scxmleventname") != reqEvent.data.compound["header"].compound.end()) {
- reqEvent.name = evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventname"].atom.c_str());
- }
- }
- std::map<std::string, Data>::iterator headerIter = reqEvent.data.compound["header"].compound.begin();
- while(headerIter != reqEvent.data.compound["header"].compound.end()) {
- reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.atom.c_str()), Data::VERBATIM);
- headerIter++;
- }
-
-#if 0
- 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++;
- }
-#endif
-
- /// test532
- if (reqEvent.name.length() == 0)
- reqEvent.name = "http." + req.data.compound.at("type").atom;
-
- if (!scxmlStructFound) {
- // get content into event
- reqEvent.data.compound["content"] = Data(req.content, Data::VERBATIM);
- }
-
- returnEvent(reqEvent);
- evhttp_send_reply(req.curlReq, 200, "OK", NULL);
- return true;
-}
-
-void MMIHTTPIOProcessor::send(const SendRequest& req) {
-
- if (req.target.length() == 0) {
- _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM));
- return;
- }
-
- bool isLocal = false;
- std::string target;
- if (!boost::equals(req.target, _url)) {
- target = req.target;
- } else {
- isLocal = true;
- target = _url;
- }
- URL targetURL(target);
- std::stringstream kvps;
- std::string kvpSeperator;
-
- // event name
- if (req.name.size() > 0) {
- kvps << kvpSeperator << evhttp_encode_uri("_scxmleventname") << "=" << evhttp_encode_uri(req.name.c_str());
- kvpSeperator = "&";
-// targetURL.addOutHeader("_scxmleventname", evhttp_encode_uri(req.name.c_str()));
- }
-
- // event namelist
- if (req.namelist.size() > 0) {
- std::map<std::string, Data>::const_iterator namelistIter = req.namelist.begin();
- while (namelistIter != req.namelist.end()) {
- // this is simplified - Data might be more elaborate than a simple string atom
- kvps << kvpSeperator << evhttp_encode_uri(namelistIter->first.c_str()) << "=" << evhttp_encode_uri(namelistIter->second.atom.c_str());
- kvpSeperator = "&";
-// targetURL.addOutHeader(namelistIter->first, namelistIter->second);
- namelistIter++;
- }
- }
-
- // event params
- if (req.params.size() > 0) {
- std::multimap<std::string, Data>::const_iterator paramIter = req.params.begin();
- while (paramIter != req.params.end()) {
- // this is simplified - Data might be more elaborate than a simple string atom
- kvps << kvpSeperator << evhttp_encode_uri(paramIter->first.c_str()) << "=" << evhttp_encode_uri(paramIter->second.atom.c_str());
- kvpSeperator = "&";
-// targetURL.addOutHeader(paramIter->first, paramIter->second);
- paramIter++;
- }
- }
-
- // content
-
- if (req.content.size() > 0) {
- kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
- kvpSeperator = "&";
- }
- if (req.dom) {
- std::stringstream xmlStream;
- xmlStream << req.dom;
- kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(xmlStream.str().c_str());
- kvpSeperator = "&";
- }
- targetURL.setOutContent(kvps.str());
-
- targetURL.setRequestType("post");
- targetURL.addMonitor(this);
-
- _sendRequests[req.sendid] = std::make_pair(targetURL, req);
- if (isLocal) {
- // test201 use a blocking request with local communication
- targetURL.download(true);
- } else {
- URLFetcher::fetchURL(targetURL);
- }
-}
-
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
deleted file mode 100644
index 00b47c7..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef MMIHTTPIOPROCESSOR_H_P1FN0YPL
-#define MMIHTTPIOPROCESSOR_H_P1FN0YPL
-
-#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
-#include "uscxml/Interpreter.h"
-#include "uscxml/Factory.h"
-#ifndef _WIN32
-#include <sys/time.h>
-#endif
-
-#include <event2/http.h>
-#include <event2/http_struct.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class MMIHTTPIOProcessor : public BasicHTTPIOProcessor {
-public:
- MMIHTTPIOProcessor();
- virtual ~MMIHTTPIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("mmihttp");
- names.push_back("http://www.w3.org/TR/mmi-arch/#HTTPTransport");
- return names;
- }
-
- virtual void send(const SendRequest& req);
-
- /// HTTPServlet
- bool httpRecvRequest(const HTTPServer::Request& req);
-
- bool canAdaptPath() {
- return false;
- }
-
-protected:
- std::string _url;
- std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(MMIHTTPIOProcessor, IOProcessorImpl);
-#endif
-
-}
-
-#endif /* end of include guard: MMIHTTPIOPROCESSOR_H_P1FN0YPL */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
deleted file mode 100644
index c649a17..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "MMIProtoBridge.h"
-
-#define INIT_PROTO_LIFE_CYCLE_EVENT(type) \
-::LifeCycleEvent lifeCycleEvent; \
-lifeCycleEvent.set_type(type); \
-lifeCycleEvent.set_requestid(mmiEvent.requestId); \
-lifeCycleEvent.set_source(mmiEvent.source); \
-lifeCycleEvent.set_target(mmiEvent.target);
-
-namespace uscxml {
-
-::LifeCycleEvent MMIProtoBridge::toProto(const NewContextRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_NEW_CONTEXT_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const NewContextResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_NEW_CONTEXT_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const PrepareRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PREPARE_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const PrepareResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PREPARE_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const StartRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_START_REQUEST);
-
- ::LifeCycleRequest* lifeCycleRequest = lifeCycleEvent.MutableExtension(::LifeCycleRequest::Request);
- lifeCycleRequest->set_context(mmiEvent.context);
-
- ::StartRequest* startRequest = lifeCycleRequest->MutableExtension(::StartRequest::Request);
- startRequest->set_content(mmiEvent.content);
- startRequest->set_contenturl(mmiEvent.contentURL.href);
-
- ::StartRequestData* startRequestData = startRequest->MutableExtension(::StartRequestData::Request);
- startRequestData->set_data(mmiEvent.data);
-
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const StartResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_START_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const DoneNotification& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_DONE_NOTIFICATION);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const CancelRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CANCEL_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const CancelResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CANCEL_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const PauseRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PAUSE_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const PauseResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PAUSE_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const ResumeRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_RESUME_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const ResumeResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_RESUME_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const ExtensionNotification& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_EXTENSION_NOTIFICATION);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const ClearContextRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CLEAR_CONTEXT_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const ClearContextResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CLEAR_CONTEXT_RESPONSE);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const StatusRequest& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_STATUS_REQUEST);
- return lifeCycleEvent;
-}
-
-::LifeCycleEvent MMIProtoBridge::toProto(const StatusResponse& mmiEvent) {
- INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_STATUS_RESPONSE);
- return lifeCycleEvent;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
deleted file mode 100644
index 60ba824..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef MMIPROTOBRIDGE_H_T6VXUX69
-#define MMIPROTOBRIDGE_H_T6VXUX69
-
-#include "LifeCycleEvents.pb.h"
-#include "StringDataExtension.pb.h"
-#include "MMIMessages.h"
-
-namespace uscxml {
-
-class MMIProtoBridge {
-public:
- static ::LifeCycleEvent toProto(const NewContextRequest&);
- static ::LifeCycleEvent toProto(const NewContextResponse&);
- static ::LifeCycleEvent toProto(const PrepareRequest&);
- static ::LifeCycleEvent toProto(const PrepareResponse&);
- static ::LifeCycleEvent toProto(const StartRequest&);
- static ::LifeCycleEvent toProto(const StartResponse&);
- static ::LifeCycleEvent toProto(const DoneNotification&);
- static ::LifeCycleEvent toProto(const CancelRequest&);
- static ::LifeCycleEvent toProto(const CancelResponse&);
- static ::LifeCycleEvent toProto(const PauseRequest&);
- static ::LifeCycleEvent toProto(const PauseResponse&);
- static ::LifeCycleEvent toProto(const ResumeRequest&);
- static ::LifeCycleEvent toProto(const ResumeResponse&);
- static ::LifeCycleEvent toProto(const ExtensionNotification&);
- static ::LifeCycleEvent toProto(const ClearContextRequest&);
- static ::LifeCycleEvent toProto(const ClearContextResponse&);
- static ::LifeCycleEvent toProto(const StatusRequest&);
- static ::LifeCycleEvent toProto(const StatusResponse&);
-};
-
-}
-
-#endif /* end of include guard: MMIPROTOBRIDGE_H_T6VXUX69 */
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp
deleted file mode 100644
index bca2344..0000000
--- a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h"
-#include "uscxml/Message.h"
-#include <iostream>
-
-#include <string.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SampleIOProcessorProvider() );
- return true;
-}
-#endif
-
-SampleIOProcessor::SampleIOProcessor() {
-}
-
-SampleIOProcessor::~SampleIOProcessor() {
-}
-
-boost::shared_ptr<IOProcessorImpl> SampleIOProcessor::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<SampleIOProcessor> io = boost::shared_ptr<SampleIOProcessor>(new SampleIOProcessor());
- return io;
-}
-
-Data SampleIOProcessor::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void SampleIOProcessor::send(const SendRequest& req) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
deleted file mode 100644
index 05dd3ef..0000000
--- a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SAMPLEIOPROCESSOR_H_2CUY93KU
-#define SAMPLEIOPROCESSOR_H_2CUY93KU
-
-#include "uscxml/Factory.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-#if defined(_WIN32) && !defined(USCXML_STATIC)
-# if (defined ioprocessor_sample_EXPORTS || defined USCXML_EXPORT)
-# define USCXML_PLUGIN_API __declspec(dllexport)
-# else
-# define USCXML_PLUGIN_API __declspec(dllimport)
-# endif
-#else
-# define USCXML_PLUGIN_API
-#endif
-
-namespace uscxml {
-
-class USCXML_PLUGIN_API SampleIOProcessor : public IOProcessorImpl {
-public:
- SampleIOProcessor();
- virtual ~SampleIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("sample");
- names.push_back("http://www.w3.org/TR/scxml/#SampleEventProcessor");
- return names;
- }
-
- virtual void send(const SendRequest& req);
- Data getDataModelVariables();
-
-protected:
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(SampleIOProcessor, IOProcessorImpl);
-#endif
-
-}
-
-#endif /* end of include guard: SAMPLEIOPROCESSOR_H_2CUY93KU */ \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
index 6905e22..c53915b 100644
--- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
@@ -17,88 +17,64 @@
* @endcond
*/
-#include <boost/algorithm/string.hpp>
-#ifdef _WIN32
-#define NOMINMAX
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
-#include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h"
-#include "uscxml/Message.h"
-#include <iostream>
-#include <event2/dns.h>
-#include <event2/buffer.h>
-#include <event2/keyvalq_struct.h>
+#include "SCXMLIOProcessor.h"
+#include "uscxml/messages/Event.h"
+#include "uscxml/interpreter/InterpreterImpl.h"
#include <string.h>
-#include <io/uri.hpp>
-#include <glog/logging.h>
#ifndef _WIN32
#include <netdb.h>
#include <arpa/inet.h>
#endif
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
namespace uscxml {
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new SCXMLIOProcessorProvider() );
- return true;
-}
-#endif
-
// see http://www.w3.org/TR/scxml/#SCXMLEventProcessor
SCXMLIOProcessor::SCXMLIOProcessor() {
}
SCXMLIOProcessor::~SCXMLIOProcessor() {
- HTTPServer::unregisterServlet(this);
}
-boost::shared_ptr<IOProcessorImpl> SCXMLIOProcessor::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<SCXMLIOProcessor> io = boost::shared_ptr<SCXMLIOProcessor>(new SCXMLIOProcessor());
+std::shared_ptr<IOProcessorImpl> SCXMLIOProcessor::create(InterpreterImpl* interpreter) {
+ std::shared_ptr<SCXMLIOProcessor> io(new SCXMLIOProcessor());
io->_interpreter = interpreter;
-
- // register at http server
- std::string path = interpreter->getName();
- int i = 2;
- while (!HTTPServer::registerServlet(path + "/scxml", io.get())) {
- std::stringstream ss;
- ss << interpreter->getName() << i++;
- path = ss.str();
- }
return io;
}
Data SCXMLIOProcessor::getDataModelVariables() {
Data data;
- if(_url.length() > 0)
- data.compound["location"] = Data(_url, Data::VERBATIM);
+
+ data.compound["location"] = Data("#_scxml_" + _interpreter->getSessionId(), Data::VERBATIM);
+
return data;
}
+bool SCXMLIOProcessor::isValidTarget(const std::string& target) {
+ if (target.size() > 0 && (target[0] != '#' || target[1] != '_')) {
+ ERROR_EXECUTION_THROW("Target '" + target + "' not supported in send");
+ }
+ return true;
+}
+
-void SCXMLIOProcessor::send(const SendRequest& req) {
+void SCXMLIOProcessor::eventFromSCXML(const std::string& target, const Event& event) {
// see http://www.w3.org/TR/scxml/#SendTargets
+ Event eventCopy(event);
- SendRequest reqCopy(req);
- // test 253
- reqCopy.origintype = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor";
- reqCopy.origin = _url;
+ // test 253 / 198 / 336
+ eventCopy.origintype = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor";
+
+ // test 336
+ eventCopy.origin = "#_scxml_" + _interpreter->getSessionId();
if (false) {
- } else if(reqCopy.target.length() == 0) {
+ } else if(target.length() == 0) {
/**
* If neither the 'target' nor the 'targetexpr' attribute is specified, the
* SCXML Processor must add the event will be added to the external event
@@ -107,16 +83,31 @@ void SCXMLIOProcessor::send(const SendRequest& req) {
// test333 vs test351
// reqCopy.sendid = "";
+
// test 198
- _interpreter->receive(reqCopy);
- } else if (iequals(reqCopy.target, "#_internal")) {
+ _interpreter->enqueueExternal(eventCopy);
+
+ } else if (iequals(target, "#_internal")) {
/**
* #_internal: If the target is the special term '#_internal', the Processor
* must add the event to the internal event queue of the sending session.
*/
- _interpreter->receiveInternal(reqCopy);
+ _interpreter->enqueueInternal(eventCopy);
- } else if(boost::starts_with(reqCopy.target, "#_scxml_")) {
+ } else if (iequals(target, "#_parent")) {
+ /**
+ * #_parent: If the target is the special term '#_parent', the Processor must
+ * add the event to the external event queue of the SCXML session that invoked
+ * the sending session, if there is one.
+ */
+
+ if (_interpreter->_parentQueue) {
+ _interpreter->_parentQueue.enqueue(eventCopy);
+ } else {
+ ERROR_COMMUNICATION_THROW("Sending to parent invoker, but none is set");
+ }
+
+ } else if (target.length() > 8 && iequals(target.substr(0, 8), "#_scxml_")) {
/**
* #_scxml_sessionid: If the target is the special term '#_scxml_sessionid',
* where sessionid is the id of an SCXML session that is accessible to the
@@ -124,66 +115,46 @@ void SCXMLIOProcessor::send(const SendRequest& req) {
* session. The set of SCXML sessions that are accessible to a given SCXML
* Processor is platform-dependent.
*/
- std::string sessionId = reqCopy.target.substr(8, reqCopy.target.length() - 8);
- std::map<std::string, boost::weak_ptr<InterpreterImpl> > instances = Interpreter::getInstances();
- if (instances.find(sessionId) != instances.end()) {
- boost::shared_ptr<InterpreterImpl> other = instances[sessionId].lock();
- other->receive(reqCopy);
- } else {
- ERROR_COMMUNICATION(error, "Can not send to scxml session " + sessionId + " - not known");
- error.sendid = reqCopy.sendid;
- _interpreter->receiveInternal(error);
+ std::string sessionId = target.substr(8);
- }
- } else if (iequals(reqCopy.target, "#_parent")) {
- /**
- * #_parent: If the target is the special term '#_parent', the Processor must
- * add the event to the external event queue of the SCXML session that invoked
- * the sending session, if there is one.
- */
- if (_interpreter->_parentQueue != NULL) {
- _interpreter->_parentQueue->push(reqCopy);
+ std::lock_guard<std::recursive_mutex> lock(_interpreter->_instanceMutex);
+ std::map<std::string, std::weak_ptr<InterpreterImpl> > instances = InterpreterImpl::getInstances();
+ if (instances.find(sessionId) != instances.end()) {
+ std::shared_ptr<InterpreterImpl> otherSession = instances[sessionId].lock();
+ if (otherSession) {
+ otherSession->enqueueExternal(eventCopy);
+ } else {
+ ERROR_COMMUNICATION_THROW("Can not send to scxml session " + sessionId + " - not known");
+ }
} else {
- ERROR_COMMUNICATION(error, "Can not send to parent, we were not invoked or no parent queue is set");
- error.sendid = reqCopy.sendid;
- _interpreter->receiveInternal(error);
+ ERROR_COMMUNICATION_THROW("Invalid target scxml session for send");
}
- } else if (boost::starts_with(reqCopy.target, "#_")) {
+
+ } else if (target.length() > 2 && iequals(target.substr(0, 2), "#_")) {
/**
* #_invokeid: If the target is the special term '#_invokeid', where invokeid
* is the invokeid of an SCXML session that the sending session has created
* by <invoke>, the Processor must add the event to the external queue of that
* session.
*/
- std::string invokeId = reqCopy.target.substr(2, reqCopy.target.length() - 2);
+ std::string invokeId = target.substr(2);
if (_interpreter->_invokers.find(invokeId) != _interpreter->_invokers.end()) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_interpreter->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_interpreter->_instanceMutex);
try {
- _interpreter->_invokers[invokeId].send(reqCopy);
+ _interpreter->_invokers[invokeId].eventFromSCXML(eventCopy);
} catch(Event e) {
// Is this the right thing to do?
- _interpreter->receive(e);
+// _interpreter->enqueueExternal(eventCopy);
} catch (const std::exception &e) {
- LOG(ERROR) << "Exception caught while sending event to invoker " << invokeId << ": " << e.what();
+ ERROR_COMMUNICATION_THROW("Exception caught while sending event to invoker '" + invokeId + "': " + e.what());
} catch(...) {
- LOG(ERROR) << "Exception caught while sending event to invoker " << invokeId;
+ ERROR_COMMUNICATION_THROW("Exception caught while sending event to invoker '" + invokeId + "'");
}
} else {
- ERROR_COMMUNICATION(error, "Can not send to invoked component '" + invokeId + "', no such invokeId");
- error.sendid = reqCopy.sendid;
- _interpreter->receiveInternal(error);
+ ERROR_COMMUNICATION_THROW("Can not send to invoked component '" + invokeId + "', no such invokeId");
}
} else {
- URL target(reqCopy.target);
- if (target.isAbsolute()) {
- BasicHTTPIOProcessor::send(reqCopy);
- } else {
- ERROR_EXECUTION(error, "Not sure what to make of the target '" + reqCopy.target + "' - raising error");
- error.sendid = reqCopy.sendid;
- // test 159 still fails
-// _interpreter->receiveInternal(error);
- throw error;
- }
+ ERROR_COMMUNICATION_THROW("Not sure what to make of the target '" + target + "' - raising error");
}
}
diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h
index 3eca2db..3b08e30 100644
--- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h
@@ -20,19 +20,15 @@
#ifndef SCXMLIOProcessor_H_2CUY93KU
#define SCXMLIOProcessor_H_2CUY93KU
-#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
+#include "uscxml/plugins/IOProcessor.h"
namespace uscxml {
-class SCXMLIOProcessor : public BasicHTTPIOProcessor {
+class SCXMLIOProcessor : public IOProcessorImpl {
public:
SCXMLIOProcessor();
virtual ~SCXMLIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+ virtual std::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
virtual std::list<std::string> getNames() {
std::list<std::string> names;
@@ -41,9 +37,12 @@ public:
return names;
}
- virtual void send(const SendRequest& req);
+ virtual void eventFromSCXML(const std::string& target, const Event& event);
+ virtual bool isValidTarget(const std::string& target);
Data getDataModelVariables();
+protected:
+ InterpreterImpl* _interpreter;
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 6f2347c..cb80ec4 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -25,9 +25,8 @@
#include <windows.h>
#endif
-#include "uscxml/server/HTTPServer.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/dom/NameSpacingParser.h"
+#include "HTTPServer.h"
+#include "uscxml/util/DOM.h"
#include <string>
#include <iostream>
@@ -41,7 +40,7 @@ extern "C" {
#include <event2/thread.h>
}
-#include <glog/logging.h>
+#include <easylogging++.h>
#include <boost/algorithm/string.hpp>
#ifndef _WIN32
@@ -53,16 +52,8 @@ extern "C" {
//#include <arpa/inet.h>
#endif
-#if (defined EVENT_SSL_FOUND && defined OPENSSL_FOUND && defined OPENSSL_HAS_ELIPTIC_CURVES)
-#include <openssl/ssl.h>
-#include <openssl/bio.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <event2/bufferevent_ssl.h>
-#endif
-#include "uscxml/Message.h"
-#include "uscxml/Convenience.h" // for toStr
+#include "uscxml/util/Convenience.h" // for toStr
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
@@ -100,9 +91,9 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss
evhttp_set_allowed_methods(_http, allowedMethods); // allow all methods
if (_port > 0) {
- _httpHandle = evhttp_bind_socket_with_handle(_http, INADDR_ANY, _port);
+ _httpHandle = evhttp_bind_socket_with_handle(_http, NULL, _port);
if (_httpHandle) {
- DLOG(INFO) << "HTTP server listening on tcp/" << _port;
+ LOG(INFO) << "HTTP server listening on tcp/" << _port;
} else {
LOG(ERROR) << "HTTP server cannot bind to tcp/" << _port;
}
@@ -112,7 +103,7 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss
if (_wsPort > 0) {
_wsHandle = evws_bind_socket(_evws, _wsPort);
if (_wsHandle) {
- DLOG(INFO) << "WebSocket server listening on tcp/" << _wsPort;
+ LOG(INFO) << "WebSocket server listening on tcp/" << _wsPort;
} else {
LOG(ERROR) << "WebSocket server cannot bind to tcp/" << _wsPort;
}
@@ -178,10 +169,10 @@ HTTPServer::~HTTPServer() {
}
HTTPServer* HTTPServer::_instance = NULL;
-tthread::recursive_mutex HTTPServer::_instanceMutex;
+std::recursive_mutex HTTPServer::_instanceMutex;
HTTPServer* HTTPServer::getInstance(unsigned short port, unsigned short wsPort, SSLConfig* sslConf) {
-// tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
+// std::lock_guard<std::recursive_mutex> lock(_instanceMutex);
if (_instance == NULL) {
#ifdef _WIN32
WSADATA wsaData;
@@ -247,7 +238,7 @@ void HTTPServer::wsRecvReqCallback(struct evws_connection *conn, struct evws_fra
// try with the handler registered for path first
bool answered = false;
if (callbackData != NULL)
- answered = ((WebSocketServlet*)callbackData)->wsRecvRequest(conn, wsFrame);
+ answered = ((WebSocketServlet*)callbackData)->requestFromWS(conn, wsFrame);
if (!answered)
HTTPServer::getInstance()->processByMatchingServlet(conn, wsFrame);
@@ -415,12 +406,13 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
request.data.compound["content"] = json;
}
} else if (iequals(contentType.substr(0, 15), "application/xml")) {
- NameSpacingParser parser = NameSpacingParser::fromXML(request.data.compound["content"].atom);
- if (parser.errorsReported()) {
- LOG(ERROR) << "Cannot parse contents of HTTP request as XML";
- } else {
- request.data.compound["content"].node = parser.getDocument().getDocumentElement();
- }
+ assert(0);
+// NameSpacingParser parser = NameSpacingParser::fromXML(request.data.compound["content"].atom);
+// if (parser.errorsReported()) {
+// LOG(ERROR) << "Cannot parse contents of HTTP request as XML";
+// } else {
+// request.data.compound["content"].node = parser.getDocument().getDocumentElement();
+// }
}
}
@@ -429,7 +421,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
// try with the handler registered for path first
bool answered = false;
if (callbackData != NULL)
- answered = ((HTTPServlet*)callbackData)->httpRecvRequest(request);
+ answered = ((HTTPServlet*)callbackData)->requestFromHTTP(request);
if (!answered)
HTTPServer::getInstance()->processByMatchingServlet(request);
@@ -437,7 +429,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
void HTTPServer::processByMatchingServlet(const Request& request) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
http_servlet_iter_t servletIter = _httpServlets.begin();
@@ -459,7 +451,7 @@ void HTTPServer::processByMatchingServlet(const Request& request) {
// process by best matching servlet until someone feels responsible
std::map<std::string, HTTPServlet*, comp_strsize_less>::iterator matchesIter = matches.begin();
while(matchesIter != matches.end()) {
- if (matchesIter->second->httpRecvRequest(request)) {
+ if (matchesIter->second->requestFromHTTP(request)) {
return;
}
matchesIter++;
@@ -470,7 +462,7 @@ void HTTPServer::processByMatchingServlet(const Request& request) {
}
void HTTPServer::processByMatchingServlet(evws_connection* conn, const WSFrame& frame) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
ws_servlet_iter_t servletIter = _wsServlets.begin();
@@ -490,7 +482,7 @@ void HTTPServer::processByMatchingServlet(evws_connection* conn, const WSFrame&
// process by best matching servlet until someone feels responsible
std::map<std::string, WebSocketServlet*, comp_strsize_less>::iterator matchesIter = matches.begin();
while(matchesIter != matches.end()) {
- if (matchesIter->second->wsRecvRequest(conn, frame)) {
+ if (matchesIter->second->requestFromWS(conn, frame)) {
return;
}
matchesIter++;
@@ -568,10 +560,11 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet)
HTTPServer* INSTANCE = getInstance();
if (!INSTANCE->_httpHandle) {
+ LOG(INFO) << "Registering at unstarted HTTP Server";
return true; // this is the culprit!
}
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(INSTANCE->_mutex);
// remove trailing and leading slash
std::string actualPath = path;
@@ -596,7 +589,7 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet)
servlet->setURL(servletURL.str());
INSTANCE->_httpServlets[suffixedPath] = servlet;
- DLOG(INFO) << "HTTP Servlet listening at: " << servletURL.str() << std::endl;
+// LOG(INFO) << "HTTP Servlet listening at: " << servletURL.str();
// register callback
evhttp_set_cb(INSTANCE->_http, ("/" + suffixedPath).c_str(), HTTPServer::httpRecvReqCallback, servlet);
@@ -606,7 +599,7 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet)
void HTTPServer::unregisterServlet(HTTPServlet* servlet) {
HTTPServer* INSTANCE = getInstance();
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(INSTANCE->_mutex);
http_servlet_iter_t servletIter = INSTANCE->_httpServlets.begin();
while(servletIter != INSTANCE->_httpServlets.end()) {
if (servletIter->second == servlet) {
@@ -624,7 +617,7 @@ bool HTTPServer::registerServlet(const std::string& path, WebSocketServlet* serv
if (!INSTANCE->_wsHandle)
return true;
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(INSTANCE->_mutex);
// remove trailing and leading slash
std::string actualPath = path;
@@ -660,7 +653,7 @@ bool HTTPServer::registerServlet(const std::string& path, WebSocketServlet* serv
void HTTPServer::unregisterServlet(WebSocketServlet* servlet) {
HTTPServer* INSTANCE = getInstance();
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(INSTANCE->_mutex);
ws_servlet_iter_t servletIter = INSTANCE->_wsServlets.begin();
while(servletIter != INSTANCE->_wsServlets.end()) {
if (servletIter->second == servlet) {
@@ -696,7 +689,7 @@ std::string HTTPServer::getBaseURL(ServerType type) {
void HTTPServer::start() {
_isRunning = true;
- _thread = new tthread::thread(HTTPServer::run, this);
+ _thread = new std::thread(HTTPServer::run, this);
}
void HTTPServer::run(void* instance) {
@@ -704,7 +697,7 @@ void HTTPServer::run(void* instance) {
while(INSTANCE->_isRunning) {
event_base_dispatch(INSTANCE->_base);
}
- LOG(INFO) << "HTTP Server stopped" << std::endl;
+ LOG(INFO) << "HTTP Server stopped";
}
void HTTPServer::determineAddress() {
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
index 7fedd83..a584360 100644
--- a/src/uscxml/server/HTTPServer.h
+++ b/src/uscxml/server/HTTPServer.h
@@ -24,6 +24,8 @@
#include <map> // for map, map<>::iterator, etc
#include <string> // for string, operator<
+#include <thread>
+#include <mutex>
extern "C" {
#include "event2/util.h" // for evutil_socket_t
@@ -32,8 +34,7 @@ extern "C" {
}
#include "uscxml/Common.h" // for USCXML_API
-#include "uscxml/Message.h" // for Data, Event
-#include "uscxml/concurrency/tinythread.h" // for recursive_mutex, etc
+#include "uscxml/messages/Event.h" // for Data, Event
#include "uscxml/config.h" // for OPENSSL_FOUND
namespace uscxml {
@@ -54,14 +55,7 @@ public:
}
};
- class WSFrame : public Event {
- public:
- WSFrame() : evwsConn(NULL) {}
- std::string content;
- struct evws_connection* evwsConn;
- };
-
- class SSLConfig {
+ class USCXML_API SSLConfig {
public:
SSLConfig() : port(8443) {}
std::string privateKey;
@@ -69,7 +63,14 @@ public:
unsigned short port;
};
- class Reply {
+ class WSFrame : public Event {
+ public:
+ WSFrame() : evwsConn(NULL) {}
+ std::string content;
+ struct evws_connection* evwsConn;
+ };
+
+ class USCXML_API Reply {
public:
Reply() : status(200), type("get"), evhttpReq(NULL) {}
Reply(Request req) : status(200), type(req.data.compound["type"].atom), evhttpReq(req.evhttpReq) {}
@@ -140,7 +141,7 @@ private:
};
};
- HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* sslConf = NULL);
+ HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* sslConf);
virtual ~HTTPServer();
void start();
@@ -178,9 +179,9 @@ private:
static HTTPServer* _instance;
- static tthread::recursive_mutex _instanceMutex;
- tthread::thread* _thread;
- tthread::recursive_mutex _mutex;
+ static std::recursive_mutex _instanceMutex;
+ std::thread* _thread;
+ std::recursive_mutex _mutex;
bool _isRunning;
friend class HTTPServlet;
@@ -199,7 +200,7 @@ private:
class USCXML_API HTTPServlet {
public:
virtual ~HTTPServlet() {}
- virtual bool httpRecvRequest(const HTTPServer::Request& request) = 0;
+ virtual bool requestFromHTTP(const HTTPServer::Request& request) = 0;
virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
virtual bool canAdaptPath() {
return true;
@@ -209,7 +210,7 @@ public:
class USCXML_API WebSocketServlet {
public:
virtual ~WebSocketServlet() {}
- virtual bool wsRecvRequest(struct evws_connection *conn, const HTTPServer::WSFrame& frame) = 0;
+ virtual bool requestFromWS(struct evws_connection *conn, const HTTPServer::WSFrame& frame) = 0;
virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
virtual bool canAdaptPath() {
return true;
diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp
deleted file mode 100644
index 285add9..0000000
--- a/src/uscxml/server/InterpreterServlet.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "InterpreterServlet.h"
-#include "uscxml/Interpreter.h"
-#include <glog/logging.h>
-#include <DOM/io/Stream.hpp>
-
-namespace uscxml {
-
-InterpreterHTTPServlet::~InterpreterHTTPServlet() {
- HTTPServer::unregisterServlet(this);
-}
-
-InterpreterHTTPServlet::InterpreterHTTPServlet(InterpreterImpl* interpreter) {
- _interpreter = interpreter;
-
- std::stringstream path;
- path << _interpreter->getName();
- int i = 2;
- while(!HTTPServer::registerServlet(path.str(), this)) {
- path.clear();
- path.str();
- path << _interpreter->getName() << i++;
- }
- _path = path.str();
-}
-
-boost::shared_ptr<IOProcessorImpl> InterpreterHTTPServlet::create(InterpreterImpl* interpreter) {
- // we instantiate directly in Interpreter
- boost::shared_ptr<IOProcessorImpl> io = boost::shared_ptr<InterpreterHTTPServlet>(new InterpreterHTTPServlet(interpreter));
- return io;
-}
-
-bool InterpreterHTTPServlet::httpRecvRequest(const HTTPServer::Request& req) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- // evhttp_request_own(req.curlReq);
-
- _requests[toStr((uintptr_t)req.evhttpReq)] = req;
-
- Event event = req;
-
- event.name = "http." + event.data.compound["type"].atom;
- event.origin = toStr((uintptr_t)req.evhttpReq);
-
- if (!event.data.compound["content"].empty()) {
- if (event.data.compound["content"].compound.size() > 0) {
- std::map<std::string, Data>::iterator compoundIter = event.data.compound["content"].compound.begin();
- while(compoundIter != event.data.compound["content"].compound.end()) {
-// std::cout << compoundIter->second.atom << std::endl;
- Data json = Data::fromJSON(compoundIter->second.atom);
- if (!json.empty()) {
-// std::cout << Data::toJSON(json) << std::endl;
- compoundIter->second = json;
- }
- compoundIter++;
- }
- }
- }
-
- _interpreter->receive(event);
- return true;
-}
-
-Data InterpreterHTTPServlet::getDataModelVariables() {
- Data data;
- if(_url.length() > 0)
- data.compound["location"] = Data(_url, Data::VERBATIM);
- return data;
-}
-
-void InterpreterHTTPServlet::send(const SendRequest& req) {
- LOG(ERROR) << "send not supported by http iorprocessor, use the fetch element";
-}
-
-InterpreterWebSocketServlet::~InterpreterWebSocketServlet() {
- HTTPServer::unregisterServlet(this);
-}
-
-InterpreterWebSocketServlet::InterpreterWebSocketServlet(InterpreterImpl* interpreter) {
- _interpreter = interpreter;
-
- std::stringstream path;
- path << _interpreter->getName();
- int i = 2;
- while(!HTTPServer::registerServlet(path.str(), this)) {
- path.clear();
- path.str();
- path << _interpreter->getName() << i++;
- }
- _path = path.str();
-}
-
-boost::shared_ptr<IOProcessorImpl> InterpreterWebSocketServlet::create(InterpreterImpl* interpreter) {
- // we instantiate directly in Interpreter
- boost::shared_ptr<IOProcessorImpl> io = boost::shared_ptr<InterpreterWebSocketServlet>(new InterpreterWebSocketServlet(interpreter));
- return io;
-}
-
-bool InterpreterWebSocketServlet::wsRecvRequest(struct evws_connection *conn, const HTTPServer::WSFrame& frame) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- // evhttp_request_own(req.curlReq);
-
- _requests[toStr((uintptr_t)conn)] = conn;
-
- Event event = frame;
-
- event.name = "ws." + event.data.compound["type"].atom;
- event.origin = toStr((uintptr_t)conn);
-
- if (event.data.compound["type"].atom.compare("text") == 0 && !event.data.compound["content"].empty()) {
- if (event.data.compound["content"].compound.size() > 0) {
- std::map<std::string, Data>::iterator compoundIter = event.data.compound["content"].compound.begin();
- while(compoundIter != event.data.compound["content"].compound.end()) {
- Data json = Data::fromJSON(compoundIter->second.atom);
- if (!json.empty()) {
- compoundIter->second = json;
- }
- compoundIter++;
- }
- }
- }
-
- _interpreter->receive(event);
- return true;
-}
-
-Data InterpreterWebSocketServlet::getDataModelVariables() {
- Data data;
- if(_url.length() > 0)
- data.compound["location"] = Data(_url, Data::VERBATIM);
- return data;
-}
-
-void InterpreterWebSocketServlet::send(const SendRequest& req) {
-
- if (req.data.empty()) {
- LOG(WARNING) << "No content given to send on websocket!";
- return;
- }
-
- if (_requests.find(req.target) != _requests.end()) {
- // send data to the given connection
- if (false) {
- } else if (req.data.binary) {
- HTTPServer::wsSend(_requests[req.target],
- EVWS_BINARY_FRAME,
- req.data.binary.getData(),
- req.data.binary.getSize());
- } else if (req.data.node) {
- std::stringstream ssXML;
- ssXML << req.data.node;
- std::string data = ssXML.str();
- HTTPServer::wsSend(_requests[req.target],
- EVWS_TEXT_FRAME,
- data.c_str(),
- data.length());
- } else if (!req.data.empty()) {
- std::string data = Data::toJSON(req.data);
- HTTPServer::wsSend(_requests[req.target],
- EVWS_TEXT_FRAME,
- data.c_str(),
- data.length());
- } else {
- LOG(WARNING) << "Not sure what to make off content given to send on websocket!";
- }
- } else if(req.target.size() && req.target.compare(0, 1, "/") == 0) {
- // broadcast to the given path
- if (false) {
- } else if (req.data.binary) {
- HTTPServer::wsBroadcast(req.target.c_str(),
- EVWS_BINARY_FRAME,
- req.data.binary.getData(),
- req.data.binary.getSize());
- } else if (req.data.node) {
- std::stringstream ssXML;
- ssXML << req.data.node;
- std::string data = ssXML.str();
- HTTPServer::wsBroadcast(req.target.c_str(),
- EVWS_TEXT_FRAME,
- data.c_str(),
- data.length());
- } else if (!req.data.empty()) {
- std::string data = Data::toJSON(req.data);
- HTTPServer::wsBroadcast(req.target.c_str(),
- EVWS_TEXT_FRAME,
- data.c_str(),
- data.length());
- } else {
- LOG(WARNING) << "Not sure what to make off content given to broadcast on websocket!";
- }
- } else {
- LOG(WARNING) << "Invalid target for websocket";
- }
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h
deleted file mode 100644
index 436574b..0000000
--- a/src/uscxml/server/InterpreterServlet.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef INTERPRETERSERVLET_H_XQLWNMH4
-#define INTERPRETERSERVLET_H_XQLWNMH4
-
-#include "HTTPServer.h"
-#include "uscxml/messages/SendRequest.h" // for SendRequest
-#include "uscxml/plugins/IOProcessor.h" // for IOProcessorImpl
-
-namespace uscxml {
-
-class InterpreterImpl;
-
-class InterpreterHTTPServlet : public HTTPServlet, public IOProcessorImpl {
-public:
- InterpreterHTTPServlet() {};
- InterpreterHTTPServlet(InterpreterImpl* interpreter);
- virtual ~InterpreterHTTPServlet();
-
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("http");
- names.push_back("http://www.w3.org/TR/scxml/#HTTPEventProcessor");
- return names;
- }
-
- Data getDataModelVariables();
- virtual void send(const SendRequest& req);
-
- virtual bool httpRecvRequest(const HTTPServer::Request& req);
-
- std::string getPath() {
- return _path;
- }
- std::string getURL() {
- return _url;
- }
- void setURL(const std::string& url) {
- _url = url;
- }
- bool canAdaptPath() {
- return false;
- }
-
-
- std::map<std::string, HTTPServer::Request>& getRequests() {
- return _requests;
- }
- tthread::recursive_mutex& getMutex() {
- return _mutex;
- }
-
-protected:
- InterpreterImpl* _interpreter;
-
- tthread::recursive_mutex _mutex;
- std::map<std::string, HTTPServer::Request> _requests;
- std::string _path;
- std::string _url;
-
-};
-
-class InterpreterWebSocketServlet : public WebSocketServlet, public IOProcessorImpl {
-public:
- InterpreterWebSocketServlet() {};
- InterpreterWebSocketServlet(InterpreterImpl* interpreter);
- virtual ~InterpreterWebSocketServlet();
-
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("websocket");
- names.push_back("http://www.w3.org/TR/scxml/#WebSocketEventProcessor");
- return names;
- }
-
- Data getDataModelVariables();
- virtual void send(const SendRequest& req);
-
- virtual bool wsRecvRequest(struct evws_connection *conn, const HTTPServer::WSFrame& frame);
-
- std::string getPath() {
- return _path;
- }
- std::string getURL() {
- return _url;
- }
- void setURL(const std::string& url) {
- _url = url;
- }
- bool canAdaptPath() {
- return false;
- }
-
- std::map<std::string, struct evws_connection*>& getRequests() {
- return _requests;
- }
- tthread::recursive_mutex& getMutex() {
- return _mutex;
- }
-
-protected:
- InterpreterImpl* _interpreter;
-
- tthread::recursive_mutex _mutex;
- std::map<std::string, struct evws_connection*> _requests;
- std::string _path;
- std::string _url;
-
-};
-
-}
-
-
-#endif /* end of include guard: INTERPRETERSERVLET_H_XQLWNMH4 */
diff --git a/src/uscxml/server/Socket.cpp b/src/uscxml/server/Socket.cpp
deleted file mode 100644
index 35b416e..0000000
--- a/src/uscxml/server/Socket.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "Socket.h"
-
-#include "uscxml/Common.h" // for Data, Event
-#include "uscxml/Message.h" // for Data, Event
-#include "uscxml/config.h" // for OPENSSL_FOUND
-
-#ifndef _WIN32
-#include <sys/socket.h> /* For socket functions */
-#include <arpa/inet.h> // inet_addr
-#endif
-
-#include <fcntl.h> /* For fcntl */
-#include <iostream>
-
-namespace uscxml {
-
-// see: http://codepad.org/XRJAVg5m
-Socket::Socket(int domain, int type, int protocol) {
-
- _base = EventBase::get("sockets");
- _blockSizeRead = 1024;
-
- if (!_base)
- throw std::runtime_error("Cannot get eventbase");
-
- _sin.sin_family = domain;
- _socketFD = socket(domain, type, protocol);
-
- if (_socketFD == -1)
- throw std::runtime_error(std::string("socket: ") + strerror(errno));
-
-}
-
-Socket::~Socket() {
- if (_socketFD > 0)
-#ifdef WIN32
- closesocket(_socketFD);
-#else
- close(_socketFD);
-#endif
-}
-
-void Socket::setupSockAddr(const std::string& address, int port) {
-
- if (address == "*") {
- _sin.sin_addr.s_addr = 0;
- } else {
- struct hostent *he = NULL;
- if ( (he = gethostbyname(address.c_str()) ) != NULL ) {
- memcpy(&_sin.sin_addr, he->h_addr_list[0], he->h_length);
- } else {
- _sin.sin_addr.s_addr = inet_addr(address.c_str());
- }
- if (_sin.sin_addr.s_addr == INADDR_NONE)
- throw std::runtime_error(std::string("inet_addr: ") + strerror(errno));
- }
-
- _sin.sin_port = htons(port);
-}
-
-void Socket::setBlockSizeRead(size_t size) {
-// tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- _blockSizeRead = size;
-}
-
-void Socket::parseAddress(const std::string& address, std::string& protocol, std::string& hostName, uint16_t& port) {
- // tcp://hostname:port
- size_t protEnd = address.find("://");
- if (protEnd != std::string::npos) {
- protocol = address.substr(0, protEnd);
- protEnd += 3;
- } else {
- protocol = "tcp";
- protEnd = 0;
- }
-
- size_t hostEnd = address.find(":", protEnd);
- if (hostEnd != std::string::npos) {
- hostName = address.substr(protEnd, hostEnd - protEnd);
- hostEnd += 1;
- } else {
- hostName = "127.0.0.1";
- hostEnd = protEnd;
- }
-
- if (hostEnd < address.size()) {
- port = strTo<uint16_t>(address.substr(hostEnd));
- } else {
- port = 0;
- }
-}
-
-
-ClientSocket::ClientSocket(int domain, int type, int protocol) : Socket(domain, type, protocol), _clientEvent(NULL) {
-}
-
-
-ClientSocket::~ClientSocket() {
- if (_clientEvent) {
- bufferevent_enable(_clientEvent, 0);
- bufferevent_free(_clientEvent);
- }
-}
-
-void ClientSocket::errorCallback(struct bufferevent *bev, short error, void *ctx) {
-// ClientSocket* instance = (ClientSocket*)ctx;
- // tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
-
- if (error & BEV_EVENT_READING) {
- std::cout << "ClientSocket: error encountered while reading" << std::endl;
- } else if (error & BEV_EVENT_WRITING) {
- std::cout << "ClientSocket: error encountered while writing" << std::endl;
- } else if (error & BEV_EVENT_EOF) {
- std::cout << "ClientSocket: eof file reached" << std::endl;
- } else if (error & BEV_EVENT_ERROR) {
- std::cout << "ClientSocket: unrecoverable error encountered" << std::endl;
- } else if (error & BEV_EVENT_TIMEOUT) {
- std::cout << "ClientSocket: user-specified timeout reached" << std::endl;
- } else if (error & BEV_EVENT_CONNECTED) {
- std::cout << "ClientSocket: connect operation finished" << std::endl;
- }
-
- // bufferevent_free(bev);
-}
-
-void ClientSocket::connect(const std::string& address) {
- std::string _prot;
- std::string _address;
- uint16_t _port;
- parseAddress(address, _prot, _address, _port);
- connect(_address, _port);
-}
-
-void ClientSocket::connect(const std::string& address, int port) {
-// tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- setupSockAddr(address, port);
- if(::connect(_socketFD, (struct sockaddr *)&_sin, sizeof _sin) != 0) {
- throw std::runtime_error(std::string("connect: ") + strerror(errno));
- }
-
- _clientEvent = bufferevent_socket_new(_base->base, _socketFD, BEV_OPT_THREADSAFE); //BEV_OPT_THREADSAFE);
- bufferevent_setcb(_clientEvent, ClientSocket::readCallback, NULL, ClientSocket::errorCallback, this);
- bufferevent_enable(_clientEvent, EV_READ|EV_WRITE);
-}
-
-int ClientSocket::write(const std::string& data) {
- return write(data.data(), data.size());
-}
-
-int ClientSocket::write(const char* data, size_t size) {
-// tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- bufferevent_write(_clientEvent, data, size);
- return size;
-}
-
-void ClientSocket::readCallback(struct bufferevent *bev, void *ctx) {
- ClientSocket* instance = (ClientSocket*)ctx;
-// tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
-
- int n;
- struct evbuffer* input;
- char* data = (char*)malloc(instance->_blockSizeRead);
-
- input = bufferevent_get_input(bev);
-
- while((n = evbuffer_remove(input, data, instance->_blockSizeRead)) > 0) {
- instance->readCallback(data, n);
- }
- free(data);
-}
-
-std::set<ServerSocket*> ServerSocket::_instances;
-
-ServerSocket::ServerSocket(int domain, int type, int protocol) : Socket(domain, type, protocol), _listenerEvent(NULL) {
- _instances.insert(this);
-}
-
-ServerSocket::~ServerSocket() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- std::map<struct bufferevent*, Connection>::iterator connIter = _connections.begin();
- while(connIter != _connections.end()) {
- bufferevent_enable(connIter->second.bufferEvent, 0);
- bufferevent_setcb(connIter->second.bufferEvent, NULL, NULL, NULL, 0);
-
- bufferevent_free(connIter->second.bufferEvent);
-#ifdef WIN32
- closesocket(connIter->second.fd);
-#else
- close(connIter->second.fd);
-#endif
-
- connIter++;
- }
-
- if (_listenerEvent) {
- event_del(_listenerEvent);
- event_free(_listenerEvent);
- }
-
- _instances.erase(this);
-
-}
-
-void ServerSocket::errorCallback(struct bufferevent *bev, short error, void *ctx) {
- ServerSocket* instance = (ServerSocket*)ctx;
- tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
-
- if (_instances.find(instance) == _instances.end())
- return;
-
- if (error & BEV_EVENT_READING || error & BEV_EVENT_WRITING) {
- // remote end close the connection
- tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
- std::map<struct bufferevent*, Connection>::iterator conn = instance->_connections.find(bev);
- if (conn != instance->_connections.end()) {
- bufferevent_enable(conn->second.bufferEvent, 0);
- bufferevent_free(conn->second.bufferEvent);
-#ifdef WIN32
- closesocket(conn->second.fd);
-#else
- close(conn->second.fd);
-#endif
- instance->_connections.erase(conn);
- }
- } else if (error & BEV_EVENT_EOF) {
- std::cout << "ServerSocket: eof file reached" << std::endl;
- } else if (error & BEV_EVENT_ERROR) {
- std::cout << "ServerSocket: unrecoverable error encountered" << std::endl;
- } else if (error & BEV_EVENT_TIMEOUT) {
- std::cout << "ServerSocket: user-specified timeout reached" << std::endl;
- } else if (error & BEV_EVENT_CONNECTED) {
- std::cout << "ServerSocket: connect operation finished" << std::endl;
- }
- // bufferevent_free(bev);
-}
-
-void ServerSocket::readCallback(struct bufferevent *bev, void *ctx) {
- ServerSocket* instance = (ServerSocket*)ctx;
- tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
-
- // instance is already gone
- if (_instances.find(instance) == _instances.end())
- return;
-
- size_t n;
- struct evbuffer* input;
- char* data = (char*)malloc(instance->_blockSizeRead);
-
- input = bufferevent_get_input(bev);
- while((n = evbuffer_remove(input, data, instance->_blockSizeRead)) > 0) {
- instance->readCallback(data, n, instance->_connections[bev]);
- }
- free(data);
-}
-
-void ServerSocket::bind() {
- if (::bind(_socketFD, (struct sockaddr*)&_sin, sizeof(_sin)) < 0) {
- throw std::runtime_error(std::string("bind: ") + strerror(errno));
- }
-}
-
-void ServerSocket::listen(const std::string& address) {
- std::string _prot;
- std::string _address;
- uint16_t _port;
- parseAddress(address, _prot, _address, _port);
- listen(_address, _port);
-}
-
-void ServerSocket::listen(const std::string& address, int port) {
-// tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- setupSockAddr(address, port);
- bind();
-
- int one = 1;
- if (setsockopt(_socketFD, SOL_SOCKET, SO_REUSEADDR, (const char*)&one, sizeof(one)) != 0) {
- throw std::runtime_error(std::string("setsockopt: ") + strerror(errno));
- }
-
-#ifndef _WIN32
- int flags = fcntl(_socketFD, F_GETFL);
- if (flags >= 0) {
- flags |= O_NONBLOCK;
- if (fcntl(_socketFD, F_SETFL, flags) < 0) {
- // could not set to non-block
- }
- }
-#else
- unsigned long on = 1;
- if (ioctlsocket(_socketFD, FIONBIO, &on) != 0) {
- // could not set to non-block
- }
-#endif
-
- _listenerEvent = event_new(_base->base, _socketFD, EV_READ|EV_PERSIST, acceptCallback, (void*)this);
- /*XXX check it */
- event_add(_listenerEvent, NULL);
-
- if (::listen(_socketFD, 16)<0) {
- throw std::runtime_error(std::string("listen: ") + strerror(errno));
- }
-}
-
-void ServerSocket::acceptCallback(evutil_socket_t listener, short event, void *ctx) {
- ServerSocket* instance = (ServerSocket*)ctx;
-// tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
-
- struct sockaddr_storage ss;
- socklen_t slen = sizeof(ss);
- int fd = accept(listener, (struct sockaddr*)&ss, &slen);
- if (fd < 0) {
- throw std::runtime_error(std::string("accept: ") + strerror(errno));
- } else if (fd > FD_SETSIZE) {
-#ifdef WIN32
- closesocket(fd);
-#else
- close(fd);
-#endif
-
- throw std::runtime_error(std::string("accept: ") + strerror(errno));
- } else {
- struct bufferevent *bev;
- evutil_make_socket_nonblocking(fd);
- bev = bufferevent_socket_new(instance->_base->base, fd, BEV_OPT_THREADSAFE); //BEV_OPT_THREADSAFE
- bufferevent_setcb(bev, ServerSocket::readCallback, NULL, ServerSocket::errorCallback, ctx);
- bufferevent_enable(bev, EV_READ|EV_WRITE);
-
- instance->_connections[bev].bufferEvent = bev;
- instance->_connections[bev].fd = fd;
- }
-}
-
-void ServerSocket::Connection::reply(const char* data, size_t size) {
- bufferevent_write(bufferEvent, data, size);
-}
-
-PacketServerSocket::~PacketServerSocket() {
- for(std::map<Connection, std::stringstream*>::iterator fragIter = _fragments.begin();
- fragIter != _fragments.end();
- fragIter++) {
- delete fragIter->second;
- }
-}
-
-void PacketServerSocket::readCallback(const char* data, size_t size, Connection& conn) {
- if (_fragments.find(conn) == _fragments.end())
- _fragments[conn] = new std::stringstream();
-
- std::stringstream* fragment = _fragments[conn];
- *fragment << std::string(data, size);
-
- size_t startPos = 0;
- size_t endPos;
- const std::string& buffer = fragment->str();
- while((endPos = buffer.find(_sep, startPos)) != std::string::npos) {
-// std::cout << ">" << buffer.substr(startPos, endPos - startPos) << "<" << std::endl;
- readCallback(buffer.substr(startPos, endPos - startPos), conn);
- startPos = endPos + _sep.size();
- }
- if (startPos != 0 && startPos < buffer.size() + 1) {
- std::string rest = buffer.substr(startPos);
- fragment->str(std::string());
- fragment->clear();
- *fragment << rest;
- }
-}
-
-}
diff --git a/src/uscxml/server/Socket.h b/src/uscxml/server/Socket.h
deleted file mode 100644
index 01e91b2..0000000
--- a/src/uscxml/server/Socket.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef SOCKETCLIENT_H_9A0B2A88
-#define SOCKETCLIENT_H_9A0B2A88
-
-#include "uscxml/Common.h" // for USCXML_API
-#include "uscxml/concurrency/EventBase.h"
-#include <string>
-#include <sstream>
-#include <map>
-#include <set>
-
-#ifdef _WIN32
-# include <winsock2.h>
-#else
-# include <netinet/in.h> /* For sockaddr_in */
-#endif
-#include <cerrno>
-
-#include "uscxml/concurrency/tinythread.h" // for recursive_mutex, etc
-
-extern "C" {
-#include <event2/event.h>
-#include <event2/buffer.h>
-#include <event2/bufferevent.h>
-}
-
-namespace uscxml {
-
-class USCXML_API Socket {
-public:
- Socket(int domain, int type, int protocol);
- virtual ~Socket();
-
- void setBlockSizeRead(size_t size);
- static void parseAddress(const std::string& address, std::string& protocol, std::string& hostName, uint16_t& port);
-
-protected:
-
- void setupSockAddr(const std::string& address, int port);
-
- evutil_socket_t _socketFD;
-
- tthread::recursive_mutex _mutex;
- size_t _blockSizeRead;
- struct sockaddr_in _sin;
-
- boost::shared_ptr<EventBase> _base;
-};
-
-class USCXML_API ServerSocket : public Socket {
-public:
- class Connection {
- public:
- bool operator<(const Connection& other) const {
- return bufferEvent < other.bufferEvent;
- }
-
- struct bufferevent* bufferEvent;
- int fd;
-
- void reply(const char* data, size_t size);
- };
-
- ServerSocket(int domain, int type, int protocol);
- virtual ~ServerSocket();
-
- void listen(const std::string& address, int port);
- void listen(const std::string& address);
- virtual void readCallback(const char* data, size_t size, Connection& conn) {};
-
-
-protected:
- void bind();
- static void acceptCallback(evutil_socket_t listener, short event, void *ctx);
- static void errorCallback(struct bufferevent *bev, short error, void *ctx);
- static void readCallback(struct bufferevent *bev, void *ctx);
-
- std::map<struct bufferevent*, Connection> _connections;
- struct event* _listenerEvent;
-
- static std::set<ServerSocket*> _instances;
-
-};
-
-class USCXML_API PacketServerSocket : public ServerSocket {
-public:
- PacketServerSocket(int domain, int type, int protocol, const std::string& sep) : ServerSocket(domain, type, protocol), _sep(sep) {}
- virtual ~PacketServerSocket();
-
- void readCallback(const char* data, size_t size, Connection& conn);
- virtual void readCallback(const std::string& packet, Connection& conn) = 0;
-
-protected:
- std::string _sep;
- std::map<Connection, std::stringstream*> _fragments;
-};
-
-class USCXML_API ClientSocket : public Socket {
-public:
- ClientSocket(int domain, int type, int protocol);
- virtual ~ClientSocket();
-
- virtual void readCallback(const char* data, size_t size) {};
- void connect(const std::string& address, int port);
- void connect(const std::string& address);
- int write(const std::string& data);
- int write(const char* data, size_t size);
-
-
-protected:
- static void readCallback(struct bufferevent *bev, void *ctx);
- static void errorCallback(struct bufferevent *bev, short error, void *ctx);
-
- struct bufferevent* _clientEvent;
-
-};
-
-
-}
-
-#endif /* end of include guard: SOCKETCLIENT_H_9A0B2A88 */
diff --git a/src/uscxml/transform/ChartAnnotator.cpp b/src/uscxml/transform/ChartAnnotator.cpp
deleted file mode 100644
index 5bab391..0000000
--- a/src/uscxml/transform/ChartAnnotator.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * @file
- * @author 2012-2015 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "ChartAnnotator.h"
-
-namespace uscxml {
-
-} \ No newline at end of file
diff --git a/src/uscxml/transform/ChartAnnotator.h b/src/uscxml/transform/ChartAnnotator.h
deleted file mode 100644
index 3ce8f4a..0000000
--- a/src/uscxml/transform/ChartAnnotator.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @file
- * @author 2012-2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CHARTANNOTATOR_H_2AC11ECB
-#define CHARTANNOTATOR_H_2AC11ECB
-
-namespace uscxml {
-
-}
-
-#endif /* end of include guard: CHARTANNOTATOR_H_2AC11ECB */
diff --git a/src/uscxml/transform/ChartToC.cpp b/src/uscxml/transform/ChartToC.cpp
index cf4c175..896ef09 100644
--- a/src/uscxml/transform/ChartToC.cpp
+++ b/src/uscxml/transform/ChartToC.cpp
@@ -17,26 +17,24 @@
* @endcond
*/
-#include "uscxml/transform/ChartToFSM.h"
#include "uscxml/transform/ChartToC.h"
-#include "uscxml/debug/Complexity.h"
-#include <DOM/io/Stream.hpp>
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
#include <iostream>
-#include "uscxml/UUID.h"
+#include "uscxml/util/UUID.h"
+#include "uscxml/util/Predicates.h"
#include "uscxml/util/MD5.hpp"
-#include "uscxml/dom/DOMUtils.h"
+#include "uscxml/util/DOM.h"
+#include "uscxml/util/String.h"
#include <math.h>
#include <boost/algorithm/string.hpp>
-#include <glog/logging.h>
+#include <easylogging++.h>
#include <algorithm>
#include <iomanip>
namespace uscxml {
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
+using namespace xercesc;
+
// many more tricks: https://graphics.stanford.edu/~seander/bithacks.html
@@ -46,10 +44,11 @@ Transformer ChartToC::transform(const Interpreter& other) {
return boost::shared_ptr<TransformerImpl>(c2c);
}
-ChartToC::ChartToC(const Interpreter& other) : TransformerImpl(), _topMostMachine(NULL), _parentMachine(NULL) {
- cloneFrom(other.getImpl());
+ChartToC::ChartToC(const Interpreter& other) : TransformerImpl(other), _topMostMachine(NULL), _parentMachine(NULL) {
+
std::stringstream ss;
ss << _document;
+
_md5 = md5(ss.str());
_prefix = "_uscxml_" + _md5.substr(0, 8);
_allMachines.push_back(this);
@@ -57,8 +56,6 @@ ChartToC::ChartToC(const Interpreter& other) : TransformerImpl(), _topMostMachin
prepare();
findNestedMachines();
-// std::cout << _scxml;
-
if (_extensions.find("prefix") != _extensions.end()) {
_prefixes = new std::list<std::string>();
std::pair<std::multimap<std::string, std::string>::iterator,
@@ -72,61 +69,63 @@ ChartToC::ChartToC(const Interpreter& other) : TransformerImpl(), _topMostMachin
void ChartToC::setHistoryCompletion() {
std::set<std::string> elements;
- elements.insert(_nsInfo.xmlNSPrefix + "history");
- Arabica::XPath::NodeSet<std::string> histories = DOMUtils::inPostFixOrder(elements, _scxml);
- NodeSet<std::string> covered;
- NodeSet<std::string> perParentcovered;
- Node<std::string> parent;
+ elements.insert(XML_PREFIX(_scxml).str() + "history");
+ std::list<DOMElement*> histories = DOMUtils::inPostFixOrder(elements, _scxml);
- for (size_t i = 0; i < histories.size(); i++) {
- Element<std::string> history(histories[i]);
- NodeSet<std::string> completion;
+ std::list<DOMElement*> covered;
+ std::list<DOMElement*> perParentcovered;
+ DOMNode* parent;
- if (parent != history.getParentNode()) {
- covered.push_back(perParentcovered);
- perParentcovered = NodeSet<std::string>();
- parent = history.getParentNode();
+ for (auto histIter = histories.begin(); histIter != histories.end(); histIter++) {
+ DOMElement* history = *histIter;
+ std::list<DOMElement*> completion;
+
+ if (parent != history->getParentNode()) {
+ covered.insert(covered.end(), perParentcovered.begin(), perParentcovered.end());
+ perParentcovered.clear();
+ parent = history->getParentNode();
}
bool deep = (HAS_ATTR(history, "type") && iequals(ATTR(history, "type"), "deep"));
- for (size_t j = 0; j < _states.size(); j++) {
- if (_states[j] == history)
+ for (auto stateIter = _states.begin(); stateIter != _states.end(); stateIter++) {
+ DOMElement* state = *stateIter;
+ if (state == history)
continue;
- if (isDescendant(_states[j], history.getParentNode()) && isHistory(Element<std::string>(_states[j]))) {
- history.setAttribute("hasHistoryChild", "yes");
+ if (DOMUtils::isDescendant(state, history->getParentNode()) && isHistory(state)) {
+ history->setAttribute(X("hasHistoryChild"), X("yes"));
}
- if (isMember(_states[j], covered))
+ if (DOMUtils::isMember(state, covered))
continue;
if (deep) {
- if (isDescendant(_states[j], history.getParentNode()) && !isHistory(Element<std::string>(_states[j]))) {
- completion.push_back(_states[j]);
+ if (DOMUtils::isDescendant(state, history->getParentNode()) && !isHistory(state)) {
+ completion.push_back(state);
}
} else {
- if (_states[j].getParentNode() == history.getParentNode() && !isHistory(Element<std::string>(_states[j]))) {
- completion.push_back(_states[j]);
+ if (state->getParentNode() == history->getParentNode() && !isHistory(state)) {
+ completion.push_back(state);
}
}
}
- perParentcovered.push_back(completion);
+ perParentcovered.insert(perParentcovered.end(), completion.begin(), completion.end());
std::string completionBools;
for (size_t j = 0; j < _states.size(); j++) {
- if (isMember(_states[j], completion)) {
+ if (DOMUtils::isMember(_states[j], completion)) {
completionBools += "1";
} else {
completionBools += "0";
}
}
- history.setAttribute("completionBools", completionBools);
+ history->setAttribute(X("completionBools"), X(completionBools));
}
}
-void ChartToC::resortStates(Arabica::DOM::Node<std::string>& node) {
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
+void ChartToC::resortStates(DOMNode* node) {
+ if (node->getNodeType() != DOMNode::ELEMENT_NODE)
return;
/**
@@ -136,56 +135,56 @@ void ChartToC::resortStates(Arabica::DOM::Node<std::string>& node) {
everything else
*/
- Element<std::string> element(node);
+ DOMElement* element = static_cast<DOMElement*>(node);
// shallow history states to top
- Node<std::string> child = element.getFirstChild();
+ DOMNode* child = element->getFirstChild();
while(child) {
resortStates(child);
- if (child.getNodeType() == Node_base::ELEMENT_NODE &&
- TAGNAME_CAST(child) == _nsInfo.xmlNSPrefix + "history" &&
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE &&
+ TAGNAME_CAST(child) == XML_PREFIX(node).str() + "history" &&
(!HAS_ATTR(element, "type") || iequals(ATTR(element, "type"), "shallow"))) {
- Node<std::string> tmp = child.getNextSibling();
- if (child != element.getFirstChild()) {
- element.insertBefore(child, element.getFirstChild());
+ DOMNode* tmp = child->getNextSibling();
+ if (child != element->getFirstChild()) {
+ element->insertBefore(child, element->getFirstChild());
}
child = tmp;
} else {
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
}
// deep history states to top
- child = element.getFirstChild();
+ child = element->getFirstChild();
while(child) {
resortStates(child);
- if (child.getNodeType() == Node_base::ELEMENT_NODE &&
- TAGNAME_CAST(child) == _nsInfo.xmlNSPrefix + "history" &&
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE &&
+ TAGNAME_CAST(child) == XML_PREFIX(node).str() + "history" &&
HAS_ATTR(element, "type") &&
iequals(ATTR(element, "type"), "deep")) {
- Node<std::string> tmp = child.getNextSibling();
- if (child != element.getFirstChild()) {
- element.insertBefore(child, element.getFirstChild());
+ DOMNode* tmp = child->getNextSibling();
+ if (child != element->getFirstChild()) {
+ element->insertBefore(child, element->getFirstChild());
}
child = tmp;
} else {
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
}
// initial states on top of histories even
- child = element.getFirstChild();
+ child = element->getFirstChild();
while(child) {
resortStates(child);
- if (child.getNodeType() == Node_base::ELEMENT_NODE && TAGNAME_CAST(child) == _nsInfo.xmlNSPrefix + "initial") {
- Node<std::string> tmp = child.getNextSibling();
- if (child != element.getFirstChild()) {
- element.insertBefore(child, element.getFirstChild());
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE && TAGNAME_CAST(child) == XML_PREFIX(node).str() + "initial") {
+ DOMNode* tmp = child->getNextSibling();
+ if (child != element->getFirstChild()) {
+ element->insertBefore(child, element->getFirstChild());
}
child = tmp;
} else {
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
}
@@ -195,35 +194,36 @@ void ChartToC::setStateCompletion() {
setHistoryCompletion();
for (size_t i = 0; i < _states.size(); i++) {
- Element<std::string> state(_states[i]);
+ DOMElement* state(_states[i]);
if (isHistory(state)) {
// we already did in setHistoryCompletion
continue;
}
- NodeSet<std::string> completion;
+ std::list<DOMElement*> completion;
if (isParallel(state)) {
completion = getChildStates(state);
- } else if (state.hasAttribute("initial")) {
- completion = getStates(tokenize(state.getAttribute("initial")));
+ } else if (HAS_ATTR(state, "initial")) {
+ completion = getStates(tokenize(ATTR(state, "initial")), _scxml);
} else {
- NodeSet<std::string> initElems = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "initial", state);
- if(initElems.size() > 0 && !iequals(ATTR_CAST(initElems[0], "generated"), "true")) {
+ std::list<DOMElement*> initElems = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "initial", state);
+ if(initElems.size() > 0) {
// initial element is first child
- completion.push_back(initElems[0]);
+ completion.push_back(initElems.front());
} else {
// first child state
- Arabica::XPath::NodeSet<std::string> initStates;
- NodeList<std::string> childs = state.getChildNodes();
- for (size_t i = 0; i < childs.getLength(); i++) {
- if (childs.item(i).getNodeType() != Node_base::ELEMENT_NODE)
+ std::list<DOMElement*> initStates;
+ DOMNodeList* childs = state->getChildNodes();
+ for (size_t i = 0; i < childs->getLength(); i++) {
+ if (childs->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
continue;
- if (isState(Element<std::string>(childs.item(i)))) {
- completion.push_back(childs.item(i));
+ DOMElement* childElem = static_cast<DOMElement*>(childs->item(i));
+ if (isState(childElem)) {
+ completion.push_back(childElem);
break;
}
}
@@ -232,47 +232,47 @@ void ChartToC::setStateCompletion() {
std::string completionBools;
for (size_t j = 0; j < _states.size(); j++) {
- if (isMember(_states[j], completion)) {
+ if (DOMUtils::isMember(_states[j], completion)) {
completionBools += "1";
} else {
completionBools += "0";
}
}
- state.setAttribute("completionBools", completionBools);
+ state->setAttribute(X("completionBools"), X(completionBools));
}
}
void ChartToC::prepare() {
- _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
- _name = (HAS_ATTR(_scxml, "name") ? ATTR(_scxml, "name") : "");
// make sure initial and history elements always precede propoer states
resortStates(_scxml);
std::set<std::string> elements;
- elements.insert(_nsInfo.xmlNSPrefix + "scxml");
- elements.insert(_nsInfo.xmlNSPrefix + "state");
- elements.insert(_nsInfo.xmlNSPrefix + "final");
- elements.insert(_nsInfo.xmlNSPrefix + "history");
- elements.insert(_nsInfo.xmlNSPrefix + "initial");
- elements.insert(_nsInfo.xmlNSPrefix + "parallel");
- _states = DOMUtils::inDocumentOrder(elements, _scxml);
+ elements.insert(XML_PREFIX(_scxml).str() + "scxml");
+ elements.insert(XML_PREFIX(_scxml).str() + "state");
+ elements.insert(XML_PREFIX(_scxml).str() + "final");
+ elements.insert(XML_PREFIX(_scxml).str() + "history");
+ elements.insert(XML_PREFIX(_scxml).str() + "initial");
+ elements.insert(XML_PREFIX(_scxml).str() + "parallel");
+
+ std::list<xercesc::DOMElement*> tmp = DOMUtils::inDocumentOrder(elements, _scxml);
+ _states.insert(_states.end(), tmp.begin(), tmp.end());
// set states' document order and parent attribute
for (size_t i = 0; i < _states.size(); i++) {
- Element<std::string> state(_states[i]);
- state.setAttribute("documentOrder", toStr(i));
- if (state.getParentNode().getNodeType() == Node_base::ELEMENT_NODE &&
- HAS_ATTR_CAST(state.getParentNode(), "documentOrder")) {
- state.setAttribute("parent", ATTR_CAST(state.getParentNode(), "documentOrder"));
+ DOMElement* state(_states[i]);
+ state->setAttribute(X("documentOrder"), X(toStr(i)));
+ if (state->getParentNode()->getNodeType() == DOMNode::ELEMENT_NODE &&
+ HAS_ATTR_CAST(state->getParentNode(), "documentOrder")) {
+ state->setAttribute(X("parent"), X(ATTR_CAST(state->getParentNode(), "documentOrder")));
}
// set the states' children and whether it has a history
std::string childBools;
bool hasHistoryChild = false;
for (size_t j = 0; j < _states.size(); j++) {
- if (_states[j].getParentNode() == state) {
- if (isHistory(Element<std::string>(_states[j]))) {
+ if (_states[j]->getParentNode() == state) {
+ if (isHistory(static_cast<DOMElement*>(_states[j]))) {
hasHistoryChild = true;
}
childBools += "1";
@@ -280,70 +280,74 @@ void ChartToC::prepare() {
childBools += "0";
}
}
- state.setAttribute("childBools", childBools);
+ state->setAttribute(X("childBools"), X(childBools));
if (hasHistoryChild) {
- state.setAttribute("hasHistoryChild", "yes");
+ state->setAttribute(X("hasHistoryChild"), X("yes"));
}
// ancestors
std::string ancBools;
for (size_t j = 0; j < _states.size(); j++) {
- if (isDescendant(state, _states[j])) {
+ if (DOMUtils::isDescendant(state, _states[j])) {
ancBools += "1";
} else {
ancBools += "0";
}
}
- state.setAttribute("ancBools", ancBools);
+ state->setAttribute(X("ancBools"), X(ancBools));
}
+
// set transitions' document order and source attribute
elements.clear();
- elements.insert(_nsInfo.xmlNSPrefix + "transition");
- _transitions = DOMUtils::inDocumentOrder(elements, _scxml);
- for (size_t i = 0; i < _transitions.size(); i++) {
- Element<std::string> transition(_transitions[i]);
- transition.setAttribute("documentOrder", toStr(i));
- if (transition.getParentNode().getNodeType() == Node_base::ELEMENT_NODE &&
- HAS_ATTR_CAST(transition.getParentNode(), "documentOrder")) {
- transition.setAttribute("source", ATTR_CAST(transition.getParentNode(), "documentOrder"));
+ elements.insert(XML_PREFIX(_scxml).str() + "transition");
+ tmp = DOMUtils::inDocumentOrder(elements, _scxml);
+ size_t index = 0;
+ for (auto transIter = tmp.begin(); transIter != tmp.end(); transIter++, index++) {
+ DOMElement* transition = *transIter;
+ transition->setAttribute(X("documentOrder"), X(toStr(index)));
+ if (transition->getParentNode()->getNodeType() == DOMNode::ELEMENT_NODE &&
+ HAS_ATTR_CAST(transition->getParentNode(), "documentOrder")) {
+ transition->setAttribute(X("source"), X(ATTR_CAST(transition->getParentNode(), "documentOrder")));
}
}
// set transitions' postfix order attribute
- _transitions = DOMUtils::inPostFixOrder(elements, _scxml);
+ tmp = DOMUtils::inPostFixOrder(elements, _scxml);
+ _transitions.insert(_transitions.end(), tmp.begin(), tmp.end());
+
for (size_t i = 0; i < _transitions.size(); i++) {
- Element<std::string> transition(_transitions[i]);
- transition.setAttribute("postFixOrder", toStr(i));
+ DOMElement* transition(_transitions[i]);
+ transition->setAttribute(X("postFixOrder"), X(toStr(i)));
// and exit set
std::string exitSetBools;
- NodeSet<std::string> exitSet = computeExitSet(transition);
+ std::list<DOMElement*> exitSet = getExitSet(transition, _scxml);
for (unsigned int j = 0; j < _states.size(); j++) {
- Element<std::string> state(_states[j]);
- if (isMember(state, exitSet)) {
+ DOMElement* state(_states[j]);
+ if (DOMUtils::isMember(state, exitSet)) {
exitSetBools += "1";
} else {
exitSetBools += "0";
}
}
- transition.setAttribute("exitSetBools", exitSetBools);
+ transition->setAttribute(X("exitSetBools"), X(exitSetBools));
// and conflicts
std::string conflictBools;
for (unsigned int j = 0; j < _transitions.size(); j++) {
- Element<std::string> t2(_transitions[j]);
- if (hasIntersection(computeExitSet(transition), computeExitSet(t2)) ||
+ DOMElement* t2(_transitions[j]);
+ if (DOMUtils::hasIntersection(getExitSet(transition, _scxml), getExitSet(t2, _scxml)) ||
(getSourceState(transition) == getSourceState(t2)) ||
- (isDescendant(getSourceState(transition), getSourceState(t2))) ||
- (isDescendant(getSourceState(t2), getSourceState(transition)))) {
+ (DOMUtils::isDescendant(getSourceState(transition), getSourceState(t2))) ||
+ (DOMUtils::isDescendant(getSourceState(t2), getSourceState(transition)))) {
conflictBools += "1";
} else {
conflictBools += "0";
}
}
- transition.setAttribute("conflictBools", conflictBools);
+ transition->setAttribute(X("conflictBools"), X(conflictBools));
// and target
if (HAS_ATTR(transition, "target")) {
@@ -351,7 +355,7 @@ void ChartToC::prepare() {
std::string targetBools;
for (size_t j = 0; j < _states.size(); j++) {
- Element<std::string> state(_states[j]);
+ DOMElement* state(_states[j]);
if (HAS_ATTR(state, "id") &&
std::find(targets.begin(), targets.end(), escape(ATTR(state, "id"))) != targets.end()) {
@@ -360,7 +364,7 @@ void ChartToC::prepare() {
targetBools += "0";
}
}
- transition.setAttribute("targetBools", targetBools);
+ transition->setAttribute(X("targetBools"), X(targetBools));
}
}
@@ -418,7 +422,7 @@ void ChartToC::writeTo(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " Generated from source:" << std::endl;
- stream << " " << _sourceURL.asString() << std::endl;
+ stream << " " << (std::string)_baseURL << std::endl;
stream << "*/" << std::endl;
stream << std::endl;
@@ -452,13 +456,14 @@ void ChartToC::writeForwardDeclarations(std::ostream& stream) {
}
void ChartToC::findNestedMachines() {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
+ std::list<DOMElement*> invokes = DOMUtils::filterChildElements(XML_PREFIX(_scxml).str() + "invoke", _scxml, true);
+
+ for (auto invIter = invokes.begin(); invIter != invokes.end(); invIter++) {
+ DOMElement* invoke = *invIter;
- for (size_t i = 0; i < invokes.size(); i++) {
- if(isInEmbeddedDocument(invokes[i]))
+ if(isInEmbeddedDocument(invoke))
continue;
- Element<std::string> invoke(invokes[i]);
if (HAS_ATTR(invoke, "type") &&
ATTR(invoke, "type") != "scxml" &&
ATTR(invoke, "type") != "http://www.w3.org/TR/scxml/")
@@ -466,31 +471,28 @@ void ChartToC::findNestedMachines() {
ChartToC* c2c = NULL;
if (HAS_ATTR(invoke, "src")) {
+
URL srcURL(ATTR(invoke, "src"));
- if (!srcURL.toAbsolute(getBaseURLForNode(invoke))) {
- LOG(ERROR) << "invoke element has relative src URL with no baseURL set.";
- return;
+ if (!srcURL.isAbsolute()) {
+ srcURL = URL::resolve(srcURL, _baseURL);
}
- c2c = new ChartToC(Interpreter::fromURL(srcURL.asString()));
+ std::string tmp = (std::string)srcURL;
+ c2c = new ChartToC(Interpreter::fromURL(tmp));
} else {
// is there a nested scxml machine inside?
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", invoke);
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(invoke).str() + "content", invoke);
if (contents.size() == 0)
continue;
- NodeSet<std::string> scxmls = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "scxml", contents[0]);
+ std::list<DOMElement*> scxmls = DOMUtils::filterChildElements(XML_PREFIX(invoke).str() + "scxml", contents.front());
if (scxmls.size() == 0)
continue;
- DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Arabica::DOM::Document<std::string> doc = domFactory.createDocument(_document.getNamespaceURI(), "", 0);
- Node<std::string> imported = doc.importNode(scxmls[0], true);
- doc.appendChild(imported);
-// std::cout << doc << std::endl;
- c2c = new ChartToC(Interpreter::fromDOM(doc, _nsInfo, _sourceURL));
+ c2c = new ChartToC(Interpreter::fromElement(scxmls.front(), _baseURL));
+ c2c->_name += "." + DOMUtils::idForNode(scxmls.front());
}
if (c2c != NULL) {
- invoke.setAttribute("md5sum", c2c->_md5);
+ invoke->setAttribute(X("md5sum"), X(c2c->_md5));
ChartToC* topMostMachine = (_topMostMachine == NULL ? this : _topMostMachine);
c2c->_topMostMachine = topMostMachine;
c2c->_parentMachine = this;
@@ -739,7 +741,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to a <data> element." << std::endl;
+ stream << " * All information pertaining to a <data> element->" << std::endl;
stream << " * With late data binding, blocks of data elements are separated by NULL" << std::endl;
stream << " * use USCXML_ELEM_DATA_IS_SET to test for end of a block." << std::endl;
stream << " */" << std::endl;
@@ -752,7 +754,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to an <assign> element." << std::endl;
+ stream << " * All information pertaining to an <assign> element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_elem_assign {" << std::endl;
stream << " const char* location;" << std::endl;
@@ -762,7 +764,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to any state element." << std::endl;
+ stream << " * All information pertaining to any state element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_state {" << std::endl;
stream << " const char* name; /* eventual name */" << std::endl;
@@ -770,32 +772,32 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << " const exec_content_t on_entry; /* on entry handlers */" << std::endl;
stream << " const exec_content_t on_exit; /* on exit handlers */" << std::endl;
stream << " const invoke_t invoke; /* invocations */" << std::endl;
- stream << " const char children[USCXML_MAX_NR_STATES_BYTES]; /* all children */" << std::endl;
- stream << " const char completion[USCXML_MAX_NR_STATES_BYTES]; /* default completion */" << std::endl;
- stream << " const char ancestors[USCXML_MAX_NR_STATES_BYTES]; /* all ancestors */" << std::endl;
+ stream << " const unsigned char children[USCXML_MAX_NR_STATES_BYTES]; /* all children */" << std::endl;
+ stream << " const unsigned char completion[USCXML_MAX_NR_STATES_BYTES]; /* default completion */" << std::endl;
+ stream << " const unsigned char ancestors[USCXML_MAX_NR_STATES_BYTES]; /* all ancestors */" << std::endl;
stream << " const uscxml_elem_data* data; /* data with late binding */" << std::endl;
stream << " const unsigned char type; /* One of USCXML_STATE_* */" << std::endl;
stream << "};" << std::endl;
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to a <transitions> element." << std::endl;
+ stream << " * All information pertaining to a <transitions> element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_transition {" << std::endl;
stream << " const USCXML_NR_STATES_TYPE source;" << std::endl;
- stream << " const char target[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " const unsigned char target[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
stream << " const char* event;" << std::endl;
stream << " const char* condition;" << std::endl;
stream << " const is_enabled_t is_enabled;" << std::endl;
stream << " const exec_content_t on_transition;" << std::endl;
stream << " const unsigned char type;" << std::endl;
- stream << " const char conflicts[USCXML_MAX_NR_TRANS_BYTES];" << std::endl;
- stream << " const char exit_set[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " const unsigned char conflicts[USCXML_MAX_NR_TRANS_BYTES];" << std::endl;
+ stream << " const unsigned char exit_set[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
stream << "};" << std::endl;
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to a <foreach> element." << std::endl;
+ stream << " * All information pertaining to a <foreach> element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_elem_foreach {" << std::endl;
stream << " const char* array;" << std::endl;
@@ -805,7 +807,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to a <param> element." << std::endl;
+ stream << " * All information pertaining to a <param> element->" << std::endl;
stream << " * Blocks of params are separated by NULL params, use" << std::endl;
stream << " * USCXML_ELEM_PARAM_IS_SET to test for end of a block." << std::endl;
stream << " */" << std::endl;
@@ -817,7 +819,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to a <donedata> element." << std::endl;
+ stream << " * All information pertaining to a <donedata> element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_elem_donedata {" << std::endl;
stream << " const USCXML_NR_STATES_TYPE source;" << std::endl;
@@ -828,7 +830,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to an <invoke> element." << std::endl;
+ stream << " * All information pertaining to an <invoke> element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_elem_invoke {" << std::endl;
stream << " const uscxml_machine* machine;" << std::endl;
@@ -849,7 +851,7 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << std::endl;
stream << "/**" << std::endl;
- stream << " * All information pertaining to a <send> element." << std::endl;
+ stream << " * All information pertaining to a <send> element->" << std::endl;
stream << " */" << std::endl;
stream << "struct uscxml_elem_send {" << std::endl;
stream << " const char* event;" << std::endl;
@@ -876,10 +878,10 @@ void ChartToC::writeTypes(std::ostream& stream) {
stream << " unsigned char flags;" << std::endl;
stream << " const uscxml_machine* machine;" << std::endl;
stream << std::endl;
- stream << " char config[USCXML_MAX_NR_STATES_BYTES]; /* Make sure these macros specify a sufficient size */" << std::endl;
- stream << " char history[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
- stream << " char invocations[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
- stream << " char initialized_data[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char config[USCXML_MAX_NR_STATES_BYTES]; /* Make sure these macros specify a sufficient size */" << std::endl;
+ stream << " unsigned char history[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char invocations[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char initialized_data[USCXML_MAX_NR_STATES_BYTES];" << std::endl;
stream << std::endl;
stream << " void* user_data;" << std::endl;
stream << " void* event;" << std::endl;
@@ -914,7 +916,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Print name of states contained in a (debugging)." << std::endl;
stream << " */" << std::endl;
- stream << "static void printStateNames(const uscxml_ctx* ctx, const char* a, size_t length) {" << std::endl;
+ stream << "static void printStateNames(const uscxml_ctx* ctx, const unsigned char* a, size_t length) {" << std::endl;
stream << " size_t i;" << std::endl;
stream << " const char* seperator = \"\";" << std::endl;
stream << " for (i = 0; i < length; i++) {" << std::endl;
@@ -930,7 +932,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Print bits set in a in a binary representation (debugging)." << std::endl;
stream << " */" << std::endl;
- stream << "static void printBitsetIndices(const char* a, size_t length) {" << std::endl;
+ stream << "static void printBitsetIndices(const unsigned char* a, size_t length) {" << std::endl;
stream << " size_t i;" << std::endl;
stream << " const char* seperator = \"\";" << std::endl;
stream << " for (i = 0; i < length; i++) {" << std::endl;
@@ -949,7 +951,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Return true if there is a common bit in a and b." << std::endl;
stream << " */" << std::endl;
- stream << "static int bit_has_and(const char* a, const char* b, size_t i) {" << std::endl;
+ stream << "static int bit_has_and(const unsigned char* a, const unsigned char* b, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " if (a[i] & b[i])" << std::endl;
stream << " return 1;" << std::endl;
@@ -962,7 +964,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << " * Set all bits to 0, this corresponds to memset(a, 0, i), " << std::endl;
stream << " * but does not require string.h or cstring." << std::endl;
stream << " */" << std::endl;
- stream << "static void bit_clear_all(char* a, size_t i) {" << std::endl;
+ stream << "static void bit_clear_all(unsigned char* a, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " a[i] = 0;" << std::endl;
stream << " }" << std::endl;
@@ -972,7 +974,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Return true if there is any bit set in a." << std::endl;
stream << " */" << std::endl;
- stream << "static int bit_has_any(const char* a, size_t i) {" << std::endl;
+ stream << "static int bit_has_any(unsigned const char* a, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " if (a[i] > 0)" << std::endl;
stream << " return 1;" << std::endl;
@@ -984,7 +986,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Set all bits from given mask in dest, this is |= for bit arrays." << std::endl;
stream << " */" << std::endl;
- stream << "static void bit_or(char* dest, const char* mask, size_t i) {" << std::endl;
+ stream << "static void bit_or(unsigned char* dest, const unsigned char* mask, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " dest[i] |= mask[i];" << std::endl;
stream << " }" << std::endl;
@@ -995,7 +997,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << " * Copy all bits from source to dest, this corresponds to memcpy(a, b, i), " << std::endl;
stream << " * but does not require string.h or cstring." << std::endl;
stream << " */" << std::endl;
- stream << "static void bit_copy(char* dest, const char* source, size_t i) {" << std::endl;
+ stream << "static void bit_copy(unsigned char* dest, const unsigned char* source, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " dest[i] = source[i];" << std::endl;
stream << " }" << std::endl;
@@ -1005,7 +1007,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Unset bits from mask in dest." << std::endl;
stream << " */" << std::endl;
- stream << "static void bit_and_not(char* dest, const char* mask, size_t i) {" << std::endl;
+ stream << "static void bit_and_not(unsigned char* dest, const unsigned char* mask, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " dest[i] &= ~mask[i];" << std::endl;
stream << " }" << std::endl;
@@ -1015,7 +1017,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
stream << "/**" << std::endl;
stream << " * Set bits from mask in dest." << std::endl;
stream << " */" << std::endl;
- stream << "static void bit_and(char* dest, const char* mask, size_t i) {" << std::endl;
+ stream << "static void bit_and(unsigned char* dest, const unsigned char* mask, size_t i) {" << std::endl;
stream << " while(i--) {" << std::endl;
stream << " dest[i] &= mask[i];" << std::endl;
stream << " };" << std::endl;
@@ -1030,22 +1032,22 @@ void ChartToC::writeHelpers(std::ostream& stream) {
void ChartToC::writeExecContentFinalize(std::ostream& stream) {
// needs to be written prior to invocation elem info
- NodeSet<std::string> finalizes = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "finalize", _scxml);
+ std::list<DOMElement*> finalizes = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "finalize", _scxml);
if (finalizes.size() > 0) {
stream << "#ifndef USCXML_NO_EXEC_CONTENT" << std::endl;
stream << std::endl;
}
- for (size_t i = 0; i < finalizes.size(); i++) {
- Element<std::string> finalize(finalizes[i]);
- NodeSet<std::string> execContent = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, finalize);
+ for (auto iter = finalizes.begin(); iter != finalizes.end(); iter++) {
+ DOMElement* finalize = *iter;
+ std::list<DOMNode*> execContent = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, finalize);
if (execContent.size() > 0) {
stream << "static int " << _prefix << "_" << DOMUtils::idForNode(finalize) << "(const uscxml_ctx* ctx, const uscxml_elem_invoke* invocation, const void* event) {" << std::endl;
stream << " int err = USCXML_ERR_OK;" << std::endl;
- for (size_t j = 0; j < execContent.size(); j++) {
- writeExecContent(stream, Element<std::string>(execContent[j]), 1);
+ for (auto iter2 = execContent.begin(); iter2 != execContent.end(); iter2++) {
+ writeExecContent(stream, static_cast<DOMElement*>(*iter2), 1);
}
stream << " return USCXML_ERR_OK;" << std::endl;
stream << "}" << std::endl;
@@ -1064,16 +1066,19 @@ void ChartToC::writeExecContent(std::ostream& stream) {
stream << std::endl;
for (size_t i = 0; i < _states.size(); i++) {
- Element<std::string> state(_states[i]);
+ DOMElement* state(_states[i]);
if (i == 0) {
// root state - we need to perform some initialization here
- NodeSet<std::string> globalScripts = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", state);
+ std::list<DOMElement*> globalScripts = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "script", state);
if (globalScripts.size() > 0) {
- for (size_t j = 0; j < globalScripts.size(); j++) {
+ size_t j = 0;
+ for (auto iter = globalScripts.begin(); iter != globalScripts.end(); iter++, j++) {
+ DOMElement* globalScript = *iter;
+
stream << "static int " << _prefix << "_global_script_" << toStr(j) << "(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
stream << " int err = USCXML_ERR_OK;" << std::endl;
- writeExecContent(stream, globalScripts[j], 1);
+ writeExecContent(stream, globalScript, 1);
stream << " return USCXML_ERR_OK;" << std::endl;
stream << "}" << std::endl;
}
@@ -1088,65 +1093,76 @@ void ChartToC::writeExecContent(std::ostream& stream) {
}
}
- NodeSet<std::string> onexit = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onexit", state);
- for (size_t j = 0; j < onexit.size(); j++) {
- stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_exit_" << toStr(j) << "(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
- stream << " int err = USCXML_ERR_OK;" << std::endl;
- writeExecContent(stream, onexit[j], 1);
- stream << " return USCXML_ERR_OK;" << std::endl;
- stream << "}" << std::endl;
- stream << std::endl;
- }
+ {
+ std::list<DOMElement*> onexits = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "onexit", state);
+ size_t j = 0;
+ for (auto iter = onexits.begin(); iter != onexits.end(); iter++, j++) {
+ DOMElement* onexit = *iter;
+ stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_exit_" << toStr(j) << "(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
+ stream << " int err = USCXML_ERR_OK;" << std::endl;
+ writeExecContent(stream, onexit, 1);
+ stream << " return USCXML_ERR_OK;" << std::endl;
+ stream << "}" << std::endl;
+ stream << std::endl;
+ }
- if (onexit.size() > 0) {
- stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_exit(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
- for (size_t j = 0; j < onexit.size(); j++) {
- stream << " " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_exit_" << toStr(j) << "(ctx, state, event);" << std::endl;
+ if (onexits.size() > 0) {
+ stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_exit(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
+ for (size_t j = 0; j < onexits.size(); j++) {
+ stream << " " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_exit_" << toStr(j) << "(ctx, state, event);" << std::endl;
+ }
+ stream << " return USCXML_ERR_OK;" << std::endl;
+ stream << "}" << std::endl;
+ stream << std::endl;
}
- stream << " return USCXML_ERR_OK;" << std::endl;
- stream << "}" << std::endl;
- stream << std::endl;
}
- NodeSet<std::string> onentry = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onentry", state);
- for (size_t j = 0; j < onentry.size(); j++) {
- stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_entry_" << toStr(j) << "(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
- stream << " int err = USCXML_ERR_OK;" << std::endl;
- writeExecContent(stream, onentry[j], 1);
- stream << " return USCXML_ERR_OK;" << std::endl;
- stream << "}" << std::endl;
- stream << std::endl;
- }
-
- if (onentry.size() > 0) {
- stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
- for (size_t j = 0; j < onentry.size(); j++) {
- stream << " " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_entry_" << toStr(j) << "(ctx, state, event);" << std::endl;
+ {
+ std::list<DOMElement*> onentrys = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "onentry", state);
+ size_t j = 0;
+ for (auto iter = onentrys.begin(); iter != onentrys.end(); iter++, j++) {
+ DOMElement* onentry = *iter;
+ stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_entry_" << toStr(j) << "(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
+ stream << " int err = USCXML_ERR_OK;" << std::endl;
+ writeExecContent(stream, onentry, 1);
+ stream << " return USCXML_ERR_OK;" << std::endl;
+ stream << "}" << std::endl;
+ stream << std::endl;
}
- stream << " return USCXML_ERR_OK;" << std::endl;
- stream << "}" << std::endl;
- stream << std::endl;
+ if (onentrys.size() > 0) {
+ stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
+ for (size_t j = 0; j < onentrys.size(); j++) {
+ stream << " " << _prefix << "_" << DOMUtils::idForNode(state) << "_on_entry_" << toStr(j) << "(ctx, state, event);" << std::endl;
+ }
+
+ stream << " return USCXML_ERR_OK;" << std::endl;
+ stream << "}" << std::endl;
+ stream << std::endl;
+ }
}
+ {
+ std::list<DOMElement*> invokes = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "invoke", state);
+ if (invokes.size() > 0) {
+ stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_invoke(const uscxml_ctx* ctx, const uscxml_state* s, const uscxml_elem_invoke* invocation, unsigned char uninvoke) {" << std::endl;
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", state);
- if (invokes.size() > 0) {
- stream << "static int " << _prefix << "_" << DOMUtils::idForNode(state) << "_invoke(const uscxml_ctx* ctx, const uscxml_state* s, const uscxml_elem_invoke* invocation, unsigned char uninvoke) {" << std::endl;
- for (size_t j = 0; j < invokes.size(); j++) {
- Element<std::string> invoke(invokes[j]);
- stream << " ctx->invoke(ctx, s, &" << _prefix << "_elem_invokes[" << ATTR(invoke, "documentOrder") << "], uninvoke);" << std::endl;
- stream << std::endl;
+ size_t j = 0;
+ for (auto iter = invokes.begin(); iter != invokes.end(); iter++, j++) {
+ DOMElement* invoke = *iter;
+ stream << " ctx->invoke(ctx, s, &" << _prefix << "_elem_invokes[" << ATTR(invoke, "documentOrder") << "], uninvoke);" << std::endl;
+ stream << std::endl;
+ }
+ stream << " return USCXML_ERR_OK;" << std::endl;
+ stream << "}" << std::endl;
}
- stream << " return USCXML_ERR_OK;" << std::endl;
- stream << "}" << std::endl;
}
}
for (size_t i = 0; i < _transitions.size(); i++) {
- Element<std::string> transition(_transitions[i]);
- NodeSet<std::string> execContent = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, transition);
+ DOMElement* transition(_transitions[i]);
+ std::list<DOMNode*> execContent = DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, transition);
if (HAS_ATTR(transition, "cond")) {
stream << "static int " << _prefix << "_" << DOMUtils::idForNode(transition) << "_is_enabled(const uscxml_ctx* ctx, const uscxml_transition* transition) {" << std::endl;
@@ -1164,8 +1180,8 @@ void ChartToC::writeExecContent(std::ostream& stream) {
if (execContent.size() > 0) {
stream << "static int " << _prefix << "_" << DOMUtils::idForNode(transition) << "_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) {" << std::endl;
stream << " int err = USCXML_ERR_OK;" << std::endl;
- for (size_t j = 0; j < execContent.size(); j++) {
- writeExecContent(stream, Element<std::string>(execContent[j]), 1);
+ for (auto iter = execContent.begin(); iter != execContent.end(); iter++) {
+ writeExecContent(stream, static_cast<DOMElement*>(*iter), 1);
}
stream << " return USCXML_ERR_OK;" << std::endl;
stream << "}" << std::endl;
@@ -1178,16 +1194,16 @@ void ChartToC::writeExecContent(std::ostream& stream) {
}
-void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent) {
+void ChartToC::writeExecContent(std::ostream& stream, const DOMNode* node, int indent) {
if (!node)
return;
- if (node.getNodeType() == Node_base::TEXT_NODE) {
- if (boost::trim_copy(node.getNodeValue()).length() > 0) {
+ if (node->getNodeType() == DOMNode::TEXT_NODE) {
+ if (boost::trim_copy(X(node->getNodeValue()).str()).length() > 0) {
if (HAS_ATTR(_scxml, "datamodel") && ATTR(_scxml, "datamodel") == "native") {
- stream << node.getNodeValue();
+ stream << node->getNodeValue();
} else {
- std::string escaped = escape(node.getNodeValue());
+ std::string escaped = escape(X(node->getNodeValue()).str());
stream << escaped;
}
}
@@ -1200,30 +1216,33 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
}
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
+ if (node->getNodeType() != DOMNode::ELEMENT_NODE)
return; // skip anything not an element
- Arabica::DOM::Element<std::string> elem = Arabica::DOM::Element<std::string>(node);
+ DOMElement* elem = (DOMElement*)(node);
if (false) {
- } else if(TAGNAME(elem) == "onentry" || TAGNAME(elem) == "onexit" || TAGNAME(elem) == "transition" || TAGNAME(elem) == "finalize") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "onentry" ||
+ TAGNAME(elem) == XML_PREFIX(elem).str() + "onexit" ||
+ TAGNAME(elem) == XML_PREFIX(elem).str() + "transition" ||
+ TAGNAME(elem) == XML_PREFIX(elem).str() + "finalize") {
// descent into childs and write their contents
- Arabica::DOM::Node<std::string> child = node.getFirstChild();
+ DOMNode* child = node->getFirstChild();
while(child) {
writeExecContent(stream, child, indent);
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
- } else if(TAGNAME(elem) == "script") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "script") {
stream << padding;
stream << "if likely(ctx->exec_content_script != NULL) {" << std::endl;
stream << padding;
stream << " if unlikely((err = ctx->exec_content_script(ctx, ";
stream << (HAS_ATTR(elem, "src") ? "\"" + escape(ATTR(elem, "src")) + "\"" : "NULL") << ", ";
- NodeSet<std::string> scriptTexts = DOMUtils::filterChildType(Node_base::TEXT_NODE, elem);
+ std::list<DOMNode*> scriptTexts = DOMUtils::filterChildType(DOMNode::TEXT_NODE, elem);
if (scriptTexts.size() > 0) {
stream << "\"";
- writeExecContent(stream, scriptTexts[0], 0);
+ writeExecContent(stream, scriptTexts.front(), 0);
stream << "\"";
} else {
stream << "NULL";
@@ -1234,7 +1253,7 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << " return USCXML_ERR_MISSING_CALLBACK;" << std::endl;
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "log") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "log") {
stream << padding;
stream << "if likely(ctx->exec_content_log != NULL) {" << std::endl;
stream << padding;
@@ -1246,7 +1265,7 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << " return USCXML_ERR_MISSING_CALLBACK;" << std::endl;
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "foreach") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "foreach") {
stream << padding << "if likely(ctx->exec_content_foreach_init != NULL &&" << std::endl;
stream << padding << " ctx->exec_content_foreach_next != NULL &&" << std::endl;
stream << padding << " ctx->exec_content_foreach_done != NULL) {" << std::endl;
@@ -1254,10 +1273,10 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << " if unlikely((ctx->exec_content_foreach_init(ctx, &" << _prefix << "_elem_foreachs[" << ATTR(elem, "documentOrder") << "])) != USCXML_ERR_OK) return err;" << std::endl;
stream << padding << " while (ctx->exec_content_foreach_next(ctx, &" << _prefix << "_elem_foreachs[" << ATTR(elem, "documentOrder") << "]) == USCXML_ERR_OK) {" << std::endl;
- Arabica::DOM::Node<std::string> child = node.getFirstChild();
+ DOMNode* child = node->getFirstChild();
while(child) {
writeExecContent(stream, child, indent + 2);
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
stream << padding << " }" << std::endl;
stream << padding << " if ((ctx->exec_content_foreach_done(ctx, &" << _prefix << "_elem_foreachs[" << ATTR(elem, "documentOrder") << "])) != USCXML_ERR_OK) return err;" << std::endl;
@@ -1265,30 +1284,30 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << " return USCXML_ERR_MISSING_CALLBACK;" << std::endl;
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "if") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "if") {
stream << padding;
stream << "if likely(ctx->is_true != NULL) {" << std::endl;
stream << padding;
stream << " if (ctx->is_true(ctx, " << (HAS_ATTR(elem, "cond") ? "\"" + escape(ATTR(elem, "cond")) + "\"" : "NULL") << ")) {" << std::endl;
- Arabica::DOM::Node<std::string> child = elem.getFirstChild();
+ DOMNode* child = elem->getFirstChild();
while(child) {
- if (child.getNodeType() == Node_base::ELEMENT_NODE && TAGNAME_CAST(child) == "elseif") {
+ if (child->getNodeType() == DOMNode::ELEMENT_NODE && TAGNAME_CAST(child) == "elseif") {
stream << padding;
stream << " } else if (ctx->is_true(ctx, " << (HAS_ATTR_CAST(child, "cond") ? "\"" + escape(ATTR_CAST(child, "cond")) + "\"" : "NULL") << ")) {" << std::endl;
- } else if (child.getNodeType() == Node_base::ELEMENT_NODE && TAGNAME_CAST(child) == "else") {
+ } else if (child->getNodeType() == DOMNode::ELEMENT_NODE && TAGNAME_CAST(child) == "else") {
stream << padding;
stream << " } else {" << std::endl;
} else {
writeExecContent(stream, child, indent + 2);
}
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
stream << padding << " }" << std::endl;
stream << padding << "} else {" << std::endl;
stream << padding << " return USCXML_ERR_MISSING_CALLBACK;" << std::endl;
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "assign") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "assign") {
stream << padding;
stream << "if likely(ctx->exec_content_assign != NULL) {" << std::endl;
stream << padding;
@@ -1299,7 +1318,7 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "raise") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "raise") {
stream << padding;
stream << "if likely(ctx->exec_content_raise != NULL) {" << std::endl;
stream << padding;
@@ -1310,7 +1329,7 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << " return USCXML_ERR_MISSING_CALLBACK;" << std::endl;
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "send") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "send") {
stream << padding;
stream << "if likely(ctx->exec_content_send != NULL) {" << std::endl;
stream << padding;
@@ -1320,7 +1339,7 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding << " return USCXML_ERR_MISSING_CALLBACK;" << std::endl;
stream << padding << "}" << std::endl;
- } else if(TAGNAME(elem) == "cancel") {
+ } else if(TAGNAME(elem) == XML_PREFIX(elem).str() + "cancel") {
stream << padding;
stream << "if likely(ctx->exec_content_cancel != NULL) {" << std::endl;
stream << padding;
@@ -1344,12 +1363,13 @@ void ChartToC::writeElementInfoInvocation(std::ostream& stream) {
stream << "#ifndef USCXML_NO_ELEM_INFO" << std::endl;
stream << std::endl;
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
+ std::list<DOMElement*> invokes = DOMUtils::filterChildElements(XML_PREFIX(_scxml).str() + "invoke", _scxml, true);
if (invokes.size() > 0) {
_hasElement.insert("invoke");
stream << "static const uscxml_elem_invoke " << _prefix << "_elem_invokes[" << invokes.size() << "] = {" << std::endl;
- for (size_t i = 0; i < invokes.size(); i++) {
- Element<std::string> invoke(invokes[i]);
+ size_t i = 0;
+ for (auto iter = invokes.begin(); iter != invokes.end(); iter++, i++) {
+ DOMElement* invoke = *iter;
/*
stream << "struct uscxml_elem_invoke {" << std::endl;
@@ -1421,7 +1441,7 @@ void ChartToC::writeElementInfoInvocation(std::ostream& stream) {
stream << ", " << std::endl;
stream << " /* sourcename */ ";
- stream << (HAS_ATTR_CAST(invoke.getParentNode(), "id") ? "\"" + escape(ATTR_CAST(invoke.getParentNode(), "id")) + "\"" : "NULL");
+ stream << (HAS_ATTR_CAST(invoke->getParentNode(), "id") ? "\"" + escape(ATTR_CAST(invoke->getParentNode(), "id")) + "\"" : "NULL");
stream << ", " << std::endl;
stream << " /* namelist */ ";
@@ -1441,32 +1461,32 @@ void ChartToC::writeElementInfoInvocation(std::ostream& stream) {
stream << ", " << std::endl;
stream << " /* finalize */ ";
- NodeSet<std::string> finalizes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invoke);
+ std::list<DOMElement*> finalizes = DOMUtils::filterChildElements(XML_PREFIX(invoke).str() + "finalize", invoke);
if (finalizes.size() > 0) {
- stream << _prefix << "_" << DOMUtils::idForNode(finalizes[0]);
+ stream << _prefix << "_" << DOMUtils::idForNode(finalizes.front());
} else {
stream << "NULL";
}
stream << ", " << std::endl;
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", invoke);
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(invoke).str() + "content", invoke);
if (contents.size() > 0 && !HAS_ATTR(invoke, "md5sum")) {
std::stringstream ss;
- NodeList<std::string> cChilds = contents[0].getChildNodes();
- for (size_t j = 0; j < cChilds.getLength(); j++) {
- ss << cChilds.item(j);
+ DOMNodeList* cChilds = contents.front()->getChildNodes();
+ for (size_t j = 0; j < cChilds->getLength(); j++) {
+ ss << cChilds->item(j);
}
stream << " /* content */ ";
stream << (ss.str().size() > 0 ? "\"" + escape(ss.str()) + "\", " : "NULL, ") << std::endl;
stream << " /* contentexpr */ ";
- stream << (HAS_ATTR_CAST(contents[0], "expr") ? "\"" + ATTR_CAST(contents[0], "expr") + "\", " : "NULL, ") << std::endl;
+ stream << (HAS_ATTR_CAST(contents.front(), "expr") ? "\"" + ATTR_CAST(contents.front(), "expr") + "\", " : "NULL, ") << std::endl;
} else {
stream << " /* content */ NULL," << std::endl;
stream << " /* contentexpr */ NULL," << std::endl;
}
stream << " }" << (i + 1 < invokes.size() ? ",": "") << std::endl;
- invoke.setAttribute("documentOrder", toStr(i));
+ invoke->setAttribute(X("documentOrder"), X(toStr(i)));
}
stream << "};" << std::endl;
@@ -1482,41 +1502,43 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << "#ifndef USCXML_NO_ELEM_INFO" << std::endl;
stream << std::endl;
- NodeSet<std::string> foreachs = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "foreach", _scxml);
+ std::list<DOMElement*> foreachs = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "foreach", _scxml);
if (foreachs.size() > 0) {
_hasElement.insert("foreach");
stream << "static const uscxml_elem_foreach " << _prefix << "_elem_foreachs[" << foreachs.size() << "] = {" << std::endl;
stream << " /* array, item, index */" << std::endl;
- for (size_t i = 0; i < foreachs.size(); i++) {
- Element<std::string> foreach(foreachs[i]);
+ size_t i = 0;
+ for (auto iter = foreachs.begin(); iter != foreachs.end(); iter++, i++) {
+ DOMElement* foreach = *iter;
stream << " { ";
stream << (HAS_ATTR(foreach, "array") ? "\"" + escape(ATTR(foreach, "array")) + "\"" : "NULL") << ", ";
stream << (HAS_ATTR(foreach, "item") ? "\"" + escape(ATTR(foreach, "item")) + "\"" : "NULL") << ", ";
stream << (HAS_ATTR(foreach, "index") ? "\"" + escape(ATTR(foreach, "index")) + "\"" : "NULL");
stream << " }" << (i + 1 < foreachs.size() ? ",": "") << std::endl;
- foreach.setAttribute("documentOrder", toStr(i));
+ foreach->setAttribute(X("documentOrder"), X(toStr(i)));
}
stream << "};" << std::endl;
stream << std::endl;
}
- NodeSet<std::string> assigns = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "assign", _scxml);
+ std::list<DOMElement*> assigns = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "assign", _scxml);
if (assigns.size() > 0) {
_hasElement.insert("assign");
stream << "static const uscxml_elem_assign " << _prefix << "_elem_assigns[" << assigns.size() << "] = {" << std::endl;
stream << " /* location, expr, content */" << std::endl;
- for (size_t i = 0; i < assigns.size(); i++) {
- Element<std::string> assign(assigns[i]);
+ size_t i = 0;
+ for (auto iter = assigns.begin(); iter != assigns.end(); iter++, i++) {
+ DOMElement* assign = *iter;
stream << " { ";
stream << (HAS_ATTR(assign, "location") ? "\"" + escape(ATTR(assign, "location")) + "\"" : "NULL") << ", ";
stream << (HAS_ATTR(assign, "expr") ? "\"" + escape(ATTR(assign, "expr")) + "\"" : "NULL") << ", ";
- NodeSet<std::string> assignTexts = DOMUtils::filterChildType(Node_base::TEXT_NODE, assign);
+ std::list<DOMNode*> assignTexts = DOMUtils::filterChildType(DOMNode::TEXT_NODE, assign);
if (assignTexts.size() > 0) {
- if (boost::trim_copy(assignTexts[0].getNodeValue()).length() > 0) {
- std::string escaped = escape(assignTexts[0].getNodeValue());
+ if (boost::trim_copy(X(assignTexts.front()->getNodeValue()).str()).length() > 0) {
+ std::string escaped = escape(X(assignTexts.front()->getNodeValue()).str());
stream << "\"" << escaped << "\"";
}
} else {
@@ -1524,7 +1546,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
}
stream << " }," << std::endl;
- assign.setAttribute("documentOrder", toStr(i));
+ assign->setAttribute(X("documentOrder"), X(toStr(i)));
}
stream << "};" << std::endl;
@@ -1532,50 +1554,51 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
}
- NodeSet<std::string> datas = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "data", _scxml);
+ std::list<DOMElement*> datas = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "data", _scxml);
if (datas.size() > 0) {
_hasElement.insert("data");
size_t dataIndexOffset = 0;
- Node<std::string> parent;
+ DOMNode* parent = NULL;
size_t distinctParents = 0;
if (_binding == InterpreterImpl::EARLY) {
- Element<std::string>(_states[0]).setAttribute("dataIndex", "0");
+ _states[0]->setAttribute(X("dataIndex"), X("0"));
distinctParents = 1;
} else {
- for (size_t i = 0; i < datas.size(); i++) {
- Element<std::string> data(datas[i]);
- if (data.getParentNode() != parent) {
+ for (auto iter = datas.begin(); iter != datas.end(); iter++) {
+ DOMElement* data = *iter;
+ if (data->getParentNode() != parent) {
distinctParents++;
}
}
}
- parent = Node<std::string>();
+ parent = NULL;
stream << "static const uscxml_elem_data " << _prefix << "_elem_datas[" << datas.size() + distinctParents << "] = {" << std::endl;
stream << " /* id, src, expr, content */" << std::endl;
- for (size_t i = 0; i < datas.size(); i++) {
- Element<std::string> data(datas[i]);
- if (data.getParentNode().getParentNode() != parent) {
+ size_t i = 0;
+ for (auto iter = datas.begin(); iter != datas.end(); iter++, i++) {
+ DOMElement* data = *iter;
+ if (data->getParentNode()->getParentNode() != parent) {
if (_binding == InterpreterImpl::LATE) {
if (i > 0) {
stream << " { NULL, NULL, NULL, NULL }," << std::endl;
dataIndexOffset++;
}
- Element<std::string>(data.getParentNode().getParentNode()).setAttribute("dataIndex", toStr(i + dataIndexOffset));
+ static_cast<DOMElement*>(data->getParentNode()->getParentNode())->setAttribute(X("dataIndex"), X(toStr(i + dataIndexOffset)));
}
- parent = data.getParentNode().getParentNode();
+ parent = data->getParentNode()->getParentNode();
}
stream << " { ";
stream << (HAS_ATTR(data, "id") ? "\"" + escape(ATTR(data, "id")) + "\"" : "NULL") << ", ";
stream << (HAS_ATTR(data, "src") ? "\"" + escape(ATTR(data, "src")) + "\"" : "NULL") << ", ";
stream << (HAS_ATTR(data, "expr") ? "\"" + escape(ATTR(data, "expr")) + "\"" : "NULL") << ", ";
- NodeSet<std::string> dataTexts = DOMUtils::filterChildType(Node_base::TEXT_NODE, data);
+ std::list<DOMNode*> dataTexts = DOMUtils::filterChildType(DOMNode::TEXT_NODE, data);
if (dataTexts.size() > 0) {
- if (boost::trim_copy(dataTexts[0].getNodeValue()).length() > 0) {
- std::string escaped = escape(dataTexts[0].getNodeValue());
+ if (boost::trim_copy(X(dataTexts.front()->getNodeValue()).str()).length() > 0) {
+ std::string escaped = escape(X(dataTexts.front()->getNodeValue()).str());
stream << "\"" << escaped << "\"";
}
} else {
@@ -1589,29 +1612,30 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl;
}
- NodeSet<std::string> params = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "param", _scxml);
+ std::list<DOMElement*> params = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "param", _scxml);
if (params.size() > 0) {
_hasElement.insert("param");
- Node<std::string> parent;
+ DOMNode* parent = NULL;
size_t distinctParents = 0;
- for (size_t i = 0; i < params.size(); i++) {
- Element<std::string> param(params[i]);
- if (param.getParentNode() != parent) {
+ for (auto iter = params.begin(); iter != params.end(); iter++) {
+ DOMElement* param = *iter;
+ if (param->getParentNode() != parent) {
distinctParents++;
}
}
- parent = Node<std::string>();
+ parent = NULL;
stream << "static const uscxml_elem_param " << _prefix << "_elem_params[" << params.size() + distinctParents << "] = {" << std::endl;
stream << " /* name, expr, location */" << std::endl;
- for (size_t i = 0; i < params.size(); i++) {
- Element<std::string> param(params[i]);
- if (param.getParentNode() != parent) {
- Element<std::string>(param.getParentNode()).setAttribute("paramIndex", toStr(i));
+ size_t i = 0;
+ for (auto iter = params.begin(); iter != params.end(); iter++, i++) {
+ DOMElement* param = *iter;
+ if (param->getParentNode() != parent) {
+ static_cast<DOMElement*>(param->getParentNode())->setAttribute(X("paramIndex"), X(toStr(i)));
if (i > 0) {
stream << " { NULL, NULL, NULL }," << std::endl;
}
- parent = param.getParentNode();
+ parent = param->getParentNode();
}
stream << " { ";
stream << (HAS_ATTR(param, "name") ? "\"" + escape(ATTR(param, "name")) + "\"" : "NULL") << ", ";
@@ -1625,12 +1649,13 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl;
}
- NodeSet<std::string> sends = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "send", _scxml);
+ std::list<DOMElement*> sends = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "send", _scxml);
if (sends.size() > 0) {
_hasElement.insert("send");
stream << "static const uscxml_elem_send " << _prefix << "_elem_sends[" << sends.size() << "] = {" << std::endl;
- for (size_t i = 0; i < sends.size(); i++) {
- Element<std::string> send(sends[i]);
+ size_t i = 0;
+ for (auto iter = sends.begin(); iter != sends.end(); iter++, i++) {
+ DOMElement* send = *iter;
stream << " { ";
stream << std::endl << " /* event */ ";
stream << (HAS_ATTR(send, "event") ? "\"" + escape(ATTR(send, "event")) + "\"" : "NULL") << ", ";
@@ -1655,17 +1680,17 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl << " /* namelist */ ";
stream << (HAS_ATTR(send, "namelist") ? "\"" + escape(ATTR(send, "namelist")) + "\"" : "NULL") << ", ";
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", send);
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(send).str() + "content", send);
if (contents.size() > 0) {
std::stringstream ss;
- NodeList<std::string> cChilds = contents[0].getChildNodes();
- for (size_t j = 0; j < cChilds.getLength(); j++) {
- ss << cChilds.item(j);
+ DOMNodeList* cChilds = contents.front()->getChildNodes();
+ for (size_t j = 0; j < cChilds->getLength(); j++) {
+ ss << *(cChilds->item(j));
}
stream << std::endl << " /* content */ ";
stream << (ss.str().size() > 0 ? "\"" + escape(ss.str()) + "\", " : "NULL, ");
stream << std::endl << " /* contentexpr */ ";
- stream << (HAS_ATTR_CAST(contents[0], "expr") ? "\"" + ATTR_CAST(contents[0], "expr") + "\", " : "NULL, ");
+ stream << (HAS_ATTR_CAST(contents.front(), "expr") ? "\"" + ATTR_CAST(contents.front(), "expr") + "\", " : "NULL, ");
} else {
stream << std::endl << " /* content */ ";
stream << "NULL,";
@@ -1682,32 +1707,34 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
}
stream << std::endl << " }" << (i + 1 < sends.size() ? ",": "") << std::endl;
- send.setAttribute("documentOrder", toStr(i));
+ send->setAttribute(X("documentOrder"), X(toStr(i)));
}
stream << "};" << std::endl;
stream << std::endl;
}
- NodeSet<std::string> donedatas = DOMUtils::inDocumentOrder(_nsInfo.xmlNSPrefix + "donedata", _scxml);
+ std::list<DOMElement*> donedatas = DOMUtils::inDocumentOrder(XML_PREFIX(_scxml).str() + "donedata", _scxml);
stream << "static const uscxml_elem_donedata " << _prefix << "_elem_donedatas[" << donedatas.size() + 1 << "] = {" << std::endl;
stream << " /* source, content, contentexpr, params */" << std::endl;
- for (size_t i = 0; i < donedatas.size(); i++) {
+ size_t i = 0;
+ for (auto iter = donedatas.begin(); iter != donedatas.end(); iter++, i++) {
+ DOMElement* donedata = *iter;
+
_hasElement.insert("donedata");
- Element<std::string> donedata(donedatas[i]);
stream << " { ";
// parent
- stream << ATTR_CAST(donedata.getParentNode(), "documentOrder") << ", ";
+ stream << ATTR_CAST(donedata->getParentNode(), "documentOrder") << ", ";
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", donedata);
+ std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(donedata).str() + "content", donedata);
if (contents.size() > 0) {
std::stringstream ss;
- NodeList<std::string> cChilds = contents[0].getChildNodes();
- for (size_t j = 0; j < cChilds.getLength(); j++) {
- ss << cChilds.item(j);
+ DOMNodeList* cChilds = contents.front()->getChildNodes();
+ for (size_t j = 0; j < cChilds->getLength(); j++) {
+ ss << cChilds->item(j);
}
stream << (ss.str().size() > 0 ? "\"" + escape(ss.str()) + "\", " : "NULL, ");
- stream << (HAS_ATTR_CAST(contents[0], "expr") ? "\"" + ATTR_CAST(contents[0], "expr") + "\", " : "NULL, ");
+ stream << (HAS_ATTR_CAST(contents.front(), "expr") ? "\"" + ATTR_CAST(contents.front(), "expr") + "\", " : "NULL, ");
} else {
stream << "NULL, NULL, ";
}
@@ -1719,7 +1746,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
}
stream << " }," << std::endl;
- donedata.setAttribute("documentOrder", toStr(i));
+ donedata->setAttribute(X("documentOrder"), X(toStr(i)));
}
stream << " { 0, NULL, NULL, NULL }" << std::endl;
stream << "};" << std::endl;
@@ -1751,6 +1778,7 @@ void ChartToC::writeMachineInfo(std::ostream& stream) {
if (_name.size() > 0) {
std::string macroName = boost::to_upper_copy(escape(_name));
boost::replace_all(macroName, "-", "_");
+ boost::replace_all(macroName, ".", "_");
stream << "#define USCXML_MACHINE_" << macroName << " " << _prefix << "_machine" << std::endl;
}
stream << std::endl;
@@ -1788,7 +1816,7 @@ void ChartToC::writeMachineInfo(std::ostream& stream) {
stream << " /* donedata */ " << "&" << _prefix << "_elem_donedatas[0], " << std::endl;
stream << " /* script */ ";
- if (DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", _scxml).size() > 0) {
+ if (DOMUtils::filterChildElements(XML_PREFIX(_scxml).str() + "script", _scxml).size() > 0) {
stream << _prefix << "_global_script" << std::endl;
} else {
stream << "NULL";
@@ -1829,7 +1857,7 @@ void ChartToC::writeMachineInfo(std::ostream& stream) {
stream << " /* donedata */ " << "&" << m->_prefix << "_elem_donedatas[0], " << std::endl;
stream << " /* script */ ";
- if (DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", _scxml).size() > 0) {
+ if (DOMUtils::filterChildElements(XML_PREFIX(node).str() + "script", _scxml).size() > 0) {
stream << m->_prefix << "_global_script" << std::endl;
} else {
stream << "NULL";
@@ -1855,7 +1883,7 @@ void ChartToC::writeStates(std::ostream& stream) {
stream << "static const uscxml_state " << _prefix << "_states[" << toStr(_states.size()) << "] = {" << std::endl;
for (size_t i = 0; i < _states.size(); i++) {
- Element<std::string> state(_states[i]);
+ DOMElement* state(_states[i]);
stream << " { /* state number " << toStr(i) << " */" << std::endl;
@@ -1866,22 +1894,22 @@ void ChartToC::writeStates(std::ostream& stream) {
// parent
stream << " /* parent */ ";
- stream << (i == 0 ? "0" : ATTR_CAST(state.getParentNode(), "documentOrder"));
+ stream << (i == 0 ? "0" : ATTR_CAST(state->getParentNode(), "documentOrder"));
stream << "," << std::endl;
// onentry
stream << " /* onentry */ ";
- stream << (DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onentry", state).size() > 0 ? _prefix + "_" + DOMUtils::idForNode(state) + "_on_entry" : "NULL");
+ stream << (DOMUtils::filterChildElements(XML_PREFIX(_scxml).str() + "onentry", state).size() > 0 ? _prefix + "_" + DOMUtils::idForNode(state) + "_on_entry" : "NULL");
stream << "," << std::endl;
// onexit
stream << " /* onexit */ ";
- stream << (DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onexit", state).size() > 0 ? _prefix + "_" + DOMUtils::idForNode(state) + "_on_exit" : "NULL");
+ stream << (DOMUtils::filterChildElements(XML_PREFIX(_scxml).str() + "onexit", state).size() > 0 ? _prefix + "_" + DOMUtils::idForNode(state) + "_on_exit" : "NULL");
stream << "," << std::endl;
// invokers
stream << " /* invoke */ ";
- stream << (DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", state).size() > 0 ? _prefix + "_" + DOMUtils::idForNode(state) + "_invoke" : "NULL");
+ stream << (DOMUtils::filterChildElements(XML_PREFIX(_scxml).str() + "invoke", state).size() > 0 ? _prefix + "_" + DOMUtils::idForNode(state) + "_invoke" : "NULL");
stream << "," << std::endl;
// children
@@ -1948,13 +1976,13 @@ void ChartToC::writeTransitions(std::ostream& stream) {
// cross reference transition by document order - is this really needed?!
std::set<std::string> elements;
- elements.insert(_nsInfo.xmlNSPrefix + "transition");
- NodeSet<std::string> transDocOrder = DOMUtils::inDocumentOrder(elements, _scxml);
+ elements.insert(XML_PREFIX(_scxml).str() + "transition");
+ std::list<DOMElement*> transDocOrder = DOMUtils::inDocumentOrder(elements, _scxml);
if (_transitions.size() > 0) {
stream << "static const uscxml_transition " << _prefix << "_transitions[" << toStr(_transitions.size()) << "] = {" << std::endl;
for (size_t i = 0; i < _transitions.size(); i++) {
- Element<std::string> transition(_transitions[i]);
+ DOMElement* transition(_transitions[i]);
stream << " { /* transition number " << ATTR(transition, "documentOrder") << " with priority " << toStr(i) << std::endl;
stream << " target: " << ATTR(transition, "target") << std::endl;
@@ -1962,7 +1990,7 @@ void ChartToC::writeTransitions(std::ostream& stream) {
// source
stream << " /* source */ ";
- stream << ATTR_CAST(transition.getParentNode(), "documentOrder");
+ stream << ATTR_CAST(transition->getParentNode(), "documentOrder");
stream << "," << std::endl;
// targets
@@ -1997,7 +2025,7 @@ void ChartToC::writeTransitions(std::ostream& stream) {
// on transition handlers
stream << " /* ontrans */ ";
- if (DOMUtils::filterChildType(Arabica::DOM::Node_base::ELEMENT_NODE, transition).size() > 0) {
+ if (DOMUtils::filterChildType(DOMNode::ELEMENT_NODE, transition).size() > 0) {
stream << _prefix << "_" << DOMUtils::idForNode(transition) + "_on_trans";
} else {
stream << "NULL";
@@ -2022,12 +2050,12 @@ void ChartToC::writeTransitions(std::ostream& stream) {
seperator = " | ";
}
- if (iequals(TAGNAME_CAST(transition.getParentNode()), "history")) {
+ if (iequals(TAGNAME_CAST(transition->getParentNode()), "history")) {
stream << seperator << "USCXML_TRANS_HISTORY";
seperator = " | ";
}
- if (iequals(TAGNAME_CAST(transition.getParentNode()), "initial")) {
+ if (iequals(TAGNAME_CAST(transition->getParentNode()), "initial")) {
stream << seperator << "USCXML_TRANS_INITIAL";
seperator = " | ";
}
@@ -2058,24 +2086,6 @@ void ChartToC::writeTransitions(std::ostream& stream) {
}
-Arabica::XPath::NodeSet<std::string> ChartToC::computeExitSet(const Arabica::DOM::Element<std::string>& transition) {
-
- NodeSet<std::string> statesToExit;
- if (!isTargetless(transition)) {
- Arabica::DOM::Node<std::string> domain = getTransitionDomain(transition);
- if (!domain)
- return statesToExit;
- for (unsigned int j = 0; j < _states.size(); j++) {
- const Node<std::string>& s = _states[j];
- if (isDescendant(s, domain)) {
- statesToExit.push_back(s);
- }
- }
- }
-
- return statesToExit;
-}
-
void ChartToC::writeCharArrayInitList(std::ostream& stream, const std::string& boolString) {
/**
* 0111 -> 0x08
@@ -2128,12 +2138,12 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << " USCXML_NR_TRANS_TYPE nr_trans_bytes = ((USCXML_NUMBER_TRANS + 7) & ~7) >> 3;" << std::endl;
stream << " int err = USCXML_ERR_OK;" << std::endl;
- stream << " char conflicts [USCXML_MAX_NR_TRANS_BYTES];" << std::endl;
- stream << " char trans_set [USCXML_MAX_NR_TRANS_BYTES];" << std::endl;
- stream << " char target_set [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
- stream << " char exit_set [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
- stream << " char entry_set [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
- stream << " char tmp_states [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char conflicts [USCXML_MAX_NR_TRANS_BYTES];" << std::endl;
+ stream << " unsigned char trans_set [USCXML_MAX_NR_TRANS_BYTES];" << std::endl;
+ stream << " unsigned char target_set [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char exit_set [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char entry_set [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
+ stream << " unsigned char tmp_states [USCXML_MAX_NR_STATES_BYTES];" << std::endl;
stream << std::endl;
stream << "#ifdef USCXML_VERBOSE" << std::endl;
diff --git a/src/uscxml/transform/ChartToC.h b/src/uscxml/transform/ChartToC.h
index 0c9c2e5..a34a2e0 100644
--- a/src/uscxml/transform/ChartToC.h
+++ b/src/uscxml/transform/ChartToC.h
@@ -20,20 +20,17 @@
#ifndef FSMTOCPP_H_201672B0
#define FSMTOCPP_H_201672B0
-#include "uscxml/interpreter/InterpreterRC.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/util/Trie.h"
+#include "uscxml/util/DOM.h"
+#include "uscxml/transform/Trie.h"
#include "Transformer.h"
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
+#include <xercesc/dom/DOM.hpp>
#include <ostream>
#include <set>
namespace uscxml {
-class USCXML_API ChartToC : public InterpreterRC, public TransformerImpl {
+class USCXML_API ChartToC : public TransformerImpl {
public:
virtual ~ChartToC();
@@ -61,11 +58,9 @@ protected:
void writeFSM(std::ostream& stream);
void writeCharArrayInitList(std::ostream& stream, const std::string& boolString);
- void writeExecContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent = 0);
+ void writeExecContent(std::ostream& stream, const xercesc::DOMNode* node, int indent = 0);
- Arabica::XPath::NodeSet<std::string> computeExitSet(const Arabica::DOM::Element<std::string>& transition);
-
- void resortStates(Arabica::DOM::Node<std::string>& node);
+ void resortStates(xercesc::DOMNode* node);
void setHistoryCompletion();
void setStateCompletion();
void prepare();
@@ -74,8 +69,8 @@ protected:
Interpreter interpreter;
- Arabica::XPath::NodeSet<std::string> _states;
- Arabica::XPath::NodeSet<std::string> _transitions;
+ std::vector<xercesc::DOMElement*> _states;
+ std::vector<xercesc::DOMElement*> _transitions;
std::string _md5;
std::string _prefix;
diff --git a/src/uscxml/transform/ChartToFSM.cpp b/src/uscxml/transform/ChartToFSM.cpp
deleted file mode 100644
index aa9dda8..0000000
--- a/src/uscxml/transform/ChartToFSM.cpp
+++ /dev/null
@@ -1,2035 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/transform/ChartToFSM.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-#include "uscxml/Convenience.h"
-#include "uscxml/Factory.h"
-#include "uscxml/debug/Complexity.h"
-
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-#include <DOM/io/Stream.hpp>
-#include <glog/logging.h>
-
-#include <iostream>
-#include "uscxml/UUID.h"
-#include <math.h>
-#include <string.h>
-#include <algorithm>
-#undef max
-#include <limits>
-
-#define UNDECIDABLE 2147483647
-#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
-
-#define DUMP_STATS(nrTrans, disregardTime) \
-uint64_t now = tthread::chrono::system_clock::now(); \
-if (now - _lastTimeStamp > 1000 || disregardTime) { \
- std::cerr << "## Transition: " << _perfTransUsed << " / " << _perfTransTotal << " [" << _perfTransProcessed << "/sec]"; \
- if (nrTrans > 0) { \
- std::cerr << " - 2**" << nrTrans << " = " << pow(2.0, static_cast<double>(nrTrans)); \
- } \
- std::cerr << std::endl; \
- std::cerr << "## State : " << _globalConf.size() << " found / " << _perfStackSize << " stacked / " << _perfStatesTotal << " seen [" << _perfStatesProcessed << "/sec]" << std::endl; \
- std::cerr << "## Microstep : " << _perfMicroStepTotal << " [" << _perfMicroStepProcessed << "/sec]" << std::endl; \
- std::cerr << "## Cached : " << _perfStatesCachedTotal << " [" << _perfStatesCachedProcessed << "/sec]" << std::endl; \
- std::cerr << "## Skipped : " << _perfStatesSkippedTotal << " [" << _perfStatesSkippedProcessed << "/sec]" << std::endl; \
- std::cerr << "## Queues : " << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << " / " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \
- std::cerr << "toFSM: "; \
- std::cerr << _perfTransUsed << ", " << _perfTransTotal << ", " << _perfTransProcessed << ", "; \
- std::cerr << _globalConf.size() << ", " << _perfStackSize << ", " << _perfStatesTotal << ", " << _perfStatesProcessed << ", "; \
- std::cerr << _perfMicroStepTotal << ", " << _perfMicroStepProcessed << ", "; \
- std::cerr << _perfStatesCachedTotal << ", " << _perfStatesCachedProcessed << ", " << _perfStatesSkippedTotal << ", " << _perfStatesSkippedProcessed << ", "; \
- std::cerr << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << ", " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \
- std::cerr << std::endl; \
- _perfTransProcessed = 0; \
- _perfStatesProcessed = 0; \
- _perfStatesCachedProcessed = 0; \
- _perfStatesSkippedProcessed = 0; \
- _perfMicroStepProcessed = 0; \
- if (!disregardTime)\
- _lastTimeStamp = now; \
-}
-
-//std::cerr << "Q: " << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << " / " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl;
-
-#define DUMP_TRANSSET(where) \
-{\
-std::cout << std::endl;\
-std::cout << "** " << transitions.size() << " ** " << where << std::endl;\
- for (size_t m = 0; m < transitions.size(); m++) {\
- std::cout << transitions[m] << std::endl;\
- }\
-}
-
-namespace uscxml {
-
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-
-#define DETAIL_EXEC_CONTENT(field, actPtr) \
-std::cerr << " " << #field << " / " << TAGNAME_CAST(actPtr->field) << " ("; \
-NodeSet<std::string> contents = filterChildType(Node_base::ELEMENT_NODE, actPtr->field, true); \
-for (size_t i = 0; i < contents.size(); i++) { \
- std::cerr << " " << TAGNAME_CAST(contents[i]); \
-} \
-std::cerr << ")";
-
-
-
-ChartToFSM::ChartToFSM(const Interpreter& other) {
-
- cloneFrom(other.getImpl());
-
- _transitionsFromTree = true;
- _keepInvalidTransitions = false;
- _lastTimeStamp = tthread::chrono::system_clock::now();
- _perfTransProcessed = 0;
- _perfTransTotal = 0;
- _perfTransUsed = 0;
- _perfStatesTotal = 0;
- _perfStatesProcessed = 0;
- _perfStackSize = 0;
- _perfStatesSkippedProcessed = 0;
- _perfStatesSkippedTotal = 0;
- _perfStatesCachedProcessed = 0;
- _perfStatesCachedTotal = 0;
- _perfMicroStepProcessed = 0;
- _perfMicroStepTotal = 0;
-
- if (envVarIEquals("USCXML_TRANSFORM_TRANS_FROM", "powerset"))
- _transitionsFromTree = false;
-
- _start = NULL;
- _currGlobalTransition = NULL;
- _transTree = NULL;
-
- _lastStateIndex = 0;
- _lastActiveIndex = 0;
- _lastTransIndex = 0;
-
- _maxEventSentChain = 0;
- _maxEventRaisedChain = 0;
- _doneEventRaiseTolerance = 0;
- _skipEventChainCalculations = false;
-
- addMonitor(this);
-}
-
-ChartToFSM::~ChartToFSM() {
- std::map<std::string, GlobalState*>::iterator confIter = _globalConf.begin();
- while(confIter != _globalConf.end()) {
- std::list<GlobalTransition*>::iterator transIter = confIter->second->sortedOutgoing.begin();
- while (transIter != confIter->second->sortedOutgoing.end()) {
- delete *transIter;
- transIter++;
- }
- delete confIter->second;
- confIter++;
- }
-
- // tear down caches
- Arabica::XPath::NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- for (size_t i = 0; i < allTransitions.size(); i++) {
- _transParents.erase(allTransitions[i]);
- }
-}
-
-Document<std::string> ChartToFSM::getDocument() const {
- if (_flatDoc)
- return _flatDoc;
- return _document;
-}
-
-InterpreterState ChartToFSM::interpret() {
-
- init();
- setupIOProcessors();
-
- {
- std::list<std::set<Element<std::string> > > allConfig = Complexity::getAllConfigurations(_scxml);
- for (std::list<std::set<Element<std::string> > >::iterator confIter = allConfig.begin(); confIter != allConfig.end(); confIter++) {
- std::string seperator;
- NodeSet<std::string> configNodeSet;
- std::set<Element<std::string> > config = *confIter;
- for (std::set<Element<std::string> >::iterator elemIter = config.begin(); elemIter != config.end(); elemIter++) {
-// std::cerr << seperator << ATTR((*elemIter), "id");
- seperator = ",";
- configNodeSet.push_back(*elemIter);
- }
- assert(isLegalConfiguration(configNodeSet));
-// std::cerr << std::endl;
- }
- }
- std::map<size_t, size_t> histoGramm = Complexity::getTransitionHistogramm(_scxml);
-// abort();
-
- uint64_t complexity = Complexity::stateMachineComplexity(this) + 1;
- std::cerr << "Approximate Complexity: " << complexity << std::endl;
- std::cerr << "Approximate Active Complexity: " << Complexity::stateMachineComplexity(this, Complexity::IGNORE_HISTORY | Complexity::IGNORE_NESTED_DATA) + 1 << std::endl;
-
- if (complexity > 1000) {
- _skipEventChainCalculations = true;
- _maxEventRaisedChain = UNDECIDABLE;
- _maxEventSentChain = UNDECIDABLE;
- }
- // initialize the datamodel
- std::string datamodelName;
- if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "datamodel"))
- datamodelName = ATTR(_scxml, "datamodel");
- if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "profile")) // SCION SCXML uses profile to specify datamodel
- datamodelName = ATTR(_scxml, "profile");
- if(datamodelName.length() > 0) {
- _dataModel = _factory->createDataModel(datamodelName, this);
- if (!_dataModel) {
- Event e;
- e.data.compound["cause"] = Data("Cannot instantiate datamodel", Data::VERBATIM);
- throw e;
- }
- } else {
- _dataModel = _factory->createDataModel("null", this);
- }
- if(datamodelName.length() > 0 && !_dataModel) {
- LOG(ERROR) << "No datamodel for " << datamodelName << " registered";
- }
-
- // setup caches
- {
- Arabica::XPath::NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- indexedTransitions.reserve(allTransitions.size());
- for (size_t i = 0; i < allTransitions.size(); i++) {
- _transParents[allTransitions[i]] = InterpreterImpl::getParentState(allTransitions[i]);
- }
- }
-
- // identify all history elements
- NodeSet<std::string> histories = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "history", _scxml, true);
- for (size_t i = 0; i < histories.size(); i++) {
- _historyTargets[ATTR_CAST(histories[i], "id")] = Element<std::string>(histories[i]);
- }
-
- _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
- _alreadyFlat = (HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat")));
-
- if (_alreadyFlat) {
- reassembleFromFlat();
- return _state;
- }
-
- // set invokeid for all invokers to parent state if none given
- NodeSet<std::string> invokers = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
- for (size_t i = 0; i < invokers.size(); i++) {
- Element<std::string> invokerElem = Element<std::string>(invokers[i]);
- invokerElem.setAttribute("parent", ATTR_CAST(invokerElem.getParentNode(), "id"));
- }
- // reset
- _globalConf.clear();
- _currGlobalTransition = NULL;
-
- // very first state
- _start = new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix, this);
- _globalConf[_start->stateId] = _start;
- _globalConf[_start->stateId]->index = _lastStateIndex++;
-
- NodeSet<std::string> initialTransitions;
-
- // enter initial configuration
- Arabica::XPath::NodeSet<std::string> initialStates;
- initialStates = getInitialStates();
- assert(initialStates.size() > 0);
- for (size_t i = 0; i < initialStates.size(); i++) {
- Element<std::string> initialElem = _document.createElementNS(_nsInfo.nsURL, "initial");
- _nsInfo.setPrefix(initialElem);
- initialElem.setAttribute("generated", "true");
- Element<std::string> transitionElem = _document.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(transitionElem);
- transitionElem.setAttribute("target", ATTR_CAST(initialStates[i], "id"));
- initialElem.appendChild(transitionElem);
- _scxml.appendChild(initialElem);
- initialTransitions.push_back(transitionElem);
- }
-
- if (!_skipEventChainCalculations)
- annotateRaiseAndSend(_scxml);
-
-// std::cout << _scxml << std::endl;
-
- indexTransitions();
-
- // add initial transitions as least prior
- for (size_t i = 0; i < initialTransitions.size() ; i++) {
- indexedTransitions.push_back(Element<std::string>(initialTransitions[i]));
- }
-
- // set index attribute for transitions
- for (size_t i = 0; i < indexedTransitions.size(); i++) {
-// std::cerr << toStr(i) << ":" << (HAS_ATTR(indexedTransitions[i], "line_start") ? ATTR(indexedTransitions[i], "line_start") : "");
-// std::cerr << "\t" << DOMUtils::xPathForNode(indexedTransitions[i]) << std::endl;
- indexedTransitions[i].setAttribute("index", toStr(i));
- }
-
-// int lastTransIndex = indexedTransitions.size();
-// for (size_t i = 0; i < initialTransitions.size() ; i++, lastTransIndex++) {
-// indexedTransitions[i].setAttribute("index", toStr(indexedTransitions.size() - 1 - i));
-// }
-
- // gather and set index attribute o states
- NodeSet<std::string> allStates = getAllStates();
- allStates.to_document_order();
-
- indexedStates.resize(allStates.size());
- for (size_t i = 0; i < allStates.size(); i++) {
- Element<std::string> state = Element<std::string>(allStates[i]);
-
- // while we are iterating, determine deepest nested level
- size_t nrAncs = getProperAncestors(state, _scxml).size();
- if (_doneEventRaiseTolerance < nrAncs)
- _doneEventRaiseTolerance = nrAncs;
-
- state.setAttribute("index", toStr(i));
- indexedStates[i] = state;
- }
-
-// std::cerr << _scxml << std::endl;
-
- // create a _flatDoc for the FSM
- DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- _flatDoc = domFactory.createDocument(_document.getNamespaceURI(), "", 0);
-
- GlobalTransition* globalTransition = new GlobalTransition(initialTransitions, _dataModel, this);
- globalTransition->index = _lastTransIndex++;
-
- _start->sortedOutgoing.push_back(globalTransition);
- globalTransition->source = _start->stateId;
- _currGlobalTransition = globalTransition;
-
- enterStates(initialTransitions);
- globalTransition->destination = FlatStateIdentifier::toStateId(_configuration);
- globalTransition->activeDestination = globalTransition->destination;
-
- explode();
-
- DUMP_STATS(0, true);
-
-#if 0
- // print set of global configurations
- for(std::map<std::string, GlobalState*>::iterator globalConfIter = _globalConf.begin();
- globalConfIter != _globalConf.end();
- globalConfIter++) {
- std::cerr << globalConfIter->first << std::endl;
- }
- std::cerr << _globalConf.size() << std::endl;
-#endif
-
- std::cerr << "Actual Complexity: " << _globalConf.size() << std::endl;
- std::cerr << "Actual Active Complexity: " << _activeConf.size() << std::endl;
- std::cerr << "Internal Queue: " << _maxEventRaisedChain << std::endl;
- std::cerr << "External Queue: " << _maxEventSentChain << std::endl;
-
-// if (complexity < _globalConf.size())
-// throw std::runtime_error("Upper bound for states exceeded");
-
- return _state;
-}
-
-void ChartToFSM::executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow) {
-// std::cerr << content << std::endl;
-// std::cerr << TAGNAME(content) << std::endl;
-
- GlobalTransition::Action action;
-
- NodeList<std::string> childs = content.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- Node_base::Type type = childs.item(i).getNodeType();
- if (type == Node_base::ELEMENT_NODE || type == Node_base::COMMENT_NODE || type == Node_base::TEXT_NODE) {
- goto HAS_VALID_CHILDREN;
- }
- }
- return;
-
-HAS_VALID_CHILDREN:
- if (false) {
- } else if (TAGNAME(content) == "transition") {
- action.transition = content;
- } else if (TAGNAME(content) == "onexit") {
- action.onExit = content;
- } else if (TAGNAME(content) == "onentry") {
- action.onEntry = content;
- } else if (TAGNAME(content) == "history") {
- assert(false);
- } else { // e.g. global script elements
- return;
- }
-
- if (!_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) {
- assert(content.hasAttribute("raise") && content.hasAttribute("send"));
-
- std::string raiseAttr = content.getAttribute("raise");
- std::string sendAttr = content.getAttribute("send");
-
- _currGlobalTransition->eventsRaised = (raiseAttr == "-1" ? UNDECIDABLE : _currGlobalTransition->eventsRaised + strTo<uint32_t>(raiseAttr));
- _currGlobalTransition->eventsSent = (sendAttr == "-1" ? UNDECIDABLE : _currGlobalTransition->eventsSent + strTo<uint32_t>(sendAttr));
-
- if (_currGlobalTransition->eventsRaised > _maxEventRaisedChain)
- _maxEventRaisedChain = _currGlobalTransition->eventsRaised;
- if (_currGlobalTransition->eventsSent > _maxEventSentChain)
- _maxEventSentChain = _currGlobalTransition->eventsSent;
- }
-
- _currGlobalTransition->actions.push_back(action);
- _currGlobalTransition->hasExecutableContent = true;
-}
-
-void ChartToFSM::invoke(const Arabica::DOM::Element<std::string>& element) {
- GlobalTransition::Action action;
- action.invoke = element;
- _currGlobalTransition->actions.push_back(action);
- _currGlobalTransition->hasExecutableContent = true;
-}
-
-void ChartToFSM::cancelInvoke(const Arabica::DOM::Element<std::string>& element) {
- GlobalTransition::Action action;
- action.uninvoke = element;
- _currGlobalTransition->actions.push_back(action);
- _currGlobalTransition->hasExecutableContent = true;
-}
-
-void ChartToFSM::internalDoneSend(const Arabica::DOM::Element<std::string>& state, const Arabica::DOM::Element<std::string>& doneData) {
- if (!isState(state))
- return;
-
-// if (LOCALNAME(state) == "scxml")
-// return;
-
-// if (parentIsScxmlState(state))
-// return;
-
-// return;
-// std::cerr << "internalDoneSend: " << state << std::endl;
-
- // create onentry with a raise element
- Element<std::string> onentry = _flatDoc.createElementNS(_nsInfo.nsURL, "onentry");
- _nsInfo.setPrefix(onentry);
-
- Element<std::string> raise = _flatDoc.createElementNS(_nsInfo.nsURL, "raise");
- _nsInfo.setPrefix(raise);
-
- onentry.appendChild(raise);
-
- if (doneData) {
- Arabica::XPath::NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", doneData);
- if (contents.size() > 0) {
- Node<std::string> imported = _flatDoc.importNode(contents[0], true);
- raise.appendChild(imported);
- }
- Arabica::XPath::NodeSet<std::string> params = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", doneData);
- if (params.size() > 0) {
- Node<std::string> imported = _flatDoc.importNode(params[0], true);
- raise.appendChild(imported);
- }
- }
-
-
- raise.setAttribute("event", "done.state." + ATTR_CAST(state, "id")); // parent?!
-
- GlobalTransition::Action action;
- action.raiseDone = onentry; // HERE!
-
- _currGlobalTransition->actions.push_back(action);
- if (!_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE))
- _currGlobalTransition->eventsRaised++;
- _currGlobalTransition->hasExecutableContent = true;
-
-}
-
-static bool isSuperset(const GlobalTransition* t1, const GlobalTransition* t2) {
- bool isSuperset = true;
-
- if (t1->transitionRefs.size() >= t2->transitionRefs.size())
- return false;
-
- NodeSet<std::string> t1Trans = t1->getTransitions();
- NodeSet<std::string> t2Trans = t2->getTransitions();
-
- for (size_t i = 0; i < t1Trans.size(); i++) {
- if (!InterpreterImpl::isMember(t1Trans[i], t2Trans)) {
- isSuperset = false;
- }
- }
- return isSuperset;
-}
-
-// return false if two transitions have the same source
-std::map<Arabica::DOM::Node<std::string>, Arabica::DOM::Node<std::string> > ChartToFSM::_transParents;
-bool ChartToFSM::filterSameState(const NodeSet<std::string>& transitions) {
-
- for (unsigned int i = 0; i < transitions.size(); i++) {
- Node<std::string> p1 = _transParents[transitions[i]];
-
- for (unsigned int j = i + 1; j < transitions.size(); j++) {
-// if (i == j)
-// continue;
- Node<std::string> p2 = _transParents[transitions[j]];
-
- if (p1 == p2)
- return false;
- }
- }
- return true;
-}
-
-static bool filterSameHierarchy(const NodeSet<std::string>& transitions) {
- for (unsigned int i = 0; i < transitions.size(); i++) {
- Node<std::string> t1 = transitions[i];
- Node<std::string> p1 = InterpreterImpl::getParentState(t1);
- for (unsigned int j = i + 1; j < transitions.size(); j++) {
- Node<std::string> t2 = transitions[j];
- Node<std::string> p2 = InterpreterImpl::getParentState(t2);
- while(p2) {
- if (p1 == p2) {
- return false;
- }
- p2 = p2.getParentNode();
- }
- }
- }
- return true;
-}
-
-
-static bool filterChildEnabled(const NodeSet<std::string>& transitions) {
- // drop any transition that is already enabled by a child
- NodeSet<std::string> filteredTransitions;
- for (unsigned int i = 0; i < transitions.size(); i++) {
- Node<std::string> t1 = transitions[i];
- Node<std::string> p1 = InterpreterImpl::getParentState(t1);
- for (unsigned int j = 0; j < transitions.size(); j++) {
- if (i == j)
- continue;
- Node<std::string> t2 = transitions[j];
- Node<std::string> p2 = InterpreterImpl::getParentState(t2);
- p2 = p2.getParentNode(); // TODO: think about again!
- while(p2) {
- if (p1 == p2) {
- std::string eventDesc1 = ATTR_CAST(t1, "event");
- std::string eventDesc2 = ATTR_CAST(t2, "event");
- if (nameMatch(eventDesc1, eventDesc2)) {
- return false;
- }
- }
- p2 = p2.getParentNode();
- }
- }
- filteredTransitions.push_back(t1);
- ;
- }
- return true;
-}
-
-bool ChartToFSM::hasForeachInBetween(const Arabica::DOM::Node<std::string>& ancestor, const Arabica::DOM::Node<std::string>& child) {
- if (!ancestor || !child)
- return false;
-
- Node<std::string> currChild = child;
- while(currChild != ancestor) {
- if (!currChild.getParentNode())
- return false;
- if (TAGNAME_CAST(currChild) == "foreach")
- return true;
- currChild = currChild.getParentNode();
- }
- return false;
-}
-
-void ChartToFSM::annotateRaiseAndSend(const Arabica::DOM::Element<std::string>& root) {
- NodeSet<std::string> execContent;
- execContent.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true));
- execContent.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onentry", _scxml, true));
- execContent.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onexit", _scxml, true));
- for (size_t i = 0; i < execContent.size(); i++) {
- Element<std::string> execContentElem(execContent[i]);
-
- int nrRaise = 0;
- NodeSet<std::string> raise = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "raise", execContent[i], true);
- for (size_t j = 0; j < raise.size(); j++) {
- if (hasForeachInBetween(execContent[i], raise[j])) {
- execContentElem.setAttribute("raise", "-1");
- goto DONE_COUNT_RAISE;
- } else {
- nrRaise++;
- }
- }
- execContentElem.setAttribute("raise", toStr(nrRaise));
-
-DONE_COUNT_RAISE:
-
- int nrSend = 0;
- NodeSet<std::string> sends = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "send", execContent[i], true);
- for (size_t j = 0; j < sends.size(); j++) {
- if (hasForeachInBetween(execContent[i], sends[j])) {
- execContentElem.setAttribute("send", "-1");
- goto DONE_COUNT_SEND;
- } else {
- nrSend++;
- }
- }
- execContentElem.setAttribute("send", toStr(nrSend));
-
-DONE_COUNT_SEND:
- ;
- }
-}
-
-void ChartToFSM::annotateDomain() {
- Arabica::XPath::NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- for (size_t i = 0; i < allTransitions.size(); i++) {
- Element<std::string> transition(allTransitions[i]);
- Arabica::DOM::Node<std::string> domain = getTransitionDomain(transition);
- if (domain) {
- transition.setAttribute("domain", (HAS_ATTR_CAST(domain, "id") ? ATTR_CAST(domain, "id") : DOMUtils::xPathForNode(domain)));
- } else {
- transition.setAttribute("domain", "#UNDEF");
- }
- }
-}
-
-void ChartToFSM::annotateExitSet() {
- Arabica::XPath::NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- for (size_t i = 0; i < allTransitions.size(); i++) {
- Element<std::string> transition(allTransitions[i]);
- Arabica::DOM::Node<std::string> domain = getTransitionDomain(transition);
-
- Arabica::XPath::NodeSet<std::string> allStates = getAllStates();
- std::ostringstream exitSetStr;
- std::string seperator = "";
- for (size_t j = 0; j < allStates.size(); j++) {
- Element<std::string> state(allStates[j]);
- if (state.getParentNode() == domain) {
- exitSetStr << seperator << (HAS_ATTR(state, "id") ? ATTR(state, "id") : DOMUtils::xPathForNode(state));
- seperator = ", ";
- }
- }
- transition.setAttribute("exitset", exitSetStr.str());
- }
-}
-
-void ChartToFSM::annotateEntrySet() {
- Arabica::XPath::NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- for (size_t i = 0; i < allTransitions.size(); i++) {
- Element<std::string> transition(allTransitions[i]);
-
- NodeSet<std::string> tmpTransitions;
- NodeSet<std::string> tmpStatesToEnter;
- NodeSet<std::string> tmpStatesForDefaultEntry;
- std::map<std::string, Arabica::DOM::Node<std::string> > tmpDefaultHistoryContent;
-
- tmpTransitions.push_back(transition);
- computeEntrySet(tmpTransitions, tmpStatesToEnter, tmpStatesForDefaultEntry, tmpDefaultHistoryContent);
-
- std::ostringstream entrySetStr;
- std::string seperator = "";
-
- for (size_t j = 0; j < tmpStatesToEnter.size(); j++) {
- Element<std::string> state(tmpStatesToEnter[j]);
- entrySetStr << seperator << (HAS_ATTR(state, "id") ? ATTR(state, "id") : DOMUtils::xPathForNode(state));
- seperator = ", ";
- }
- for (size_t j = 0; j < tmpStatesForDefaultEntry.size(); j++) {
- Element<std::string> state(tmpStatesForDefaultEntry[j]);
- entrySetStr << seperator << (HAS_ATTR(state, "id") ? ATTR(state, "id") : DOMUtils::xPathForNode(state));
- seperator = ", ";
- }
- transition.setAttribute("entryset", entrySetStr.str());
-
- }
-}
-
-void ChartToFSM::annotateConflicts() {
- Arabica::XPath::NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- Arabica::XPath::NodeSet<std::string> allStates = getAllStates();
-
- for (size_t i = 0; i < allTransitions.size(); i++) {
- Element<std::string> t1(allTransitions[i]);
- if (!isState(Element<std::string>(t1.getParentNode())))
- continue;
-
- Arabica::DOM::Node<std::string> d1 = getTransitionDomain(t1);
-
- Arabica::XPath::NodeSet<std::string> exitSet1;
- for (size_t k = 0; k < allStates.size(); k++) {
- Element<std::string> state(allStates[k]);
- if (isDescendant(state, d1)) {
- exitSet1.push_back(state);
- }
- }
-
- std::ostringstream preemptionStr;
- std::string seperator = "";
-
- for (size_t j = 0; j < allTransitions.size(); j++) {
- if ( i == j)
- continue;
-
- Element<std::string> t2(allTransitions[j]);
- if (!isState(Element<std::string>(t2.getParentNode())))
- continue;
-
- Arabica::DOM::Node<std::string> d2 = getTransitionDomain(t2);
-
- Arabica::XPath::NodeSet<std::string> exitSet2;
- for (size_t k = 0; k < allStates.size(); k++) {
- Element<std::string> state(allStates[k]);
- if (isDescendant(state, d2)) {
- exitSet2.push_back(state);
- }
- }
-
- if (hasIntersection(exitSet1, exitSet2)) {
- preemptionStr << seperator << (HAS_ATTR(t2, "priority") ? ATTR(t2, "priority") : DOMUtils::xPathForNode(t2));
- seperator = ", ";
- }
-
-// if (isDescendant(d1, d2) || isDescendant(d2, d1) || d1 == d2) {
-// preemptionStr << seperator << ATTR(t2, "priority");
-// seperator = ", ";
-// }
-
- }
- if (preemptionStr.str().size() > 0)
- t1.setAttribute("conflicts", preemptionStr.str());
-
- }
-}
-
-void ChartToFSM::indexTransitions() {
- indexedTransitions.clear();
- indexTransitions(_scxml);
-
-#if 1
- size_t index = indexedTransitions.size() - 1;
- for (std::vector<Arabica::DOM::Element<std::string> >::iterator transIter = indexedTransitions.begin(); transIter != indexedTransitions.end(); transIter++) {
- transIter->setAttribute("priority", toStr(index));
- index--;
- }
-#else
- size_t index = 0;
- for (std::vector<Arabica::DOM::Element<std::string> >::iterator transIter = indexedTransitions.begin(); transIter != indexedTransitions.end(); transIter++) {
- transIter->setAttribute("priority", toStr(index));
- index++;
- }
-#endif
- // reverse indices for most prior to be in front
- //std::reverse(indexedTransitions.begin(), indexedTransitions.end());
-}
-
-#if 0
-void ChartToFSM::indexTransitions(const Arabica::DOM::Element<std::string>& root) {
- // breadth first traversal of transitions
- Arabica::XPath::NodeSet<std::string> levelTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", root);
- for (int i = levelTransitions.size() - 1; i >= 0; i--) {
- // push into index starting with least prior
- indexedTransitions.push_back(Element<std::string>(levelTransitions[i]));
- }
-
- Arabica::XPath::NodeSet<std::string> nextLevel = filterChildType(Arabica::DOM::Node_base::ELEMENT_NODE, root);
- for (int i = nextLevel.size() - 1; i >= 0; i--) {
- Element<std::string> stateElem = Element<std::string>(nextLevel[i]);
- if (isState(stateElem))
- indexTransitions(stateElem);
- }
-}
-
-#else
-
-void ChartToFSM::indexTransitions(const Arabica::DOM::Element<std::string>& root) {
- // Post-order traversal of transitions
- Arabica::XPath::NodeSet<std::string> childStates = getChildStates(root);
- for (size_t i = 0; i < childStates.size(); i++) {
- Element<std::string> childElem(childStates[i]);
- indexTransitions(childElem);
- }
-
- Arabica::XPath::NodeSet<std::string> levelTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", root);
- for (size_t i = 0; i < levelTransitions.size(); i++) {
- // push into index starting with least prior
- indexedTransitions.push_back(Element<std::string>(levelTransitions[i]));
- }
-
-}
-
-#endif
-bool GlobalTransition::operator< (const GlobalTransition& other) const {
- const std::vector<Arabica::DOM::Element<std::string> >& indexedTransitions = interpreter->indexedTransitions;
- NodeSet<std::string> transitions = getTransitions();
-
- for (std::vector<Element<std::string> >::const_iterator transIter = indexedTransitions.begin(); transIter != indexedTransitions.end(); transIter++) {
- const Element<std::string>& refTrans = *transIter;
- NodeSet<std::string> otherTransitions = other.getTransitions();
-
- if (InterpreterImpl::isMember(refTrans, transitions) && !InterpreterImpl::isMember(refTrans, otherTransitions)) {
- return true;
- }
- if (!InterpreterImpl::isMember(refTrans, transitions) && InterpreterImpl::isMember(refTrans, otherTransitions)) {
- return false;
- }
- }
- return true; // actually, they are equal
-}
-
-template <typename T> bool PtrComp(const T * const & a, const T * const & b) {
- return *a < *b;
-}
-
-
-/**
- * subset only removes transitions without cond -> superset will always be enabled
- */
-bool hasUnconditionalSuperset(GlobalTransition* first, GlobalTransition* second) {
-
- NodeSet<std::string> firstTransitions = first->getTransitions();
- NodeSet<std::string> secondTransitions = second->getTransitions();
-
-// if (first->condition.size() > 0)
-// return false;
-
- if (isSuperset(second, first)) {
- for (size_t i = 0; i < firstTransitions.size(); i++) {
- if (!InterpreterImpl::isMember(firstTransitions[i], secondTransitions)) {
- if (HAS_ATTR_CAST(firstTransitions[i], "cond")) {
- return false; // second can't be removed
- }
- }
- }
- return true; // remove second
- }
- return false; //second can't be removed
-}
-
-/**
- * earlier transition is conditionless for same event
- */
-bool hasEarlierUnconditionalMatch(GlobalTransition* first, GlobalTransition* second) {
- if (first->eventDesc == second->eventDesc) {
- if (first->condition.size() == 0)
- return true;
- }
- return false;
-}
-
-std::list<GlobalTransition*> redundantRemove(std::list<GlobalTransition*> list) {
-#if 1
- std::list<GlobalTransition*>::iterator outerIter;
- std::list<GlobalTransition*>::iterator innerIter;
-
- outerIter = list.begin();
- while(outerIter != list.end()) {
- innerIter = outerIter;
-
- while(innerIter != list.end()) {
- if (innerIter == outerIter) {
- innerIter++;
- continue;
- }
-
- GlobalTransition* t1 = *outerIter;
- GlobalTransition* t2 = *innerIter;
-
- if (hasUnconditionalSuperset(t1, t2)) {
- list.erase(innerIter++);
- continue;
- } else if (hasUnconditionalSuperset(t2, t1)) {
- list.erase(outerIter++);
- break;
- }
- if (hasEarlierUnconditionalMatch(t1, t2)) {
- list.erase(innerIter++);
- continue;
- }
- innerIter++;
- }
-
- outerIter++;
- }
-
-#else
-
- for (std::list<GlobalTransition*>::iterator outerIter = list.begin();
- outerIter != list.end();
- outerIter++) {
- for (std::list<GlobalTransition*>::iterator innerIter = outerIter;
- innerIter != list.end();
- innerIter++) {
-
- if (innerIter == outerIter)
- continue;
-
- GlobalTransition* t1 = *outerIter;
- GlobalTransition* t2 = *innerIter;
-
- if (hasUnconditionalSuperset(t1, t2)) {
- innerIter = list.erase(innerIter);
- continue;
- } else if (hasUnconditionalSuperset(t2, t1)) {
- outerIter = list.erase(outerIter);
- continue;
- }
- if (hasEarlierUnconditionalMatch(t1, t2)) {
- innerIter = list.erase(innerIter);
- continue;
- }
- }
- }
-#endif
- return list;
-}
-
-std::list<GlobalTransition*> redundantMark(std::list<GlobalTransition*> list) {
-#if 1
- std::list<GlobalTransition*>::iterator outerIter;
- std::list<GlobalTransition*>::iterator innerIter;
-
- outerIter = list.begin();
- while(outerIter != list.end()) {
- innerIter = outerIter;
-
- while(innerIter != list.end()) {
- if (innerIter == outerIter) {
- innerIter++;
- continue;
- }
-
- GlobalTransition* t1 = *outerIter;
- GlobalTransition* t2 = *innerIter;
-
- if (!t1->isValid || !t2->isValid) {
- innerIter++;
- continue;
- }
-
- if (hasUnconditionalSuperset(t1, t2)) {
- t2->isValid = false;
- t2->invalidMsg = "Unconditional superset";
- t2->invalidReason = GlobalTransition::UNCONDITIONAL_SUPERSET;
- innerIter++;
- continue;
- } else if (hasUnconditionalSuperset(t2, t1)) {
- t1->isValid = false;
- t1->invalidMsg = "Unconditional superset";
- t1->invalidReason = GlobalTransition::UNCONDITIONAL_SUPERSET;
- outerIter++;
- break;
- }
- if (hasEarlierUnconditionalMatch(t1, t2)) {
- t2->isValid = false;
- t2->invalidMsg = "Earlier unconditional match";
- t2->invalidReason = GlobalTransition::UNCONDITIONAL_MATCH;
- innerIter++;
- continue;
- }
- innerIter++;
- }
-
- outerIter++;
- }
-
-#else
-
- for (std::list<GlobalTransition*>::iterator outerIter = list.begin();
- outerIter != list.end();
- outerIter++) {
- for (std::list<GlobalTransition*>::iterator innerIter = outerIter;
- innerIter != list.end();
- innerIter++) {
-
- if (innerIter == outerIter)
- continue;
-
- GlobalTransition* t1 = *outerIter;
- GlobalTransition* t2 = *innerIter;
-
- if (!t1->isValid || !t2->isValid)
- continue;
-
- if (hasUnconditionalSuperset(t1, t2)) {
- t2->isValid = false;
- t2->invalidMsg = "Unconditional superset";
- t2->invalidReason = GlobalTransition::UNCONDITIONAL_SUPERSET;
- continue;
- } else if (hasUnconditionalSuperset(t2, t1)) {
- t1->isValid = false;
- t1->invalidMsg = "Unconditional superset";
- t1->invalidReason = GlobalTransition::UNCONDITIONAL_SUPERSET;
- continue;
- }
- if (hasEarlierUnconditionalMatch(t1, t2)) {
- t2->isValid = false;
- t2->invalidMsg = "Earlier unconditional match";
- t2->invalidReason = GlobalTransition::UNCONDITIONAL_MATCH;
- continue;
- }
- }
- }
-#endif
- return list;
-}
-
-
-void TransitionTreeNode::dump(int indent) {
- std::string padding;
- for (size_t i = 0; i + 1 < indent; i++) {
- padding += "| ";
- }
- if (indent > 0)
- padding += "|-";
-
- std::string typeString;
- switch (type) {
- case TYPE_NESTED:
- typeString = "NESTED";
- break;
- case TYPE_PARALLEL:
- typeString = "PARALLEL";
- break;
- case TYPE_TRANSITION:
- typeString = "TRANSITION";
- break;
- case TYPE_UNDEFINED:
- typeString = "UNDEFINED";
- break;
- break;
- default:
- break;
- }
-
-
- if (transition) {
- std::cerr << padding << "t" << ATTR(transition, "index") << " " << typeString << ": ";
-// std::cerr << (prevTransition != NULL ? " (" + prevTransition->nodeId + ") <-" : "");
- std::cerr << "[" << nodeId << "]";
-// std::cerr << (nextTransition != NULL ? " -> (" + nextTransition->nodeId + ")" : "");
- std::cerr << std::endl;
- } else {
- std::cerr << padding << ATTR(state, "id") << " " << typeString << ": " << "[" << nodeId << "]";
-// std::cerr << (firstTransition != NULL ? " -> " + firstTransition->nodeId : "");
- std::cerr << std::endl;
- }
-
- for (std::list<TransitionTreeNode*>::iterator childIter = children.begin(); childIter != children.end(); childIter++) {
- (*childIter)->dump(indent + 1);
- }
-}
-
-void ChartToFSM::getPotentialTransitionsForConfFromTree(const Arabica::XPath::NodeSet<std::string>& conf, std::map<std::string, GlobalTransition*>& outMap) {
- if (_transTree == NULL) {
- _transTree = buildTransTree(_scxml, "0");
-// _transTree->dump();
- }
- std::string seperator;
-
-
-// std::cerr << "--- ";
-
- // recursion start
- std::set<TransitionTreeNode*> transLeafs;
-
- for (size_t i = 0; i < conf.size(); i++) {
- DUMP_STATS(conf.size(), false);
-
- Element<std::string> confElem(conf[i]);
- assert(_stateToTransTreeNode.find(confElem) != _stateToTransTreeNode.end());
- TransitionTreeNode* node = _stateToTransTreeNode[confElem];
- if (node->firstState == NULL) { // a leaf - ignore intermediates
- // ascend to the first parent with transitions but stop at parallel nodes
- while(node != NULL && node->firstTransition == NULL) {
- if (node->parent && node->parent->type == TransitionTreeNode::TYPE_PARALLEL)
- break;
- node = node->parent;
- }
- if (node != NULL) {
- transLeafs.insert(node);
- } else {
- //std::cerr << ATTR(confElem, "id") << " does not cause transitions" << std::endl;
- }
- }
- }
-
- std::list<std::set<TransitionTreeNode*> > stack;
- stack.push_back(transLeafs); // push follow-up configurations onto stack
-
- while (stack.size() > 0) {
- // pop from front of stack
- std::set<TransitionTreeNode*> stateList = stack.front();
- stack.pop_front();
-
- DUMP_STATS(conf.size(), false);
-
-#if 0
- seperator = "";
- std::cerr << "Current set: ";
- for (std::set<TransitionTreeNode*>::iterator transIter = stateList.begin(); transIter != stateList.end(); transIter++) {
- std::cerr << seperator << (*transIter)->nodeId;
- seperator = ", ";
- }
- std::cerr << std::endl;
-#endif
-
- /*
- * TransNodes contains a set of lists of transitions.
- * In the inner stack we build every possible combination
- * of picking at-most one from each list.
- */
-
- /* create global transitions for every n-tuple in current set of lists */
- std::list<std::pair<std::set<TransitionTreeNode*>, std::set<TransitionTreeNode*> > > innerStack;
- innerStack.push_back(std::make_pair(std::set<TransitionTreeNode*>(), stateList));
-
- while(innerStack.size() > 0) {
-
- // picking at-most one from each list
- std::set<TransitionTreeNode*> remainingStates = innerStack.front().second;
- std::set<TransitionTreeNode*> fixedTransitions = innerStack.front().first;
- innerStack.pop_front();
-
- if (remainingStates.size() > 0) {
- // iterate for each first element fixed
- TransitionTreeNode* firstRemainingState = *remainingStates.begin();
- remainingStates.erase(remainingStates.begin());
-
- if (firstRemainingState->firstTransition == NULL) {
- // no transitions at this state - reenqueue with NULL selection from this
- innerStack.push_back(std::make_pair(fixedTransitions, remainingStates));
- continue;
- }
-
- TransitionTreeNode* currTrans = firstRemainingState->firstTransition;
-
- // choose none from firstList
- innerStack.push_back(std::make_pair(fixedTransitions, remainingStates));
-
- while(currTrans != NULL) {
- std::set<TransitionTreeNode*> fixedAndThis(fixedTransitions);
- fixedAndThis.insert(currTrans);
- innerStack.push_back(std::make_pair(fixedAndThis, remainingStates));
- currTrans = currTrans->nextTransition;
- }
- } else {
- DUMP_STATS(conf.size(), false);
-
- if (fixedTransitions.size() > 0) {
-
- _perfTransTotal++;
- _perfTransProcessed++;
-
- NodeSet<std::string> fixed;
-
-#if 0
- seperator = "";
- for (std::set<TransitionTreeNode*>::iterator itemIter = fixedTransitions.begin(); itemIter != fixedTransitions.end(); itemIter++) {
- TransitionTreeNode* currItem = *itemIter;
- std::cerr << seperator << currItem->nodeId;
- seperator = ", ";
- }
- std::cerr << " ## ";
-#endif
-
- seperator = "";
- for (std::set<TransitionTreeNode*>::iterator itemIter = fixedTransitions.begin(); itemIter != fixedTransitions.end(); itemIter++) {
- TransitionTreeNode* currItem = *itemIter;
- fixed.push_back(currItem->transition);
-// std::cerr << seperator << ATTR(currItem->transition, "index");
- seperator = ", ";
- }
-// std::cerr << std::endl;
-
- // fixed contains a transiton set!
- assert(filterSameState(fixed));
-// assert(filterChildEnabled(fixed));
- assert(filterSameHierarchy(fixed));
- // do not add if they preempt
- if (fixed.size() != removeConflictingTransitions(fixed).size()) {
-// std::cerr << " - PREEMPTS" << std::endl;
- continue;
- }
-
- GlobalTransition* transition = new GlobalTransition(fixed, _dataModel, this);
- transition->index = _lastTransIndex++;
-
-// assert(outMap.find(transition->transitionId) == outMap.end());
-
- if (!transition->isValid && !_keepInvalidTransitions) {
- delete(transition);
-// std::cerr << " - INVALID" << std::endl;
- continue;
- }
-
- _perfTransUsed++;
-
- outMap[transition->transitionId] = transition;
-// std::cerr << " - GOOD" << std::endl;
- }
- }
- }
-
- // create new set of transition lists by moving to parent states
- for (std::set<TransitionTreeNode*>::iterator stateIter = stateList.begin(); stateIter != stateList.end(); stateIter++) {
- TransitionTreeNode* origState = *stateIter;
- TransitionTreeNode* currState = origState;
- TransitionTreeNode* parentState = currState->parent;
-
- /**
- * We ascend the current state via its parent and add the parent with transitions.
- * However, we break if we reached the top or if we passed a parallel state for
- * wich we are not the first child
- */
-
- while(parentState != NULL) {
- if (parentState->type == TransitionTreeNode::TYPE_PARALLEL && parentState->firstState != currState) {
- // the first child of the parallel state will continue this transition - we made sure to keep them
- break;
- }
-
- if (parentState->firstTransition != NULL) {
-// std::cerr << "#### Adding new parent lists for " << origState->nodeId << std::endl;
-
- std::set<TransitionTreeNode*> newStateList;
- newStateList.insert(parentState);
-
- // add all other states that are not a child of the parent state
- for (std::set<TransitionTreeNode*>::iterator newlistIter = stateList.begin(); newlistIter != stateList.end(); newlistIter++) {
- TransitionTreeNode* otherState = *newlistIter;
- while(otherState != NULL && otherState != parentState) {
- otherState = otherState->parent;
- }
- if (otherState == NULL)
- newStateList.insert(*newlistIter);
- }
- if (newStateList.size() > 0)
- stack.push_back(newStateList);
- break;
- }
-
- currState = currState->parent;
- parentState = currState->parent;
- }
- }
- }
-}
-
-TransitionTreeNode* ChartToFSM::buildTransTree(const Arabica::DOM::Element<std::string>& root, const std::string& nodeId) {
- TransitionTreeNode* stateNode = new TransitionTreeNode();
- stateNode->nodeId = nodeId;
- stateNode->state = root;
-
- if (TAGNAME(root) == _nsInfo.xmlNSPrefix + "parallel") {
- stateNode->type = TransitionTreeNode::TYPE_PARALLEL;
- } else {
- stateNode->type = TransitionTreeNode::TYPE_NESTED;
- }
-
- // get all transitions and states from root without recursing
- NodeSet<std::string> nested;
- nested.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", root));
- nested.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "state", root));
- nested.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "final", root));
- nested.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "parallel", root));
- nested.to_document_order();
-
- TransitionTreeNode* lastNode = NULL;
-
- for (size_t i = 0; i < nested.size(); i++) {
- Element<std::string> nestedElem(nested[i]);
- if (TAGNAME(nestedElem) == _nsInfo.xmlNSPrefix + "transition") {
- TransitionTreeNode* transNode = new TransitionTreeNode();
- transNode->transition = nestedElem;
- transNode->parent = stateNode;
- transNode->nodeId = nodeId + "-" + toStr(i);
- transNode->type = TransitionTreeNode::TYPE_TRANSITION;
-
- if (stateNode->firstTransition == NULL) {
- stateNode->firstTransition = transNode;
- }
- stateNode->children.push_back(transNode);
- stateNode->lastTransition = transNode;
-
- if (lastNode != NULL) {
- lastNode->nextTransition = transNode;
- transNode->prevTransition = lastNode;
- }
- lastNode = transNode;
-
-
- } else {
- TransitionTreeNode* deeperNode = buildTransTree(nestedElem, nodeId + "-" + toStr(i));
- if (stateNode->firstState == NULL) {
- stateNode->firstState = deeperNode;
- }
-
- deeperNode->parent = stateNode;
- stateNode->children.push_back(deeperNode);
- }
- }
-
- _stateToTransTreeNode[root] = stateNode;
-
- return stateNode;
-}
-
-void ChartToFSM::getPotentialTransitionsForConfFromPowerSet(const Arabica::XPath::NodeSet<std::string>& conf, std::map<std::string, GlobalTransition*>& outMap) {
- // get all transition elements from states in the current configuration
- NodeSet<std::string> allTransitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", conf);
-
- {
- std::string seperator = "";
- for (size_t i = 0; i < allTransitions.size(); i++) {
- std::cerr << seperator << ATTR_CAST(allTransitions[i], "index");
- seperator=", ";
- }
- std::cerr << std::endl;
- }
-
-// if (true) {
-// outMap = _confToTransitions[""];
-// }
-
- if (allTransitions.size() == 0)
- return; // no transitions
-
- int nrElements = allTransitions.size();
- int k = 0;
- int* stack = (int*)malloc((nrElements + 1) * sizeof(int));
- memset(stack, 0, (nrElements + 1) * sizeof(int));
-
- /**
- * Powerset is too naive and takes too long!
- * We have it up to 500k checks/sec and still 2**30 is
- * 1G+ for 30minutes in a single state out of 50k+!
- */
-
- while(1) {
- // create the power set of all potential transitions - this is expensive!
- // see: http://www.programminglogic.com/powerset-algorithm-in-c/
-
- if (stack[k] < nrElements) {
- stack[k+1] = stack[k] + 1;
- k++;
- }
-
- else {
- stack[k-1]++;
- k--;
- }
-
- if (k==0)
- break;
-
- NodeSet<std::string> transitions;
-// std::cerr << globalState->stateId << " [" << nrElements << "]: " << std::endl;
- for (size_t i = 1; i <= k; i++) {
- // std::cerr << stack[i] - 1 << ", ";
- transitions.push_back(allTransitions[stack[i] - 1]);
- }
- // std::cerr << std::endl;
-
- // transitions.push_back(allTransitions[0]);
- // transitions.push_back(allTransitions[4]);
- // transitions.push_back(allTransitions[5]);
- // transitions.push_back(allTransitions[7]);
-
- bool dump = false;
-
- // if (k == 4 && stack[1] == 1 && stack[2] == 5 && stack[3] == 6 && stack[4] == 8) {
- // dump = true;
- // }
-
- if (dump) DUMP_TRANSSET("at start");
-
- _perfTransTotal++;
- _perfTransProcessed++;
-
- DUMP_STATS(nrElements, false);
-
- GlobalTransition* transition = NULL;
-
- // reduce to conflict-free subset
- // transitions.to_document_order();
- if (!_keepInvalidTransitions) {
- // remove transitions in the same state
- if(!filterSameState(transitions))
- continue;
- if (dump) DUMP_TRANSSET("after same state filtered");
-
- // remove those transitions with a child transition
-// if(!filterChildEnabled(transitions))
- if(!filterSameHierarchy(transitions))
- continue;
- if (dump) DUMP_TRANSSET("after child enabled filtered");
-
- transitions = removeConflictingTransitions(transitions);
- if (dump) DUMP_TRANSSET("after conflicting filtered");
- // algorithm can never reduce to empty set
- assert(transitions.size() > 0);
-
- // create a GlobalTransition object from the set
- transition = new GlobalTransition(transitions, _dataModel, this);
- if (!transition->isValid) {
- // this set of transitions can not be enabled together
- delete transition;
- continue;
- }
- } else {
- transition = new GlobalTransition(transitions, _dataModel, this);
-
- // remove transitions in the same state
- if(!filterSameState(transitions)) {
- transition->isValid = false;
- transition->invalidReason = GlobalTransition::SAME_SOURCE_STATE;
- transition->invalidMsg = "Same source state";
-
-// } else if(!filterChildEnabled(transitions)) {
- } else if(!filterSameHierarchy(transitions)) {
- transition->isValid = false;
- transition->invalidReason = GlobalTransition::CHILD_ENABLED;
- transition->invalidMsg = "Nested transitions";
- } else {
- NodeSet<std::string> nonPreemptingTransitions = removeConflictingTransitions(transitions);
- if (nonPreemptingTransitions.size() != transitions.size()) {
- transition->isValid = false;
- transition->invalidReason = GlobalTransition::PREEMPTING_MEMBERS;
- transition->invalidMsg = "Preempting members";
- }
- }
-
- }
-
- // two combinations might have projected onto the same conflict-free set
- if (outMap.find(transition->transitionId) != outMap.end()) {
- // std::cerr << "skipping as projected onto existing conflict-free subset" << std::endl;
- delete transition;
- continue;
- }
-
- transition->index = _lastTransIndex++;
- _perfTransUsed++;
-
- // remember this conflict-free set
- // std::cerr << "New conflict-free subset: " << transition->transitionId << ":" << transition->eventDesc << std::endl;
- outMap[transition->transitionId] = transition;
- }
-// _confToTransitions[""] = outMap;
- return;
-}
-
-void ChartToFSM::explode() {
-
- std::list<std::pair<GlobalTransition*, GlobalState*> > statesRemaining;
- statesRemaining.push_back(std::make_pair(_currGlobalTransition, new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix, this)));
-
- // add all invokers for initial transition
- for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- invoke(Element<std::string>(invokes[j]));
- }
- }
- _statesToInvoke = NodeSet<std::string>();
-
- /**
- We need this to be a recursion in order not to exhaust the stack
- */
-
- // append new global states and pop from front
- while(statesRemaining.size() > 0) {
- _perfStackSize = statesRemaining.size();
- _perfStatesTotal++;
- _perfStatesProcessed++;
-
- DUMP_STATS(0, false);
-
- GlobalState* globalState = statesRemaining.front().second;
- _currGlobalTransition = statesRemaining.front().first;
- statesRemaining.pop_front();
-
- // used to be conditionalized, we will just assume
- assert(_currGlobalTransition);
-
- if (_globalConf.find(globalState->stateId) != _globalConf.end()) {
- if (_currGlobalTransition->isEventless &&
- !_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) {
- // we arrived via a spontaneaous transition, do we need to update?
- updateRaisedAndSendChains(_globalConf[globalState->stateId], _currGlobalTransition, std::set<GlobalTransition*>());
- }
- delete globalState;
- _perfStatesSkippedTotal++;
- _perfStatesSkippedProcessed++;
- continue; // we have already been here
- }
-
- _configuration = globalState->getActiveStates();
- _alreadyEntered = globalState->getAlreadyEnteredStates();
- _historyValue = globalState->getHistoryStates();
-
- // remember as global configuration
- _globalConf[globalState->stateId] = globalState;
- _globalConf[globalState->stateId]->index = _lastStateIndex++;
-
- if(_globalConf[globalState->stateId]->isFinal) {
- if (_activeConf.find(globalState->activeId) == _activeConf.end()) {
- assert(globalState->activeIndex == -1);
- globalState->activeIndex = _lastActiveIndex++;
- _activeConf[globalState->activeId] = globalState; // remember as active configuration
- exitInterpreter();
- }
- continue; // done in this branch
- }
-
- if (_activeConf.find(globalState->activeId) != _activeConf.end()) {
- // we already know these transition sets, just copy over
- std::list<GlobalTransition*>::iterator sortTransIter = _activeConf[globalState->activeId]->sortedOutgoing.begin();
- while(sortTransIter != _activeConf[globalState->activeId]->sortedOutgoing.end()) {
- globalState->sortedOutgoing.push_back(GlobalTransition::copyWithoutExecContent(*sortTransIter));
- globalState->sortedOutgoing.back()->index = _lastTransIndex++;
- _perfTransUsed++;
- sortTransIter++;
- }
- _perfStatesCachedTotal++;
- _perfStatesCachedProcessed++;
-
- } else {
- // we need to calculate the potential optimal transition sets
- std::map<std::string, GlobalTransition*> transitionSets;
- // std::cerr << globalState->stateId << std::endl;
- if (_transitionsFromTree) {
- getPotentialTransitionsForConfFromTree(refsToStates(globalState->activeStatesRefs), transitionSets);
- } else {
- getPotentialTransitionsForConfFromPowerSet(refsToStates(globalState->activeStatesRefs), transitionSets);
- }
-
- // reduce and sort transition sets
- for(std::map<std::string, GlobalTransition*>::iterator transSetIter = transitionSets.begin();
- transSetIter != transitionSets.end();
- transSetIter++) {
- globalState->sortedOutgoing.push_back(transSetIter->second);
- }
-
- globalState->sortedOutgoing.sort(PtrComp<GlobalTransition>);
-// globalState->sortedOutgoing.unique(hasUnconditionalSuperset);
-// globalState->sortedOutgoing.unique(hasEarlierUnconditionalMatch);
- // unique is not quite like what we need, but it was a start
- if (_keepInvalidTransitions) {
- globalState->sortedOutgoing = redundantMark(globalState->sortedOutgoing);
- } else {
-// globalState->sortedOutgoing.unique(hasUnconditionalSuperset);
-// globalState->sortedOutgoing.unique(hasEarlierUnconditionalMatch);
- globalState->sortedOutgoing = redundantRemove(globalState->sortedOutgoing);
- }
-// globalState->sortedOutgoing = redundantRemove(globalState->sortedOutgoing);
-// globalState->sortedOutgoing = redundantRemove(globalState->sortedOutgoing);
-//
-// std::cout << globalState->sortedOutgoing.size() << std::endl;
-
- assert(_activeConf.find(globalState->activeId) == _activeConf.end());
- assert(globalState->activeIndex == -1);
- globalState->activeIndex = _lastActiveIndex++;
- _activeConf[globalState->activeId] = globalState;
- }
-
- // take every transition set and append resulting new state
- for(std::list<GlobalTransition*>::iterator transIter = globalState->sortedOutgoing.begin();
- transIter != globalState->sortedOutgoing.end();
- transIter++) {
-
- GlobalTransition* incomingTrans = _currGlobalTransition;
- GlobalTransition* outgoingTrans = *transIter;
-
- outgoingTrans->source = globalState->stateId;
-
- if (_keepInvalidTransitions && !outgoingTrans->isValid)
- continue;
-
- _currGlobalTransition = outgoingTrans;
-
- microstep(refsToTransitions(outgoingTrans->transitionRefs));
-// assert(isLegalConfiguration(_configuration));
-
- _perfMicroStepProcessed++;
- _perfMicroStepTotal++;
-
- // if outgoing transition is spontaneous, add number of events to chain
- if (outgoingTrans->isEventless &&
- !_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) {
- outgoingTrans->eventsChainRaised = MIN(incomingTrans->eventsChainRaised + outgoingTrans->eventsRaised, UNDECIDABLE);
- outgoingTrans->eventsChainSent = MIN(incomingTrans->eventsChainSent + outgoingTrans->eventsSent, UNDECIDABLE);
-
- if (outgoingTrans->eventsChainRaised > _maxEventRaisedChain)
- _maxEventRaisedChain = outgoingTrans->eventsChainRaised;
- if (outgoingTrans->eventsChainSent > _maxEventSentChain)
- _maxEventSentChain = outgoingTrans->eventsChainSent;
-
- }
-
- statesRemaining.push_back(std::make_pair(outgoingTrans, new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix, this)));
-
- // add all invokers
- for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- invoke(Element<std::string>(invokes[j]));
- }
- }
- _statesToInvoke = NodeSet<std::string>();
-
- // remember that the last transition lead here
- outgoingTrans->destination = statesRemaining.back().second->stateId;
- outgoingTrans->activeDestination = statesRemaining.back().second->activeId;
- // reset state for next transition set
- _configuration = globalState->getActiveStates();
- _alreadyEntered = globalState->getAlreadyEnteredStates();
- _historyValue = globalState->getHistoryStates();
- }
- }
-
-}
-
-void ChartToFSM::updateRaisedAndSendChains(GlobalState* state, GlobalTransition* source, std::set<GlobalTransition*> visited) {
- for (std::list<GlobalTransition*>::iterator transIter = state->sortedOutgoing.begin(); transIter != state->sortedOutgoing.end(); transIter++) {
- GlobalTransition* transition = *transIter;
-
- if (!transition->isEventless)
- continue; // we do not care for eventful transitions
-
- // source leads to spontaneous transition -> update event chains
- bool eventChainsNeedUpdated = false;
-
- if (visited.find(transition) != visited.end()) {
- // potential spontaneous transition cycle!
- if (transition->eventsChainRaised > 0)
- _maxEventRaisedChain = UNDECIDABLE;
- if (transition->eventsChainSent > 0)
- _maxEventSentChain = UNDECIDABLE;
- return;
- }
-
- // UNDECIDABLE means "undecidable / endless"
-
- // will source increase our event chain?
- if (transition->eventsChainRaised != UNDECIDABLE &&
- transition->eventsChainRaised < source->eventsChainRaised + transition->eventsRaised) {
- // taking transition after source causes more events in chain
- transition->eventsChainRaised = MIN(source->eventsChainRaised + transition->eventsRaised, UNDECIDABLE);
- eventChainsNeedUpdated = true;
- }
- if (transition->eventsChainSent != UNDECIDABLE &&
- transition->eventsChainSent < source->eventsChainSent + transition->eventsSent) {
- // taking transition after source causes more events in chain
- transition->eventsChainSent = MIN(source->eventsChainSent + transition->eventsSent, UNDECIDABLE);
- eventChainsNeedUpdated = true;
- }
-
- if (eventChainsNeedUpdated &&
- transition->destination.length() > 0 &&
- _globalConf.find(transition->destination) != _globalConf.end()) {
-
- visited.insert(transition);
- // iterate all spontaneous transitions in destination and update event chains
- updateRaisedAndSendChains(_globalConf[transition->destination], transition, visited);
- }
-
- if (transition->eventsChainRaised > _maxEventRaisedChain)
- _maxEventRaisedChain = transition->eventsChainRaised;
- if (transition->eventsChainSent > _maxEventSentChain)
- _maxEventSentChain = transition->eventsChainSent;
- }
-}
-
-uint32_t ChartToFSM::getMinInternalQueueLength(uint32_t defaultVal) {
- if (_maxEventRaisedChain != UNDECIDABLE)
- return _maxEventRaisedChain + _doneEventRaiseTolerance;
- return defaultVal;
-}
-
-uint32_t ChartToFSM::getMinExternalQueueLength(uint32_t defaultVal) {
- if (_maxEventSentChain != UNDECIDABLE)
- return _maxEventSentChain;
- return defaultVal;
-}
-
-void ChartToFSM::reassembleFromFlat() {
- LOG(ERROR) << "Cannot flatten flat SCXML document";
- abort();
-}
-
-Arabica::XPath::NodeSet<std::string> ChartToFSM::refsToStates(const std::set<int>& stateRefs) {
- NodeSet<std::string> states;
- for (std::set<int>::const_iterator stateIter = stateRefs.begin(); stateIter != stateRefs.end(); stateIter++) {
- states.push_back(indexedStates[*stateIter]);
- }
- return states;
-}
-
-Arabica::XPath::NodeSet<std::string> ChartToFSM::refsToTransitions(const std::set<int>& transRefs) {
- NodeSet<std::string> transitions;
- for (std::set<int>::const_iterator transIter = transRefs.begin(); transIter != transRefs.end(); transIter++) {
- transitions.push_back(indexedTransitions[*transIter]);
- }
- return transitions;
-}
-
-void ChartToFSM::beforeMicroStep(Interpreter interpreter) {
-}
-void ChartToFSM::onStableConfiguration(Interpreter interpreter) {
-}
-void ChartToFSM::beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- GlobalTransition::Action action;
- action.exited = state;
- _currGlobalTransition->actions.push_back(action);
-}
-void ChartToFSM::beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- GlobalTransition::Action action;
- action.entered = state;
- _currGlobalTransition->actions.push_back(action);
-}
-void ChartToFSM::beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
-}
-
-std::ostream& operator<< (std::ostream& os, const GlobalTransition::Action& action) {
- if (action.onEntry)
- os << "onEntry: " << action.onEntry;
- if (action.onExit)
- os << "onExit: " << action.onExit;
- if (action.transition)
- os << "transition: " << action.transition;
- if (action.entered)
- os << "entered: " << action.entered;
- if (action.exited)
- os << "exited: " << action.exited;
- if (action.invoke)
- os << "invoke: " << action.invoke;
- if (action.uninvoke)
- os << "uninvoke: " << action.uninvoke;
- if (action.raiseDone)
- os << "raiseDone: " << action.raiseDone;
- return os;
-}
-
-GlobalState::GlobalState(const Arabica::XPath::NodeSet<std::string>& activeStates_,
- const Arabica::XPath::NodeSet<std::string>& alreadyEnteredStates_, // we need to remember for binding=late
- const std::map<std::string, Arabica::XPath::NodeSet<std::string> >& historyStates_,
- const std::string& xmlNSPrefix,
- ChartToFSM* flattener) {
- interpreter = flattener;
- activeIndex = -1;
-
- // take references
- for (size_t i = 0; i < activeStates_.size(); i++) {
- activeStatesRefs.insert(strTo<int>(ATTR_CAST(activeStates_[i], "index")));
- }
-
- for (size_t i = 0; i < alreadyEnteredStates_.size(); i++) {
- alreadyEnteredStatesRefs.insert(strTo<int>(ATTR_CAST(alreadyEnteredStates_[i], "index")));
- }
-
- for (std::map<std::string, Arabica::XPath::NodeSet<std::string> >::const_iterator histIter = historyStates_.begin(); histIter != historyStates_.end(); histIter++) {
- for (size_t i = 0; i < histIter->second.size(); i++) {
- historyStatesRefs[histIter->first].insert(strTo<int>(ATTR_CAST(histIter->second[i], "index")));
- }
- }
-
- isFinal = false;
-
- // is state this final?
- for(int i = 0; i < activeStates_.size(); i++) {
- Arabica::DOM::Element<std::string> state = Arabica::DOM::Element<std::string>(activeStates_[i]);
- Arabica::DOM::Element<std::string> parentElem = (Arabica::DOM::Element<std::string>)state.getParentNode();
- if(InterpreterImpl::isFinal(state) && iequals(parentElem.getTagName(), xmlNSPrefix + "scxml")) {
- isFinal = true;
- break;
- }
- }
-
- FlatStateIdentifier flatStateId(getActiveStates(), getAlreadyEnteredStates(), getHistoryStates());
- stateId = flatStateId.getStateId();
- activeId = flatStateId.getFlatActive();
-}
-
-GlobalTransition* GlobalTransition::copyWithoutExecContent(GlobalTransition* other) {
- GlobalTransition* newTrans = new GlobalTransition(*other);
- newTrans->actions.clear();
- newTrans->historyBase = other;
- other->historyTrans.push_back(newTrans);
- return newTrans;
-}
-
-GlobalTransition::GlobalTransition(const Arabica::XPath::NodeSet<std::string>& transitionSet, DataModel dataModel, ChartToFSM* flattener) {
- interpreter = flattener;
-
- eventsRaised = 0;
- eventsSent = 0;
- eventsChainRaised = 0;
- eventsChainSent = 0;
- historyBase = NULL;
-
- for (size_t i = 0; i < transitionSet.size(); i++) {
- transitionRefs.insert(strTo<int>(ATTR_CAST(transitionSet[i], "index")));
- }
-
- std::ostringstream setId; // also build id for subset
- std::string seperator = "";
- for (std::set<int>::iterator transIter = transitionRefs.begin(); transIter != transitionRefs.end(); transIter++) {
- setId << seperator << *transIter;
- seperator = "-";
- }
- transitionId = setId.str();
-
- hasExecutableContent = false;
- isValid = true;
- isEventless = true;
-
-#if 0
- std::cerr << "################" << std::endl;
- for (size_t i = 0; i < transitions.size(); i++) {
- std::cerr << transitions[i] << std::endl;
- }
- std::cerr << "################" << std::endl;
-#endif
-
- // first establish whether this is a valid set
-
- /**
- * Can these events event occur together? They can't if:
- * 1. event / eventless is mixed
- * 2. target / targetless is mixed (?)
- * 3. there is no common prefix for their event attribute
- */
-
- bool foundWithEvent = false;
- bool foundEventLess = false;
- bool foundWithTarget = false;
- bool foundTargetLess = false;
-
- Arabica::DOM::Element<std::string> withEvent;
- Arabica::DOM::Element<std::string> noneEvent;
- Arabica::DOM::Element<std::string> withTarget;
- Arabica::DOM::Element<std::string> noneTarget;
-
- for (size_t i = 0; i < transitionSet.size(); i++) {
- Arabica::DOM::Element<std::string> transElem = Arabica::DOM::Element<std::string>(transitionSet[i]);
- if (HAS_ATTR(transElem, "eventexpr")) {
- ERROR_EXECUTION_THROW("Cannot flatten document with eventexpr attributes");
- }
- if (HAS_ATTR(transElem, "event")) {
- foundWithEvent = true;
- withEvent = transElem;
- if (foundEventLess)
- break;
- } else {
- foundEventLess = true;
- noneEvent = transElem;
- if (foundWithEvent)
- break;
- }
- if (HAS_ATTR(transElem, "target")) {
- foundWithTarget = true;
- withTarget = transElem;
- if (foundTargetLess)
- break;
- } else {
- foundTargetLess = true;
- noneTarget = transElem;
- if (foundWithTarget)
- break;
- }
-
- }
-
- // do not mix eventless and event transitions
- if (foundEventLess && foundWithEvent) {
- if (flattener->_keepInvalidTransitions) {
- invalidReason = MIXES_EVENT_SPONTANEOUS;
- invalidMsg = "Mixes (non-)spontaneous";
- }
- isValid = false;
- return;
- }
-
- // 403c vs 229 / 403b - solved via filterChildEnabled
- if (foundTargetLess && foundWithTarget) {
-// isValid = false;
-// return;
- }
-
- isEventless = foundEventLess;
- isTargetless = !foundWithTarget;
-
- // is there a set of event names that would enable this conflict-free transition set?
- if (foundWithEvent) {
- // get the set of longest event descriptors that will enable this transition set
- eventNames = getCommonEvents(transitionSet);
- if (eventNames.size() == 0) {
-// LOG(INFO) << "No event will activate this conflict-free subset" << std::endl;
- if (flattener->_keepInvalidTransitions) {
- invalidReason = NO_COMMON_EVENT;
- invalidMsg = "No common event";
- }
- isValid = false;
- return;
- } else {
- std::string seperator = "";
- for (std::list<std::string>::iterator eventIter = eventNames.begin();
- eventIter != eventNames.end();
- eventIter++) {
- eventDesc += seperator + *eventIter;
- seperator = " ";
- }
- }
- if (eventDesc.size() == 0)
- eventDesc = "*";
- }
-
- // extract conditions and history targets
- std::list<std::string> conditions;
- for (size_t i = 0; i < transitionSet.size(); i++) {
- Arabica::DOM::Element<std::string> transElem = Arabica::DOM::Element<std::string>(transitionSet[i]);
- // gather conditions while we are iterating anyway
- if (HAS_ATTR(transElem, "cond")) {
- conditions.push_back(boost::trim_copy(ATTR(transElem, "cond")));
- }
-
- std::list<std::string> targets = tokenize(ATTR(transElem, "target"));
- std::list<std::string>::iterator targetIter = targets.begin();
- while(targetIter != targets.end()) {
-// std::cout << "// " << *targetIter << std::endl;
- if (flattener->_historyTargets.find(*targetIter) != flattener->_historyTargets.end()) {
- histTargets.insert(*targetIter);
- }
- targetIter++;
- }
-// std::cout << std::endl << std::endl;
- }
-
- seperator = "";
- for (std::vector<Element<std::string> >::iterator transIter = interpreter->indexedTransitions.begin(); transIter != interpreter->indexedTransitions.end(); transIter++) {
- const Element<std::string>& refTrans = *transIter;
- if (!HAS_ATTR(refTrans, "priority"))
- continue;
- if (InterpreterImpl::isMember(refTrans, transitionSet)) {
- members += seperator + ATTR(refTrans, "priority");
- } else {
- members += seperator;
- for (size_t i = 0; i < ATTR(refTrans, "priority").size(); i++) {
- members += " ";
- }
- }
- seperator = " ";
- }
-
- // if (members == " 4 6 7 ")
- // std::cout << "asdfadf";
-
- if (conditions.size() > 1) {
- condition = dataModel.andExpressions(conditions);
- if (condition.size() == 0) {
- LOG(ERROR) << "Datamodel does not support to conjungate expressions!" << std::endl;
- }
- } else if (conditions.size() == 1) {
- condition = conditions.front();
- }
-}
-
-Arabica::XPath::NodeSet<std::string> GlobalState::getActiveStates() {
- return interpreter->refsToStates(activeStatesRefs);
-}
-
-Arabica::XPath::NodeSet<std::string> GlobalState::getAlreadyEnteredStates() {
- return interpreter->refsToStates(alreadyEnteredStatesRefs);
-}
-
-std::map<std::string, Arabica::XPath::NodeSet<std::string> > GlobalState::getHistoryStates() {
- std::map<std::string, Arabica::XPath::NodeSet<std::string> > historyValue;
- for (std::map<std::string, std::set<int> >::iterator histIter = historyStatesRefs.begin(); histIter != historyStatesRefs.end(); histIter++) {
- historyValue[histIter->first] = interpreter->refsToStates(histIter->second);
- }
- return historyValue;
-}
-
-
-Arabica::XPath::NodeSet<std::string> GlobalTransition::getTransitions() const {
- return interpreter->refsToTransitions(transitionRefs);
-}
-
-std::list<std::string> GlobalTransition::getCommonEvents(const NodeSet<std::string>& transitions) {
- std::list<std::string> prefixes;
- std::list<std::string> longestPrefixes;
-
- for (size_t i = 0; i < transitions.size(); i++) {
- // for every transition
- std::list<std::string> eventNames = tokenize(ATTR_CAST(transitions[i], "event"));
-
- for (std::list<std::string>::iterator eventNameIter = eventNames.begin();
- eventNameIter != eventNames.end();
- eventNameIter++) {
- // for every event descriptor
- std::string eventName = *eventNameIter;
-
- // remove trailing .*
- if (eventName.find("*", eventName.size() - 1) != std::string::npos)
- eventName = eventName.substr(0, eventName.size() - 1);
- if (eventName.find(".", eventName.size() - 1) != std::string::npos)
- eventName = eventName.substr(0, eventName.size() - 1);
-
- bool isMatching = true;
- for (size_t j = 0; j < transitions.size(); j++) {
- // check if token would activate all other transitions
- if (i == j)
- continue;
- if (!nameMatch(ATTR_CAST(transitions[j], "event"), eventName)) {
- isMatching = false;
- break;
- }
- }
- if (isMatching) {
- prefixes.push_back(eventName);
- }
- }
- }
-
- // from the set of event names, remove those that are prefixes
- for (std::list<std::string>::iterator outerEventNameIter = prefixes.begin();
- outerEventNameIter != prefixes.end();
- outerEventNameIter++) {
- for (std::list<std::string>::iterator innerEventNameIter = prefixes.begin();
- innerEventNameIter != prefixes.end();
- innerEventNameIter++) {
- if (!iequals(*outerEventNameIter, *innerEventNameIter) && nameMatch(*outerEventNameIter, *innerEventNameIter)) {
- goto IS_PREFIX;
- }
- }
- longestPrefixes.push_back(*outerEventNameIter);
-IS_PREFIX:
- ;
- }
- return longestPrefixes;
-}
-
-}
diff --git a/src/uscxml/transform/ChartToFSM.cpp.new b/src/uscxml/transform/ChartToFSM.cpp.new
deleted file mode 100644
index 1dcf16c..0000000
--- a/src/uscxml/transform/ChartToFSM.cpp.new
+++ /dev/null
@@ -1,1482 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/transform/ChartToFSM.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-#include "uscxml/Convenience.h"
-#include "uscxml/Factory.h"
-
-#include <DOM/io/Stream.hpp>
-#include <glog/logging.h>
-
-#include <iostream>
-#include "uscxml/UUID.h"
-#include <math.h>
-#include <string.h>
-#include <algorithm>
-#undef max
-#include <limits>
-
-#define UNDECIDABLE 2147483647
-#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
-
-#define DUMP_STATS(nrTrans) \
-uint64_t now = tthread::chrono::system_clock::now(); \
-if (now - _lastTimeStamp > 1000) { \
- std::cerr << "## Transition: " << _perfTransUsed << " / " << _perfTransTotal << " [" << _perfTransProcessed << "/sec]"; \
- if (nrTrans > 0) { \
- std::cerr << " - 2**" << nrTrans << " = " << pow(2.0, static_cast<double>(nrTrans)); \
- } \
- std::cerr << std::endl; \
- std::cerr << "## State : " << _globalConf.size() << " [" << _perfStatesProcessed << "/sec]" << std::endl; \
- std::cerr << "## Microstep : " << _perfMicroStepTotal << " [" << _perfMicroStepProcessed << "/sec]" << std::endl; \
- std::cerr << "## Cached : " << _perfStatesCachedTotal << " [" << _perfStatesCachedProcessed << "/sec]" << std::endl; \
- std::cerr << "## Skipped : " << _perfStatesSkippedTotal << " [" << _perfStatesSkippedProcessed << "/sec]" << std::endl; \
- std::cerr << "## Queues : " << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << " / " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \
- std::cerr << _perfTransUsed << ", " << _perfTransTotal << ", " << _perfTransProcessed << ", "; \
- std::cerr << _globalConf.size() << ", " << _perfStatesProcessed << ", "; \
- std::cerr << _perfMicroStepTotal << ", " << _perfMicroStepProcessed << ", "; \
- std::cerr << _perfStatesCachedTotal << ", " << _perfStatesCachedProcessed << ", " << _perfStatesSkippedTotal << ", " << _perfStatesSkippedProcessed << ", "; \
- std::cerr << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << ", " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \
- std::cerr << std::endl; \
- _perfTransProcessed = 0; \
- _perfStatesProcessed = 0; \
- _perfStatesCachedProcessed = 0; \
- _perfStatesSkippedProcessed = 0; \
- _perfMicroStepProcessed = 0; \
- _lastTimeStamp = now; \
-}
-
-//std::cerr << "Q: " << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << " / " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl;
-
-#define DUMP_TRANSSET(where) \
-{\
-std::cout << std::endl;\
-std::cout << "** " << transitions.size() << " ** " << where << std::endl;\
- for (int m = 0; m < transitions.size(); m++) {\
- std::cout << transitions[m] << std::endl;\
- }\
-}
-
-namespace uscxml {
-
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-
-#define DETAIL_EXEC_CONTENT(field, actPtr) \
-std::cerr << " " << #field << " / " << TAGNAME_CAST(actPtr->field) << " ("; \
-NodeSet<std::string> contents = filterChildType(Node_base::ELEMENT_NODE, actPtr->field, true); \
-for (int i = 0; i < contents.size(); i++) { \
- std::cerr << " " << TAGNAME_CAST(contents[i]); \
-} \
-std::cerr << ")";
-
-
-uint64_t Complexity::stateMachineComplexity(const Arabica::DOM::Element<std::string>& root, Variant variant) {
- Complexity complexity = calculateStateMachineComplexity(root);
- uint64_t value = complexity.value;
-
- if (variant != IGNORE_HISTORY_AND_NESTED_DATA && variant != IGNORE_HISTORY) {
- for (std::list<uint64_t>::const_iterator histIter = complexity.history.begin(); histIter != complexity.history.end(); histIter++) {
- value *= *histIter;
- }
- }
-
- if (variant != IGNORE_HISTORY_AND_NESTED_DATA && variant != IGNORE_NESTED_DATA) {
- bool ignoreNestedData = false;
- if (root.getLocalName() == "scxml" && (!HAS_ATTR_CAST(root, "binding") || boost::to_lower_copy(ATTR_CAST(root, "binding")) == "early")) {
- ignoreNestedData = true;
- }
-
- if (!ignoreNestedData) {
- uint64_t power = complexity.nestedData;
- while(power--) {
- value *= 2;
- }
- }
- }
-
- return value;
-}
-
-Complexity Complexity::calculateStateMachineComplexity(const Arabica::DOM::Element<std::string>& root) {
- Complexity complexity;
-
- bool hasFlatHistory = false;
- bool hasDeepHistory = false;
- bool hasNestedData = false;
-
- Arabica::DOM::NodeList<std::string> childElems = root.getChildNodes();
- for (int i = 0; i < childElems.getLength(); i++) {
- if (childElems.item(i).getNodeType() != Node_base::ELEMENT_NODE)
- continue;
- Element<std::string> childElem = Element<std::string>(childElems.item(i));
- if (InterpreterImpl::isHistory(childElem)) {
- if (HAS_ATTR(childElem, "type") && ATTR(childElem, "type") == "deep") {
- hasDeepHistory = true;
- } else {
- hasFlatHistory = true;
- }
- }
- if (!hasNestedData && childElem.getLocalName() == "datamodel") {
- Arabica::DOM::NodeList<std::string> dataElemChilds = childElem.getChildNodes();
- for (int j = 0; j < dataElemChilds.getLength(); j++) {
- if (dataElemChilds.item(j).getLocalName() == "data")
- hasNestedData = true;
- }
- }
- }
-
- if (hasNestedData)
- complexity.nestedData++;
-
- if (InterpreterImpl::isCompound(root) || TAGNAME(root) == "scxml") {
- // compounds can be in any of the child state -> add
- NodeSet<std::string> childs = InterpreterImpl::getChildStates(root);
- for (int i = 0; i < childs.size(); i++) {
- complexity += calculateStateMachineComplexity(Element<std::string>(childs[i]));
- }
- if (hasFlatHistory) {
- complexity.history.push_back(childs.size());
- }
- if (hasDeepHistory) {
- complexity.history.push_back(complexity.value);
- }
- } else if (InterpreterImpl::isParallel(root)) {
- // parallels are in all states -> multiply
- NodeSet<std::string> childs = InterpreterImpl::getChildStates(root);
- complexity.value = 1;
- for (int i = 0; i < childs.size(); i++) {
- complexity *= calculateStateMachineComplexity(Element<std::string>(childs[i]));
- }
- if (hasDeepHistory) {
- complexity.history.push_back(complexity.value);
- }
-
- } else if (InterpreterImpl::isAtomic(root)) {
- return 1;
- }
-
- return complexity;
-}
-
-
-ChartToFSM::ChartToFSM(const Interpreter& other) {
-
- cloneFrom(other.getImpl());
-
- _keepInvalidTransitions = false;
- _lastTimeStamp = tthread::chrono::system_clock::now();
- _perfTransProcessed = 0;
- _perfTransTotal = 0;
- _perfTransUsed = 0;
- _perfStatesProcessed = 0;
- _perfStatesSkippedProcessed = 0;
- _perfStatesSkippedTotal = 0;
- _perfStatesCachedProcessed = 0;
- _perfStatesCachedTotal = 0;
- _perfMicroStepProcessed = 0;
- _perfMicroStepTotal = 0;
-
- _start = NULL;
- _currGlobalTransition = NULL;
-
- _lastStateIndex = 0;
- _lastActiveIndex = 0;
- _lastTransIndex = 0;
-
- _maxEventSentChain = 0;
- _maxEventRaisedChain = 0;
- _doneEventRaiseTolerance = 0;
- _skipEventChainCalculations = false;
-
- addMonitor(this);
-}
-
-ChartToFSM::~ChartToFSM() {
- std::map<std::string, GlobalState*>::iterator confIter = _globalConf.begin();
- while(confIter != _globalConf.end()) {
- std::list<GlobalTransition*>::iterator transIter = confIter->second->sortedOutgoing.begin();
- while (transIter != confIter->second->sortedOutgoing.end()) {
- delete *transIter;
- transIter++;
- }
- delete confIter->second;
- confIter++;
- }
-
- // tear down caches
- Arabica::XPath::NodeSet<std::string> allTransitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- for (int i = 0; i < allTransitions.size(); i++) {
- _transParents.erase(allTransitions[i]);
- }
-
-}
-
-Document<std::string> ChartToFSM::getDocument() const {
- if (_flatDoc)
- return _flatDoc;
- return _document;
-}
-
-InterpreterState ChartToFSM::interpret() {
-
- // create a _flatDoc for the FSM
- DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- _flatDoc = domFactory.createDocument(_document.getNamespaceURI(), "", 0);
-
- init();
- setupIOProcessors();
-
- uint64_t complexity = Complexity::stateMachineComplexity(_scxml) + 1;
- std::cerr << "Approximate Complexity: " << complexity << std::endl;
- std::cerr << "Approximate Active Complexity: " << Complexity::stateMachineComplexity(_scxml, Complexity::IGNORE_HISTORY_AND_NESTED_DATA) + 1 << std::endl;
-
- if (complexity > 1000) {
- _skipEventChainCalculations = true;
- _maxEventRaisedChain = UNDECIDABLE;
- _maxEventSentChain = UNDECIDABLE;
- }
- // initialize the datamodel
- std::string datamodelName;
- if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "datamodel"))
- datamodelName = ATTR(_scxml, "datamodel");
- if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "profile")) // SCION SCXML uses profile to specify datamodel
- datamodelName = ATTR(_scxml, "profile");
- if(datamodelName.length() > 0) {
- _dataModel = _factory->createDataModel(datamodelName, this);
- if (!_dataModel) {
- Event e;
- e.data.compound["cause"] = Data("Cannot instantiate datamodel", Data::VERBATIM);
- throw e;
- }
- } else {
- _dataModel = _factory->createDataModel("null", this);
- }
- if(datamodelName.length() > 0 && !_dataModel) {
- LOG(ERROR) << "No datamodel for " << datamodelName << " registered";
- }
-
- // setup caches
- {
- Arabica::XPath::NodeSet<std::string> allTransitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- indexedTransitions.reserve(allTransitions.size());
- for (int i = 0; i < allTransitions.size(); i++) {
- _transParents[allTransitions[i]] = InterpreterImpl::getParentState(allTransitions[i]);
- }
- }
-
- // identify all history elements
- NodeSet<std::string> histories = filterChildElements(_nsInfo.xmlNSPrefix + "history", _scxml, true);
- for (int i = 0; i < histories.size(); i++) {
- _historyTargets[ATTR_CAST(histories[i], "id")] = Element<std::string>(histories[i]);
- }
-
- _binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
- _alreadyFlat = (HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat")));
-
- if (_alreadyFlat) {
- reassembleFromFlat();
- return _state;
- }
-
- // set invokeid for all invokers to parent state if none given
- NodeSet<std::string> invokers = filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
- for (int i = 0; i < invokers.size(); i++) {
- Element<std::string> invokerElem = Element<std::string>(invokers[i]);
- invokerElem.setAttribute("parent", ATTR_CAST(invokerElem.getParentNode(), "id"));
- }
- // reset
- _globalConf.clear();
- _currGlobalTransition = NULL;
-
- // very first state
- _start = new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix, this);
- _globalConf[_start->stateId] = _start;
- _globalConf[_start->stateId]->index = _lastStateIndex++;
-
- NodeSet<std::string> initialTransitions;
-
- // enter initial configuration
- Arabica::XPath::NodeSet<std::string> initialStates;
- initialStates = getInitialStates();
- assert(initialStates.size() > 0);
- for (int i = 0; i < initialStates.size(); i++) {
- Element<std::string> initialElem = _document.createElementNS(_nsInfo.nsURL, "initial");
- _nsInfo.setPrefix(initialElem);
- initialElem.setAttribute("generated", "true");
- Element<std::string> transitionElem = _document.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(transitionElem);
- transitionElem.setAttribute("target", ATTR_CAST(initialStates[i], "id"));
- initialElem.appendChild(transitionElem);
- _scxml.appendChild(initialElem);
- initialTransitions.push_back(transitionElem);
- }
-
- if (!_skipEventChainCalculations)
- annotateRaiseAndSend(_scxml);
-
-// std::cout << _scxml << std::endl;
-
- indexTransitions();
-
- // add initial transitions as least prior
- for (int i = 0; i < initialTransitions.size() ; i++) {
- indexedTransitions.push_back(Element<std::string>(initialTransitions[i]));
- }
-
- // set index attribute for transitions
- for (int i = 0; i < indexedTransitions.size(); i++) {
- std::cerr << toStr(i) << ":" << (HAS_ATTR(indexedTransitions[i], "line_start") ? ATTR(indexedTransitions[i], "line_start") : "");
- std::cerr << "\t" << DOMUtils::xPathForNode(indexedTransitions[i]) << std::endl;
- indexedTransitions[i].setAttribute("index", toStr(i));
- }
-
-// int lastTransIndex = indexedTransitions.size();
-// for (int i = 0; i < initialTransitions.size() ; i++, lastTransIndex++) {
-// indexedTransitions[i].setAttribute("index", toStr(indexedTransitions.size() - 1 - i));
-// }
-
- // gather and set index attribute o states
- NodeSet<std::string> allStates = getAllStates();
- allStates.to_document_order();
-
- indexedStates.resize(allStates.size());
- for (int i = 0; i < allStates.size(); i++) {
- Element<std::string> state = Element<std::string>(allStates[i]);
-
- // while we are iterating, determine deepest nested level
- size_t nrAncs = getProperAncestors(state, _scxml).size();
- if (_doneEventRaiseTolerance < nrAncs)
- _doneEventRaiseTolerance = nrAncs;
-
- state.setAttribute("index", toStr(i));
- indexedStates[i] = state;
- }
-
-// std::cerr << _scxml << std::endl;
-
- GlobalTransition* globalTransition = new GlobalTransition(initialTransitions, _dataModel, this);
- globalTransition->index = _lastTransIndex++;
-
- _start->sortedOutgoing.push_back(globalTransition);
- globalTransition->source = _start->stateId;
- _currGlobalTransition = globalTransition;
-
- enterStates(initialTransitions);
- globalTransition->destination = FlatStateIdentifier::toStateId(_configuration);
- globalTransition->activeDestination = globalTransition->destination;
-
- explode();
-
-#if 0
- // print set of global configurations
- for(std::map<std::string, GlobalState*>::iterator globalConfIter = _globalConf.begin();
- globalConfIter != _globalConf.end();
- globalConfIter++) {
- std::cerr << globalConfIter->first << std::endl;
- }
- std::cerr << _globalConf.size() << std::endl;
-#endif
-
- std::cerr << "Actual Complexity: " << _globalConf.size() << std::endl;
- std::cerr << "Actual Active Complexity: " << _activeConf.size() << std::endl;
- std::cerr << "Internal Queue: " << _maxEventRaisedChain << std::endl;
- std::cerr << "External Queue: " << _maxEventSentChain << std::endl;
-
- if (complexity < _globalConf.size())
- throw std::runtime_error("Upper bound for states exceeded");
-
- return _state;
-}
-
-void ChartToFSM::executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow) {
-// std::cerr << content << std::endl;
-// std::cerr << TAGNAME(content) << std::endl;
-
- GlobalTransition::Action action;
-
- NodeList<std::string> childs = content.getChildNodes();
- for (unsigned int i = 0; i < childs.getLength(); i++) {
- Node_base::Type type = childs.item(i).getNodeType();
- if (type == Node_base::ELEMENT_NODE || type == Node_base::COMMENT_NODE || type == Node_base::TEXT_NODE) {
- goto HAS_VALID_CHILDREN;
- }
- }
- return;
-
-HAS_VALID_CHILDREN:
- if (false) {
- } else if (TAGNAME(content) == "transition") {
- action.transition = content;
- } else if (TAGNAME(content) == "onexit") {
- action.onExit = content;
- } else if (TAGNAME(content) == "onentry") {
- action.onEntry = content;
- } else if (TAGNAME(content) == "history") {
- assert(false);
- } else { // e.g. global script elements
- return;
- }
-
- if (!_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) {
- assert(content.hasAttribute("raise") && content.hasAttribute("send"));
-
- std::string raiseAttr = content.getAttribute("raise");
- std::string sendAttr = content.getAttribute("send");
-
- _currGlobalTransition->eventsRaised = (raiseAttr == "-1" ? UNDECIDABLE : _currGlobalTransition->eventsRaised + strTo<uint32_t>(raiseAttr));
- _currGlobalTransition->eventsSent = (sendAttr == "-1" ? UNDECIDABLE : _currGlobalTransition->eventsSent + strTo<uint32_t>(sendAttr));
-
- if (_currGlobalTransition->eventsRaised > _maxEventRaisedChain)
- _maxEventRaisedChain = _currGlobalTransition->eventsRaised;
- if (_currGlobalTransition->eventsSent > _maxEventSentChain)
- _maxEventSentChain = _currGlobalTransition->eventsSent;
- }
-
- _currGlobalTransition->actions.push_back(action);
- _currGlobalTransition->hasExecutableContent = true;
-}
-
-void ChartToFSM::invoke(const Arabica::DOM::Element<std::string>& element) {
- GlobalTransition::Action action;
- action.invoke = element;
- _currGlobalTransition->actions.push_back(action);
- _currGlobalTransition->hasExecutableContent = true;
-}
-
-void ChartToFSM::cancelInvoke(const Arabica::DOM::Element<std::string>& element) {
- GlobalTransition::Action action;
- action.uninvoke = element;
- _currGlobalTransition->actions.push_back(action);
- _currGlobalTransition->hasExecutableContent = true;
-}
-
-void ChartToFSM::internalDoneSend(const Arabica::DOM::Element<std::string>& state) {
- if (!isState(state))
- return;
-
- if (parentIsScxmlState(state))
- return;
-
-// std::cerr << "internalDoneSend: " << state << std::endl;
-
- // create onentry with a raise element
- Element<std::string> onentry = _flatDoc.createElementNS(_nsInfo.nsURL, "onentry");
- _nsInfo.setPrefix(onentry);
-
- Element<std::string> raise = _flatDoc.createElementNS(_nsInfo.nsURL, "raise");
- _nsInfo.setPrefix(raise);
-
- onentry.appendChild(raise);
-
- Arabica::XPath::NodeSet<std::string> doneDatas = filterChildElements(_nsInfo.xmlNSPrefix + "donedata", state);
- if (doneDatas.size() > 0) {
- Arabica::DOM::Node<std::string> doneData = doneDatas[0];
- Arabica::XPath::NodeSet<std::string> contents = filterChildElements(_nsInfo.xmlNSPrefix + "content", doneDatas[0]);
- if (contents.size() > 0) {
- Node<std::string> imported = _flatDoc.importNode(contents[0], true);
- raise.appendChild(imported);
- }
- Arabica::XPath::NodeSet<std::string> params = filterChildElements(_nsInfo.xmlNSPrefix + "param", doneDatas[0]);
- if (params.size() > 0) {
- Node<std::string> imported = _flatDoc.importNode(params[0], true);
- raise.appendChild(imported);
- }
- }
-
- raise.setAttribute("event", "done.state." + ATTR_CAST(state.getParentNode(), "id")); // parent?!
-
- GlobalTransition::Action action;
- action.onEntry = onentry;
-
- _currGlobalTransition->actions.push_back(action);
- if (!_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE))
- _currGlobalTransition->eventsRaised++;
- _currGlobalTransition->hasExecutableContent = true;
-
-}
-
-static bool isSuperset(const GlobalTransition* t1, const GlobalTransition* t2) {
- bool isSuperset = true;
-
- if (t1->transitionRefs.size() >= t2->transitionRefs.size())
- return false;
-
- NodeSet<std::string> t1Trans = t1->getTransitions();
- NodeSet<std::string> t2Trans = t2->getTransitions();
-
- for (int i = 0; i < t1Trans.size(); i++) {
- if (!InterpreterImpl::isMember(t1Trans[i], t2Trans)) {
- isSuperset = false;
- }
- }
- return isSuperset;
-}
-
-// return false if two transitions have the same source
-std::map<Arabica::DOM::Node<std::string>, Arabica::DOM::Node<std::string> > ChartToFSM::_transParents;
-bool ChartToFSM::filterSameState(const NodeSet<std::string>& transitions) {
-
- for (unsigned int i = 0; i < transitions.size(); i++) {
- Node<std::string> p1 = _transParents[transitions[i]];
-
- for (unsigned int j = i + 1; j < transitions.size(); j++) {
-// if (i == j)
-// continue;
- Node<std::string> p2 = _transParents[transitions[j]];
-
- if (p1 == p2)
- return false;
- }
- }
- return true;
-}
-
-static bool filterChildEnabled(const NodeSet<std::string>& transitions) {
- // drop any transition that is already enabled by a child
- NodeSet<std::string> filteredTransitions;
- for (unsigned int i = 0; i < transitions.size(); i++) {
- Node<std::string> t1 = transitions[i];
- Node<std::string> p1 = InterpreterImpl::getParentState(t1);
- for (unsigned int j = 0; j < transitions.size(); j++) {
- if (i == j)
- continue;
- Node<std::string> t2 = transitions[j];
- Node<std::string> p2 = InterpreterImpl::getParentState(t2);
- p2 = p2.getParentNode(); // TODO: think about again!
- while(p2) {
- if (p1 == p2) {
- std::string eventDesc1 = ATTR_CAST(t1, "event");
- std::string eventDesc2 = ATTR_CAST(t2, "event");
- if (InterpreterImpl::nameMatch(eventDesc1, eventDesc2)) {
- return false;
- }
- }
- p2 = p2.getParentNode();
- }
- }
- filteredTransitions.push_back(t1);
- ;
- }
- return true;
-}
-
-bool ChartToFSM::hasForeachInBetween(const Arabica::DOM::Node<std::string>& ancestor, const Arabica::DOM::Node<std::string>& child) {
- if (!ancestor || !child)
- return false;
-
- Node<std::string> currChild = child;
- while(currChild != ancestor) {
- if (!currChild.getParentNode())
- return false;
- if (TAGNAME_CAST(currChild) == "foreach")
- return true;
- currChild = currChild.getParentNode();
- }
- return false;
-}
-
-void ChartToFSM::annotateRaiseAndSend(const Arabica::DOM::Element<std::string>& root) {
- NodeSet<std::string> execContent;
- execContent.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true));
- execContent.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "onentry", _scxml, true));
- execContent.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "onexit", _scxml, true));
- for (int i = 0; i < execContent.size(); i++) {
- Element<std::string> execContentElem(execContent[i]);
-
- int nrRaise = 0;
- NodeSet<std::string> raise = filterChildElements(_nsInfo.xmlNSPrefix + "raise", execContent[i], true);
- for (int j = 0; j < raise.size(); j++) {
- if (hasForeachInBetween(execContent[i], raise[j])) {
- execContentElem.setAttribute("raise", "-1");
- goto DONE_COUNT_RAISE;
- } else {
- nrRaise++;
- }
- }
- execContentElem.setAttribute("raise", toStr(nrRaise));
-
- DONE_COUNT_RAISE:
-
- int nrSend = 0;
- NodeSet<std::string> sends = filterChildElements(_nsInfo.xmlNSPrefix + "send", execContent[i], true);
- for (int j = 0; j < sends.size(); j++) {
- if (hasForeachInBetween(execContent[i], sends[j])) {
- execContentElem.setAttribute("send", "-1");
- goto DONE_COUNT_SEND;
- } else {
- nrSend++;
- }
- }
- execContentElem.setAttribute("send", toStr(nrSend));
-
- DONE_COUNT_SEND:
- ;
- }
-}
-
-void ChartToFSM::indexTransitions() {
- indexTransitions(_scxml);
- // reverse indices for most prior to be in front
- std::reverse(indexedTransitions.begin(), indexedTransitions.end());
-
- size_t index = 1;
- for (std::vector<Arabica::DOM::Element<std::string> >::iterator transIter = indexedTransitions.begin(); transIter != indexedTransitions.end(); transIter++) {
- transIter->setAttribute("priority", toStr(index));
- index++;
- }
-
-}
-
-void ChartToFSM::indexTransitions(const Arabica::DOM::Element<std::string>& root) {
- // breadth first traversal of transitions
- Arabica::XPath::NodeSet<std::string> levelTransitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", root);
- for (int i = levelTransitions.size() - 1; i >= 0; i--) {
- // push into index starting with least prior
- indexedTransitions.push_back(Element<std::string>(levelTransitions[i]));
- }
-
- Arabica::XPath::NodeSet<std::string> nextLevel = filterChildType(Arabica::DOM::Node_base::ELEMENT_NODE, root);
- for (int i = nextLevel.size() - 1; i >= 0; i--) {
- Element<std::string> stateElem = Element<std::string>(nextLevel[i]);
- if (isState(stateElem))
- indexTransitions(stateElem);
- }
-}
-
-bool GlobalTransition::operator< (const GlobalTransition& other) const {
- const std::vector<Arabica::DOM::Element<std::string> >& indexedTransitions = interpreter->indexedTransitions;
- NodeSet<std::string> transitions = getTransitions();
-
- for (std::vector<Element<std::string> >::const_iterator transIter = indexedTransitions.begin(); transIter != indexedTransitions.end(); transIter++) {
- const Element<std::string>& refTrans = *transIter;
- NodeSet<std::string> otherTransitions = other.getTransitions();
-
- if (InterpreterImpl::isMember(refTrans, transitions) && !InterpreterImpl::isMember(refTrans, otherTransitions)) {
- return true;
- }
- if (!InterpreterImpl::isMember(refTrans, transitions) && InterpreterImpl::isMember(refTrans, otherTransitions)) {
- return false;
- }
- }
- return true; // actually, they are equal
-}
-
-template <typename T> bool PtrComp(const T * const & a, const T * const & b) {
- return *a < *b;
-}
-
-
-/**
- * subset only removes transitions without cond -> superset will always be enabled
- */
-bool hasUnconditionalSuperset (GlobalTransition* first, GlobalTransition* second) {
-
- NodeSet<std::string> firstTransitions = first->getTransitions();
- NodeSet<std::string> secondTransitions = first->getTransitions();
-
- if (isSuperset(second, first)) {
- for (int i = 0; i < firstTransitions.size(); i++) {
- if (!InterpreterImpl::isMember(firstTransitions[i], secondTransitions)) {
- if (HAS_ATTR_CAST(firstTransitions[i], "cond")) {
- return false; // second can't be removed
- }
- }
- }
- return true; // remove second
- }
- return false; //second can't be removed
-}
-
-bool hasEarlierUnconditionalMatch(GlobalTransition* first, GlobalTransition* second) {
- if (first->eventDesc == second->eventDesc) {
- if (first->condition.size() == 0)
- return true;
- }
- return false;
-}
-
-std::list<GlobalTransition*> redundantRemove(std::list<GlobalTransition*> list) {
- for (std::list<GlobalTransition*>::iterator outerIter = list.begin();
- outerIter != list.end();
- outerIter++) {
- for (std::list<GlobalTransition*>::iterator innerIter = outerIter;
- innerIter != list.end();
- innerIter++) {
-
- if (innerIter == outerIter)
- continue;
-
- GlobalTransition* t1 = *outerIter;
- GlobalTransition* t2 = *innerIter;
-
- if (hasUnconditionalSuperset(t1, t2)) {
- list.erase(innerIter++);
- continue;
- } else if (hasUnconditionalSuperset(t2, t1)) {
- list.erase(outerIter++);
- continue;
- }
- if (hasEarlierUnconditionalMatch(t1, t2)) {
- list.erase(innerIter++);
- continue;
- }
- }
- }
- return list;
-}
-
-std::list<GlobalTransition*> redundantMark(std::list<GlobalTransition*> list) {
- for (std::list<GlobalTransition*>::iterator outerIter = list.begin();
- outerIter != list.end();
- outerIter++) {
- for (std::list<GlobalTransition*>::iterator innerIter = outerIter;
- innerIter != list.end();
- innerIter++) {
-
- if (innerIter == outerIter)
- continue;
-
- GlobalTransition* t1 = *outerIter;
- GlobalTransition* t2 = *innerIter;
-
- if (!t1->isValid || !t2->isValid)
- continue;
-
- if (hasUnconditionalSuperset(t1, t2)) {
- t2->isValid = false;
- t2->invalidMsg = "Unconditional superset";
- t2->invalidReason = GlobalTransition::UNCONDITIONAL_SUPERSET;
- continue;
- } else if (hasUnconditionalSuperset(t2, t1)) {
- t1->isValid = false;
- t1->invalidMsg = "Unconditional superset";
- t1->invalidReason = GlobalTransition::UNCONDITIONAL_SUPERSET;
- continue;
- }
- if (hasEarlierUnconditionalMatch(t1, t2)) {
- t2->isValid = false;
- t2->invalidMsg = "Earlier unconditional match";
- t2->invalidReason = GlobalTransition::UNCONDITIONAL_MATCH;
- continue;
- }
- }
- }
- return list;
-}
-
-void ChartToFSM::getPotentialTransitionsForConf(const Arabica::XPath::NodeSet<std::string>& conf, std::map<std::string, GlobalTransition*>& outMap) {
- // get all transition elements from states in the current configuration
- NodeSet<std::string> allTransitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", conf);
-
-
- if (allTransitions.size() == 0)
- return; // no transitions
-
- int nrElements = allTransitions.size();
- int k = 0;
- int* stack = (int*)malloc((nrElements + 1) * sizeof(int));
- memset(stack, 0, (nrElements + 1) * sizeof(int));
-
- while(1) {
- // create the power set of all potential transitions - this is expensive!
- // see: http://www.programminglogic.com/powerset-algorithm-in-c/
-
- if (stack[k] < nrElements) {
- stack[k+1] = stack[k] + 1;
- k++;
- }
-
- else {
- stack[k-1]++;
- k--;
- }
-
- if (k==0)
- break;
-
- NodeSet<std::string> transitions;
- // std::cerr << globalState->stateId << " [" << nrElements << "]: " << std::endl;
- for (int i = 1; i <= k; i++) {
- // std::cerr << stack[i] - 1 << ", ";
- transitions.push_back(allTransitions[stack[i] - 1]);
- }
- // std::cerr << std::endl;
-
- // transitions.push_back(allTransitions[0]);
- // transitions.push_back(allTransitions[4]);
- // transitions.push_back(allTransitions[5]);
- // transitions.push_back(allTransitions[7]);
-
- bool dump = false;
-
- // if (k == 4 && stack[1] == 1 && stack[2] == 5 && stack[3] == 6 && stack[4] == 8) {
- // dump = true;
- // }
-
- if (dump) DUMP_TRANSSET("at start");
-
- _perfTransTotal++;
- _perfTransProcessed++;
-
- DUMP_STATS(nrElements);
-
-
- GlobalTransition* transition = NULL;
-
- // reduce to conflict-free subset
- // transitions.to_document_order();
- if (!_keepInvalidTransitions) {
- // remove transitions in the same state
- if(!filterSameState(transitions))
- continue;
- if (dump) DUMP_TRANSSET("after same state filtered");
-
- // remove those transitions with a child transition
- if(!filterChildEnabled(transitions))
- continue;
- if (dump) DUMP_TRANSSET("after child enabled filtered");
-
- transitions = removeConflictingTransitions(transitions);
- if (dump) DUMP_TRANSSET("after conflicting filtered");
- // algorithm can never reduce to empty set
- assert(transitions.size() > 0);
-
- // create a GlobalTransition object from the set
- transition = new GlobalTransition(transitions, _dataModel, this);
- if (!transition->isValid) {
- // this set of transitions can not be enabled together
- delete transition;
- continue;
- }
- } else {
- transition = new GlobalTransition(transitions, _dataModel, this);
-
- // remove transitions in the same state
- if(!filterSameState(transitions)) {
- transition->isValid = false;
- transition->invalidReason = GlobalTransition::SAME_SOURCE_STATE;
- transition->invalidMsg = "Same source state";
-
- } else if(!filterChildEnabled(transitions)) {
- transition->isValid = false;
- transition->invalidReason = GlobalTransition::CHILD_ENABLED;
- transition->invalidMsg = "Nested transition enabled";
-
- } else {
- NodeSet<std::string> nonPreemptingTransitions = removeConflictingTransitions(transitions);
- if (nonPreemptingTransitions.size() != transitions.size()) {
- transition->isValid = false;
- transition->invalidReason = GlobalTransition::PREEMPTING_MEMBERS;
- transition->invalidMsg = "Preempting members";
- }
- }
-
- }
-
-
- // two combinations might have projected onto the same conflict-free set
- if (outMap.find(transition->transitionId) != outMap.end()) {
- // std::cerr << "skipping as projected onto existing conflict-free subset" << std::endl;
- delete transition;
- continue;
- }
-
- transition->index = _lastTransIndex++;
- _perfTransUsed++;
-
- // remember this conflict-free set
- // std::cerr << "New conflict-free subset: " << transition->transitionId << ":" << transition->eventDesc << std::endl;
- outMap[transition->transitionId] = transition;
- }
- return;
-}
-
-void ChartToFSM::explode() {
-
- std::list<std::pair<GlobalTransition*, GlobalState*> > statesRemaining;
- statesRemaining.push_back(std::make_pair(_currGlobalTransition, new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix, this)));
-
- // add all invokers for initial transition
- for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
- NodeSet<std::string> invokes = filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- invoke(Element<std::string>(invokes[j]));
- }
- }
- _statesToInvoke = NodeSet<std::string>();
-
- /**
- We need to resolve the recursion in order not to exhaust the stack
- */
-
- // append new global states and pop from front
- while(statesRemaining.size() > 0) {
- DUMP_STATS(0);
-
- GlobalState* globalState = statesRemaining.front().second;
- _currGlobalTransition = statesRemaining.front().first;
- statesRemaining.pop_front();
-
- // used to be conditionalized, we will just assume
- assert(_currGlobalTransition);
-
- if (_globalConf.find(globalState->stateId) != _globalConf.end()) {
- if (_currGlobalTransition->isEventless &&
- !_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) {
- // we arrived via a spontaneaous transition, do we need to update?
- updateRaisedAndSendChains(_globalConf[globalState->stateId], _currGlobalTransition, std::set<GlobalTransition*>());
- }
- delete globalState;
- _perfStatesSkippedTotal++;
- _perfStatesSkippedProcessed++;
- continue; // we have already been here
- }
-
- _perfStatesProcessed++;
-
- _configuration = globalState->getActiveStates();
- _alreadyEntered = globalState->getAlreadyEnteredStates();
- _historyValue = globalState->getHistoryStates();
-
- // remember as global configuration
- _globalConf[globalState->stateId] = globalState;
- _globalConf[globalState->stateId]->index = _lastStateIndex++;
-
- if(_globalConf[globalState->stateId]->isFinal) {
- if (_activeConf.find(globalState->activeId) == _activeConf.end()) {
- assert(globalState->activeIndex == -1);
- globalState->activeIndex = _lastActiveIndex++;
- _activeConf[globalState->activeId] = globalState; // remember as active configuration
- exitInterpreter();
- }
- continue; // done in this branch
- }
-
- if (_activeConf.find(globalState->activeId) != _activeConf.end()) {
- // we already know these transition sets, just copy over
- std::list<GlobalTransition*>::iterator sortTransIter = _activeConf[globalState->activeId]->sortedOutgoing.begin();
- while(sortTransIter != _activeConf[globalState->activeId]->sortedOutgoing.end()) {
- globalState->sortedOutgoing.push_back(GlobalTransition::copyWithoutExecContent(*sortTransIter));
- globalState->sortedOutgoing.back()->index = _lastTransIndex++;
- _perfTransUsed++;
- sortTransIter++;
- }
- _perfStatesCachedTotal++;
- _perfStatesCachedProcessed++;
-
- } else {
- // we need to calculate the potential optimal transition sets
- std::map<std::string, GlobalTransition*> transitionSets;
- getPotentialTransitionsForConf(refsToStates(globalState->activeStatesRefs), transitionSets);
-
- // reduce and sort transition sets
- for(std::map<std::string, GlobalTransition*>::iterator transSetIter = transitionSets.begin();
- transSetIter != transitionSets.end();
- transSetIter++) {
- globalState->sortedOutgoing.push_back(transSetIter->second);
- }
-
- globalState->sortedOutgoing.sort(PtrComp<GlobalTransition>);
-// globalState->sortedOutgoing.unique(hasUnconditionalSuperset);
-// globalState->sortedOutgoing.unique(hasEarlierUnconditionalMatch);
- // unique is not quite like what we need, but it was a start
- if (_keepInvalidTransitions) {
- globalState->sortedOutgoing = redundantMark(globalState->sortedOutgoing);
- } else {
- globalState->sortedOutgoing.unique(hasUnconditionalSuperset);
- globalState->sortedOutgoing.unique(hasEarlierUnconditionalMatch);
- globalState->sortedOutgoing = redundantRemove(globalState->sortedOutgoing);
- }
-// globalState->sortedOutgoing = redundantRemove(globalState->sortedOutgoing);
-// globalState->sortedOutgoing = redundantRemove(globalState->sortedOutgoing);
-
-// std::cout << globalState->sortedOutgoing.size() << std::endl;
-
- assert(_activeConf.find(globalState->activeId) == _activeConf.end());
- assert(globalState->activeIndex == -1);
- globalState->activeIndex = _lastActiveIndex++;
- _activeConf[globalState->activeId] = globalState;
- }
-
- // take every transition set and append resulting new state
- for(std::list<GlobalTransition*>::iterator transIter = globalState->sortedOutgoing.begin();
- transIter != globalState->sortedOutgoing.end();
- transIter++) {
-
- GlobalTransition* incomingTrans = _currGlobalTransition;
- GlobalTransition* outgoingTrans = *transIter;
-
- outgoingTrans->source = globalState->stateId;
-
- if (_keepInvalidTransitions && !outgoingTrans->isValid)
- continue;
-
- _currGlobalTransition = outgoingTrans;
-
- microstep(refsToTransitions(outgoingTrans->transitionRefs));
- assert(isLegalConfiguration(_configuration));
-
- _perfMicroStepProcessed++;
- _perfMicroStepTotal++;
-
- // if outgoing transition is spontaneous, add number of events to chain
- if (outgoingTrans->isEventless &&
- !_skipEventChainCalculations &&
- (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) {
- outgoingTrans->eventsChainRaised = MIN(incomingTrans->eventsChainRaised + outgoingTrans->eventsRaised, UNDECIDABLE);
- outgoingTrans->eventsChainSent = MIN(incomingTrans->eventsChainSent + outgoingTrans->eventsSent, UNDECIDABLE);
-
- if (outgoingTrans->eventsChainRaised > _maxEventRaisedChain)
- _maxEventRaisedChain = outgoingTrans->eventsChainRaised;
- if (outgoingTrans->eventsChainSent > _maxEventSentChain)
- _maxEventSentChain = outgoingTrans->eventsChainSent;
-
- }
-
- statesRemaining.push_back(std::make_pair(outgoingTrans, new GlobalState(_configuration, _alreadyEntered, _historyValue, _nsInfo.xmlNSPrefix, this)));
-
- // add all invokers
- for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
- NodeSet<std::string> invokes = filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
- for (unsigned int j = 0; j < invokes.size(); j++) {
- invoke(Element<std::string>(invokes[j]));
- }
- }
- _statesToInvoke = NodeSet<std::string>();
-
- // remember that the last transition lead here
- outgoingTrans->destination = statesRemaining.back().second->stateId;
- outgoingTrans->activeDestination = statesRemaining.back().second->activeId;
- // reset state for next transition set
- _configuration = globalState->getActiveStates();
- _alreadyEntered = globalState->getAlreadyEnteredStates();
- _historyValue = globalState->getHistoryStates();
- }
- }
-
-}
-
-void ChartToFSM::updateRaisedAndSendChains(GlobalState* state, GlobalTransition* source, std::set<GlobalTransition*> visited) {
- for (std::list<GlobalTransition*>::iterator transIter = state->sortedOutgoing.begin(); transIter != state->sortedOutgoing.end(); transIter++) {
- GlobalTransition* transition = *transIter;
-
- if (!transition->isEventless)
- continue; // we do not care for eventful transitions
-
- // source leads to spontaneous transition -> update event chains
- bool eventChainsNeedUpdated = false;
-
- if (visited.find(transition) != visited.end()) {
- // potential spontaneous transition cycle!
- if (transition->eventsChainRaised > 0)
- _maxEventRaisedChain = UNDECIDABLE;
- if (transition->eventsChainSent > 0)
- _maxEventSentChain = UNDECIDABLE;
- return;
- }
-
- // UNDECIDABLE means "undecidable / endless"
-
- // will source increase our event chain?
- if (transition->eventsChainRaised != UNDECIDABLE &&
- transition->eventsChainRaised < source->eventsChainRaised + transition->eventsRaised) {
- // taking transition after source causes more events in chain
- transition->eventsChainRaised = MIN(source->eventsChainRaised + transition->eventsRaised, UNDECIDABLE);
- eventChainsNeedUpdated = true;
- }
- if (transition->eventsChainSent != UNDECIDABLE &&
- transition->eventsChainSent < source->eventsChainSent + transition->eventsSent) {
- // taking transition after source causes more events in chain
- transition->eventsChainSent = MIN(source->eventsChainSent + transition->eventsSent, UNDECIDABLE);
- eventChainsNeedUpdated = true;
- }
-
- if (eventChainsNeedUpdated &&
- transition->destination.length() > 0 &&
- _globalConf.find(transition->destination) != _globalConf.end()) {
-
- visited.insert(transition);
- // iterate all spontaneous transitions in destination and update event chains
- updateRaisedAndSendChains(_globalConf[transition->destination], transition, visited);
- }
-
- if (transition->eventsChainRaised > _maxEventRaisedChain)
- _maxEventRaisedChain = transition->eventsChainRaised;
- if (transition->eventsChainSent > _maxEventSentChain)
- _maxEventSentChain = transition->eventsChainSent;
- }
-}
-
-uint32_t ChartToFSM::getMinInternalQueueLength(uint32_t defaultVal) {
- if (_maxEventRaisedChain != UNDECIDABLE)
- return _maxEventRaisedChain + _doneEventRaiseTolerance;
- return defaultVal;
-}
-
-uint32_t ChartToFSM::getMinExternalQueueLength(uint32_t defaultVal) {
- if (_maxEventSentChain != UNDECIDABLE)
- return _maxEventSentChain;
- return defaultVal;
-}
-
-void ChartToFSM::reassembleFromFlat() {
- LOG(ERROR) << "Cannot flatten flat SCXML document";
- abort();
-}
-
-Arabica::XPath::NodeSet<std::string> ChartToFSM::refsToStates(const std::set<int>& stateRefs) {
- NodeSet<std::string> states;
- for (std::set<int>::const_iterator stateIter = stateRefs.begin(); stateIter != stateRefs.end(); stateIter++) {
- states.push_back(indexedStates[*stateIter]);
- }
- return states;
-}
-
-Arabica::XPath::NodeSet<std::string> ChartToFSM::refsToTransitions(const std::set<int>& transRefs) {
- NodeSet<std::string> transitions;
- for (std::set<int>::const_iterator transIter = transRefs.begin(); transIter != transRefs.end(); transIter++) {
- transitions.push_back(indexedTransitions[*transIter]);
- }
- return transitions;
-}
-
-void ChartToFSM::beforeMicroStep(Interpreter interpreter) {
-}
-void ChartToFSM::onStableConfiguration(Interpreter interpreter) {
-}
-void ChartToFSM::beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- GlobalTransition::Action action;
- action.exited = state;
- _currGlobalTransition->actions.push_back(action);
-}
-void ChartToFSM::beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- GlobalTransition::Action action;
- action.entered = state;
- _currGlobalTransition->actions.push_back(action);
-}
-void ChartToFSM::beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
-}
-
-GlobalState::GlobalState(const Arabica::XPath::NodeSet<std::string>& activeStates_,
- const Arabica::XPath::NodeSet<std::string>& alreadyEnteredStates_, // we need to remember for binding=late
- const std::map<std::string, Arabica::XPath::NodeSet<std::string> >& historyStates_,
- const std::string& xmlNSPrefix,
- ChartToFSM* flattener) {
- interpreter = flattener;
- activeIndex = -1;
-
- // take references
- for (int i = 0; i < activeStates_.size(); i++) {
- activeStatesRefs.insert(strTo<int>(ATTR_CAST(activeStates_[i], "index")));
- }
-
- for (int i = 0; i < alreadyEnteredStates_.size(); i++) {
- alreadyEnteredStatesRefs.insert(strTo<int>(ATTR_CAST(alreadyEnteredStates_[i], "index")));
- }
-
- for (std::map<std::string, Arabica::XPath::NodeSet<std::string> >::const_iterator histIter = historyStates_.begin(); histIter != historyStates_.end(); histIter++) {
- for (int i = 0; i < histIter->second.size(); i++) {
- historyStatesRefs[histIter->first].insert(strTo<int>(ATTR_CAST(histIter->second[i], "index")));
- }
- }
-
- isFinal = false;
-
- // is state this final?
- for(int i = 0; i < activeStates_.size(); i++) {
- Arabica::DOM::Element<std::string> state = Arabica::DOM::Element<std::string>(activeStates_[i]);
- Arabica::DOM::Element<std::string> parentElem = (Arabica::DOM::Element<std::string>)state.getParentNode();
- if(InterpreterImpl::isFinal(state) && iequals(parentElem.getTagName(), xmlNSPrefix + "scxml")) {
- isFinal = true;
- break;
- }
- }
-
- FlatStateIdentifier flatStateId(getActiveStates(), getAlreadyEnteredStates(), getHistoryStates());
- stateId = flatStateId.getStateId();
- activeId = flatStateId.getFlatActive();
-}
-
-GlobalTransition* GlobalTransition::copyWithoutExecContent(GlobalTransition* other) {
- GlobalTransition* newTrans = new GlobalTransition(*other);
- newTrans->actions.clear();
- newTrans->historyBase = other;
- other->historyTrans.push_back(newTrans);
- return newTrans;
-}
-
-GlobalTransition::GlobalTransition(const Arabica::XPath::NodeSet<std::string>& transitionSet, DataModel dataModel, ChartToFSM* flattener) {
- interpreter = flattener;
-
- eventsRaised = 0;
- eventsSent = 0;
- eventsChainRaised = 0;
- eventsChainSent = 0;
- historyBase = NULL;
-
- for (int i = 0; i < transitionSet.size(); i++) {
- transitionRefs.insert(strTo<int>(ATTR_CAST(transitionSet[i], "index")));
- }
-
- std::ostringstream setId; // also build id for subset
- std::string seperator = "";
- for (std::set<int>::iterator transIter = transitionRefs.begin(); transIter != transitionRefs.end(); transIter++) {
- setId << seperator << *transIter;
- seperator = "-";
- }
- transitionId = setId.str();
-
- hasExecutableContent = false;
- isValid = true;
- isEventless = true;
-
-#if 0
- std::cerr << "################" << std::endl;
- for (int i = 0; i < transitions.size(); i++) {
- std::cerr << transitions[i] << std::endl;
- }
- std::cerr << "################" << std::endl;
-#endif
-
- // first establish whether this is a valid set
-
- /**
- * Can these events event occur together? They can't if:
- * 1. event / eventless is mixed
- * 2. target / targetless is mixed (?)
- * 3. there is no common prefix for their event attribute
- */
-
- bool foundWithEvent = false;
- bool foundEventLess = false;
- bool foundWithTarget = false;
- bool foundTargetLess = false;
-
- Arabica::DOM::Element<std::string> withEvent;
- Arabica::DOM::Element<std::string> noneEvent;
- Arabica::DOM::Element<std::string> withTarget;
- Arabica::DOM::Element<std::string> noneTarget;
-
- for (int i = 0; i < transitionSet.size(); i++) {
- Arabica::DOM::Element<std::string> transElem = Arabica::DOM::Element<std::string>(transitionSet[i]);
- if (HAS_ATTR(transElem, "eventexpr")) {
- ERROR_EXECUTION_THROW("Cannot flatten document with eventexpr attributes");
- }
- if (HAS_ATTR(transElem, "event")) {
- foundWithEvent = true;
- withEvent = transElem;
- if (foundEventLess)
- break;
- } else {
- foundEventLess = true;
- noneEvent = transElem;
- if (foundWithEvent)
- break;
- }
- if (HAS_ATTR(transElem, "target")) {
- foundWithTarget = true;
- withTarget = transElem;
- if (foundTargetLess)
- break;
- } else {
- foundTargetLess = true;
- noneTarget = transElem;
- if (foundWithTarget)
- break;
- }
-
- }
-
- // do not mix eventless and event transitions
- if (foundEventLess && foundWithEvent) {
- if (flattener->_keepInvalidTransitions) {
- invalidReason = MIXES_EVENT_SPONTANEOUS;
- invalidMsg = "Mixes (non-)spontaneous";
- }
- isValid = false;
- return;
- }
-
- // 403c vs 229 / 403b - solved via filterChildEnabled
- if (foundTargetLess && foundWithTarget) {
-// isValid = false;
-// return;
- }
-
- isEventless = foundEventLess;
- isTargetless = !foundWithTarget;
-
- // is there a set of event names that would enable this conflict-free transition set?
- if (foundWithEvent) {
- // get the set of longest event descriptors that will enable this transition set
- eventNames = getCommonEvents(transitionSet);
- if (eventNames.size() == 0) {
-// LOG(INFO) << "No event will activate this conflict-free subset" << std::endl;
- if (flattener->_keepInvalidTransitions) {
- invalidReason = NO_COMMON_EVENT;
- invalidMsg = "No common event";
- }
- isValid = false;
- return;
- } else {
- std::string seperator = "";
- for (std::list<std::string>::iterator eventIter = eventNames.begin();
- eventIter != eventNames.end();
- eventIter++) {
- eventDesc += seperator + *eventIter;
- seperator = " ";
- }
- }
- if (eventDesc.size() == 0)
- eventDesc = "*";
- }
-
- // extract conditions and history targets
- std::list<std::string> conditions;
- for (int i = 0; i < transitionSet.size(); i++) {
- Arabica::DOM::Element<std::string> transElem = Arabica::DOM::Element<std::string>(transitionSet[i]);
- // gather conditions while we are iterating anyway
- if (HAS_ATTR(transElem, "cond")) {
- conditions.push_back(boost::trim_copy(ATTR(transElem, "cond")));
- }
-
- std::list<std::string> targets = InterpreterImpl::tokenizeIdRefs(ATTR(transElem, "target"));
- std::list<std::string>::iterator targetIter = targets.begin();
- while(targetIter != targets.end()) {
-// std::cout << "// " << *targetIter << std::endl;
- if (flattener->_historyTargets.find(*targetIter) != flattener->_historyTargets.end()) {
- histTargets.insert(*targetIter);
- }
- targetIter++;
- }
-// std::cout << std::endl << std::endl;
- }
-
- seperator = "";
- for (std::vector<Element<std::string> >::iterator transIter = interpreter->indexedTransitions.begin(); transIter != interpreter->indexedTransitions.end(); transIter++) {
- const Element<std::string>& refTrans = *transIter;
- if (!HAS_ATTR(refTrans, "priority"))
- continue;
- if (InterpreterImpl::isMember(refTrans, transitionSet)) {
- members += seperator + ATTR(refTrans, "priority");
- } else {
- members += seperator;
- for (int i = 0; i < ATTR(refTrans, "priority").size(); i++) {
- members += " ";
- }
- }
- seperator = " ";
- }
-
- // if (members == " 4 6 7 ")
- // std::cout << "asdfadf";
-
- if (conditions.size() > 1) {
- condition = dataModel.andExpressions(conditions);
- if (condition.size() == 0) {
- LOG(ERROR) << "Datamodel does not support to conjungate expressions!" << std::endl;
- }
- } else if (conditions.size() == 1) {
- condition = conditions.front();
- }
-}
-
-Arabica::XPath::NodeSet<std::string> GlobalState::getActiveStates() {
- return interpreter->refsToStates(activeStatesRefs);
-}
-
-Arabica::XPath::NodeSet<std::string> GlobalState::getAlreadyEnteredStates() {
- return interpreter->refsToStates(alreadyEnteredStatesRefs);
-}
-
-std::map<std::string, Arabica::XPath::NodeSet<std::string> > GlobalState::getHistoryStates() {
- std::map<std::string, Arabica::XPath::NodeSet<std::string> > historyValue;
- for (std::map<std::string, std::set<int> >::iterator histIter = historyStatesRefs.begin(); histIter != historyStatesRefs.end(); histIter++) {
- historyValue[histIter->first] = interpreter->refsToStates(histIter->second);
- }
- return historyValue;
-}
-
-
-Arabica::XPath::NodeSet<std::string> GlobalTransition::getTransitions() const {
- return interpreter->refsToTransitions(transitionRefs);
-}
-
-std::list<std::string> GlobalTransition::getCommonEvents(const NodeSet<std::string>& transitions) {
- std::list<std::string> prefixes;
- std::list<std::string> longestPrefixes;
-
- for (int i = 0; i < transitions.size(); i++) {
- // for every transition
- std::list<std::string> eventNames = InterpreterImpl::tokenizeIdRefs(ATTR_CAST(transitions[i], "event"));
-
- for (std::list<std::string>::iterator eventNameIter = eventNames.begin();
- eventNameIter != eventNames.end();
- eventNameIter++) {
- // for every event descriptor
- std::string eventName = *eventNameIter;
-
- // remove trailing .*
- if (eventName.find("*", eventName.size() - 1) != std::string::npos)
- eventName = eventName.substr(0, eventName.size() - 1);
- if (eventName.find(".", eventName.size() - 1) != std::string::npos)
- eventName = eventName.substr(0, eventName.size() - 1);
-
- bool isMatching = true;
- for (int j = 0; j < transitions.size(); j++) {
- // check if token would activate all other transitions
- if (i == j)
- continue;
- if (!InterpreterImpl::nameMatch(ATTR_CAST(transitions[j], "event"), eventName)) {
- isMatching = false;
- break;
- }
- }
- if (isMatching) {
- prefixes.push_back(eventName);
- }
- }
- }
-
- // from the set of event names, remove those that are prefixes
- for (std::list<std::string>::iterator outerEventNameIter = prefixes.begin();
- outerEventNameIter != prefixes.end();
- outerEventNameIter++) {
- for (std::list<std::string>::iterator innerEventNameIter = prefixes.begin();
- innerEventNameIter != prefixes.end();
- innerEventNameIter++) {
- if (!iequals(*outerEventNameIter, *innerEventNameIter) && InterpreterImpl::nameMatch(*outerEventNameIter, *innerEventNameIter)) {
- goto IS_PREFIX;
- }
- }
- longestPrefixes.push_back(*outerEventNameIter);
-IS_PREFIX:
- ;
- }
- return longestPrefixes;
-}
-
-}
diff --git a/src/uscxml/transform/ChartToFSM.h b/src/uscxml/transform/ChartToFSM.h
deleted file mode 100644
index fa76f3a..0000000
--- a/src/uscxml/transform/ChartToFSM.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CHARTTOFSM_H_IOKPYEBY
-#define CHARTTOFSM_H_IOKPYEBY
-
-#include "uscxml/interpreter/InterpreterRC.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
-#include <ostream>
-#include <list>
-
-namespace uscxml {
-class GlobalState;
-class GlobalTransition;
-class ChartToFSM;
-
-
-class USCXML_API GlobalState {
-public:
-
- GlobalState() {}
- GlobalState(const Arabica::DOM::Node<std::string>& globalState);
- GlobalState(const Arabica::XPath::NodeSet<std::string>& activeStates,
- const Arabica::XPath::NodeSet<std::string>& alreadyEnteredStates, // we need to remember for binding=late
- const std::map<std::string, Arabica::XPath::NodeSet<std::string> >& historyStates,
- const std::string& xmlNSPrefix,
- ChartToFSM* flattener);
-
- std::set<int> activeStatesRefs;
- std::set<int> alreadyEnteredStatesRefs;
- std::map<std::string, std::set<int> > historyStatesRefs;
-
- std::list<GlobalTransition*> sortedOutgoing;
- std::string stateId;
- std::string activeId;
-
- unsigned long activeIndex;
- unsigned long index;
- bool isFinal;
-
- ChartToFSM* interpreter;
-
- Arabica::XPath::NodeSet<std::string> getActiveStates();
- Arabica::XPath::NodeSet<std::string> getAlreadyEnteredStates();
- std::map<std::string, Arabica::XPath::NodeSet<std::string> > getHistoryStates();
-
-// friend class ChartToFSM;
-};
-
-
-class USCXML_API GlobalTransition {
-public:
- enum InvalidReason {
- MIXES_EVENT_SPONTANEOUS,
- NO_COMMON_EVENT,
- CHILD_ENABLED,
- SAME_SOURCE_STATE,
- UNCONDITIONAL_SUPERSET,
- UNCONDITIONAL_MATCH,
- PREEMPTING_MEMBERS
- };
-
- class Action {
- public:
- bool operator<(const Action& other) const {
- if ((onEntry && !other.onEntry) || (!onEntry && other.onEntry))
- return true;
- if ((raiseDone && !other.raiseDone) || (!raiseDone && other.raiseDone))
- return true;
- if ((onExit && !other.onExit) || (!onExit && other.onExit))
- return true;
- if ((transition && !other.transition) || (!transition && other.transition))
- return true;
- if ((entered && !other.entered) || (!entered && other.entered))
- return true;
- if ((exited && !other.exited) || (!exited && other.exited))
- return true;
- if ((invoke && !other.invoke) || (!invoke && other.invoke))
- return true;
- if ((uninvoke && !other.uninvoke) || (!uninvoke && other.uninvoke))
- return true;
-
- if (onEntry < other.onEntry)
- return onEntry < other.onEntry;
- if (raiseDone < other.raiseDone)
- return raiseDone < other.raiseDone;
- if (onExit < other.onExit)
- return onExit < other.onExit;
- if (transition < other.transition)
- return transition < other.transition;
- if (entered < other.entered)
- return entered < other.entered;
- if (exited < other.exited)
- return exited < other.exited;
- if (invoke < other.invoke)
- return invoke < other.invoke;
- if (uninvoke < other.uninvoke)
- return uninvoke < other.uninvoke;
- return false;
- }
-
- bool operator==(const Action& other) const {
- return !(other < *this) && !(*this < other);
- }
- bool operator!=(const Action& other) const {
- return !operator==(other);
- }
-
- friend USCXML_API std::ostream& operator<< (std::ostream& os, const Action& action);
-
- typedef std::list<GlobalTransition::Action>::iterator iter_t;
-
- Arabica::DOM::Element<std::string> onEntry;
- Arabica::DOM::Element<std::string> onExit;
- Arabica::DOM::Element<std::string> transition;
- Arabica::DOM::Element<std::string> entered;
- Arabica::DOM::Element<std::string> exited;
- Arabica::DOM::Element<std::string> invoke;
- Arabica::DOM::Element<std::string> uninvoke;
- Arabica::DOM::Element<std::string> raiseDone;
-
- };
-
- GlobalTransition(const Arabica::XPath::NodeSet<std::string>& transitions, DataModel dataModel, ChartToFSM* flattener);
- static GlobalTransition* copyWithoutExecContent(GlobalTransition* other);
-
- bool isValid; // constructor will determine, calling code will delete if not
- std::string invalidMsg;
- InvalidReason invalidReason;
-
- bool isEventless; // whether or not all our transitions are eventless
- bool isTargetless; // whether or not all our transitions are eventless
- bool isSubset; // there is a superset to this set
- bool hasExecutableContent;
-
- uint32_t eventsRaised; // internal events this transition will raise
- uint32_t eventsSent; // external events this transition will send
- uint32_t eventsChainRaised; // maximum number of internal events raised when taking this transition in a chain
- uint32_t eventsChainSent; // maximum number of external events raised when taking this transition in a chain
-
- std::set<int> startTransitionRefs; // indices of eventful transitions that might trigger this transition
-
- std::set<int> transitionRefs; // indizes of constituting transitions
- Arabica::XPath::NodeSet<std::string> getTransitions() const;
-
- std::list<std::string> eventNames; // the list of longest event names that will enable this set
- std::string eventDesc; // space-seperated eventnames for convenience
- std::string condition; // conjunction of all the set's conditions
- std::string members; // a convenience string listing all constituting transitions
-
- // executable content we gathered when we took the transition
- std::list<Action> actions;
-
- std::string transitionId;
- std::string source;
- std::string destination;
- std::string activeDestination;
-
- GlobalTransition* historyBase; // we have a base transition that left our source with no history (-> we are a history transition)
- std::list<GlobalTransition*> historyTrans; // transitions from the same source but different histories
- std::set<std::string> histTargets; // constituting targets to history states
-
- long index;
- ChartToFSM* interpreter;
-
- bool operator< (const GlobalTransition& other) const;
-
-protected:
- std::list<std::string> getCommonEvents(const Arabica::XPath::NodeSet<std::string>& transitions);
-};
-
-USCXML_API std::ostream& operator<< (std::ostream& os, const GlobalTransition::Action& action);
-
-class TransitionTreeNode {
-public:
- enum TransitionTreeNodeType {
- TYPE_UNDEFINED,
- TYPE_PARALLEL,
- TYPE_NESTED,
- TYPE_TRANSITION
- };
-
- TransitionTreeNode()
- : prevTransition(NULL),
- nextTransition(NULL),
- firstTransition(NULL),
- firstState(NULL),
- parent(NULL),
- type(TYPE_UNDEFINED) {}
-
- virtual ~TransitionTreeNode() {
- for (std::list<TransitionTreeNode*>::iterator childIter = children.begin(); childIter != children.end(); childIter++) {
- delete(*childIter);
- }
- }
-
- void dump(int indent = 0);
-
- TransitionTreeNode* prevTransition;
- TransitionTreeNode* nextTransition;
- Arabica::DOM::Element<std::string> transition;
-
- Arabica::DOM::Element<std::string> state;
- TransitionTreeNode* firstTransition;
- TransitionTreeNode* lastTransition;
- TransitionTreeNode* firstState;
-
- TransitionTreeNode* parent;
- std::list<TransitionTreeNode*> children;
- std::string nodeId;
-
- TransitionTreeNodeType type;
-
- bool operator<(const TransitionTreeNode& other) const {
- return nodeId < other.nodeId;
- }
-
-};
-
-class USCXML_API ChartToFSM : public InterpreterRC, public InterpreterMonitor {
-public:
- ChartToFSM(const Interpreter& other);
- virtual ~ChartToFSM();
-
- void indexTransitions();
- void annotateDomain();
- void annotateExitSet();
- void annotateEntrySet();
- void annotateConflicts();
- Arabica::DOM::Document<std::string> getDocument() const; // overwrite to return flat FSM
-
-protected:
-
- InterpreterState interpret();
-
- GlobalState* _start;
- Arabica::DOM::Document<std::string> _flatDoc;
- std::map<std::string, GlobalState*> _globalConf;
- std::map<std::string, GlobalState*> _activeConf; // potentially enabled transition sets per active configuration
- std::map<std::string, Arabica::DOM::Element<std::string> > _historyTargets; // ids of all history states
-
- uint32_t getMinInternalQueueLength(uint32_t defaultVal);
- uint32_t getMinExternalQueueLength(uint32_t defaultVal);
-
- bool _keepInvalidTransitions;
- bool _transitionsFromTree;
-
- std::vector<Arabica::DOM::Element<std::string> > indexedTransitions;
- std::vector<Arabica::DOM::Element<std::string> > indexedStates;
-
-private:
- Arabica::XPath::NodeSet<std::string> refsToStates(const std::set<int>&);
- Arabica::XPath::NodeSet<std::string> refsToTransitions(const std::set<int>&);
-
- // gather executable content per microstep
- void executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow = false);
-
- // invoke and uninvoke
- virtual void invoke(const Arabica::DOM::Element<std::string>& element);
- virtual void cancelInvoke(const Arabica::DOM::Element<std::string>& element);
-
- // override to do nothing
- void send(const Arabica::DOM::Element<std::string>& element) {}
- void internalDoneSend(const Arabica::DOM::Element<std::string>& state, const Arabica::DOM::Element<std::string>& doneData);
-
- // InterpreterMonitor
- virtual void beforeMicroStep(Interpreter interpreter);
- virtual void onStableConfiguration(Interpreter interpreter);
- virtual void beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
-
- void explode();
- void getPotentialTransitionsForConfFromPowerSet(const Arabica::XPath::NodeSet<std::string>& conf, std::map<std::string, GlobalTransition*>& outMap);
- void getPotentialTransitionsForConfFromTree(const Arabica::XPath::NodeSet<std::string>& conf, std::map<std::string, GlobalTransition*>& outMap);
-// void labelTransitions();
- TransitionTreeNode* buildTransTree(const Arabica::DOM::Element<std::string>& root, const std::string& nodeId);
-
- void indexTransitions(const Arabica::DOM::Element<std::string>& root);
- void annotateRaiseAndSend(const Arabica::DOM::Element<std::string>& root);
- bool hasForeachInBetween(const Arabica::DOM::Node<std::string>& ancestor, const Arabica::DOM::Node<std::string>& child);
- void updateRaisedAndSendChains(GlobalState* state, GlobalTransition* source, std::set<GlobalTransition*> visited);
-
- void reassembleFromFlat();
-
- std::list<GlobalTransition*> sortTransitions(std::list<GlobalTransition*> list);
-
- // we need this static as we use it in a sort function
- static std::map<Arabica::DOM::Node<std::string>, Arabica::DOM::Node<std::string> > _transParents;
-
- static bool filterSameState(const Arabica::XPath::NodeSet<std::string>& transitions);
-
- uint64_t _perfTransProcessed;
- uint64_t _perfTransTotal;
- uint64_t _perfTransUsed;
- uint64_t _perfStatesProcessed;
- uint64_t _perfStatesTotal;
- uint64_t _perfStatesSkippedProcessed;
- uint64_t _perfStatesSkippedTotal;
- uint64_t _perfStatesCachedProcessed;
- uint64_t _perfStatesCachedTotal;
- uint64_t _perfMicroStepProcessed;
- uint64_t _perfMicroStepTotal;
- uint64_t _perfStackSize;
- uint64_t _lastTimeStamp;
-
- size_t _lastTransientStateId;
- size_t _lastStateIndex;
- size_t _lastActiveIndex;
- size_t _lastTransIndex;
-
- bool _alreadyFlat;
-
- bool _skipEventChainCalculations;
- size_t _maxEventSentChain;
- size_t _maxEventRaisedChain;
- size_t _doneEventRaiseTolerance;
-
- GlobalTransition* _currGlobalTransition;
- std::map<std::string, std::map<std::string, GlobalTransition*> > _confToTransitions;
-
- TransitionTreeNode* _transTree;
- std::map<Arabica::DOM::Element<std::string>, TransitionTreeNode*> _stateToTransTreeNode;
-
- friend class GlobalTransition;
- friend class GlobalState;
-};
-
-}
-
-#endif /* end of include guard: CHARTTOFSM_H_IOKPYEBY */
diff --git a/src/uscxml/transform/ChartToFSM.h.new b/src/uscxml/transform/ChartToFSM.h.new
deleted file mode 100644
index 2ec2f44..0000000
--- a/src/uscxml/transform/ChartToFSM.h.new
+++ /dev/null
@@ -1,303 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CHARTTOFSM_H_IOKPYEBY
-#define CHARTTOFSM_H_IOKPYEBY
-
-#include "uscxml/DOMUtils.h"
-#include "uscxml/interpreter/InterpreterRC.h"
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
-#include <ostream>
-#include <list>
-
-namespace uscxml {
-class GlobalState;
-class GlobalTransition;
-class ChartToFSM;
-
-class USCXML_API Complexity {
-public:
-
- enum Variant {
- IGNORE_NOTHING,
- IGNORE_HISTORY,
- IGNORE_NESTED_DATA,
- IGNORE_HISTORY_AND_NESTED_DATA,
- };
-
- Complexity() : value(0), nestedData(0) {}
- Complexity(uint64_t value) : value(value), nestedData(0) {}
-
- Complexity& operator+=(const Complexity& rhs) {
- value += rhs.value;
- nestedData += rhs.nestedData;
- history.insert(history.end(), rhs.history.begin(), rhs.history.end());
- return *this;
- }
-
- Complexity& operator*=(const Complexity& rhs) {
- value *= rhs.value;
- nestedData += rhs.nestedData;
- history.insert(history.end(), rhs.history.begin(), rhs.history.end());
- return *this;
- }
-
- static uint64_t stateMachineComplexity(const Arabica::DOM::Element<std::string>& root, Complexity::Variant variant = IGNORE_NOTHING);
-
-protected:
- static Complexity calculateStateMachineComplexity(const Arabica::DOM::Element<std::string>& root);
-
- uint64_t value;
- uint64_t nestedData;
- std::list<uint64_t> history;
-};
-
-class USCXML_API GlobalState {
-public:
-
- GlobalState() {}
- GlobalState(const Arabica::DOM::Node<std::string>& globalState);
- GlobalState(const Arabica::XPath::NodeSet<std::string>& activeStates,
- const Arabica::XPath::NodeSet<std::string>& alreadyEnteredStates, // we need to remember for binding=late
- const std::map<std::string, Arabica::XPath::NodeSet<std::string> >& historyStates,
- const std::string& xmlNSPrefix,
- ChartToFSM* flattener);
-
- std::set<int> activeStatesRefs;
- std::set<int> alreadyEnteredStatesRefs;
- std::map<std::string, std::set<int> > historyStatesRefs;
-
- std::list<GlobalTransition*> sortedOutgoing;
- std::string stateId;
- std::string activeId;
-
- unsigned long activeIndex;
- unsigned long index;
- bool isFinal;
-
- ChartToFSM* interpreter;
-
- Arabica::XPath::NodeSet<std::string> getActiveStates();
- Arabica::XPath::NodeSet<std::string> getAlreadyEnteredStates();
- std::map<std::string, Arabica::XPath::NodeSet<std::string> > getHistoryStates();
-
-};
-
-
-class USCXML_API GlobalTransition {
-public:
- enum InvalidReason {
- MIXES_EVENT_SPONTANEOUS,
- NO_COMMON_EVENT,
- CHILD_ENABLED,
- SAME_SOURCE_STATE,
- UNCONDITIONAL_SUPERSET,
- UNCONDITIONAL_MATCH,
- PREEMPTING_MEMBERS
- };
-
- class Action {
- public:
- bool operator<(const Action& other) const {
- if (onEntry < other.onEntry)
- return onEntry < other.onEntry;
- if (onExit < other.onExit)
- return onExit < other.onExit;
- if (transition < other.transition)
- return transition < other.transition;
- if (entered < other.entered)
- return entered < other.entered;
- if (exited < other.exited)
- return exited < other.exited;
- if (invoke < other.invoke)
- return invoke < other.invoke;
- if (uninvoke < other.uninvoke)
- return uninvoke < other.uninvoke;
- return false;
- }
-
- bool operator==(const Action& other) const {
- return !(other < *this) && !(*this < other);
- }
- bool operator!=(const Action& other) const {
- return !operator==(other);
- }
-
- typedef std::list<GlobalTransition::Action>::iterator iter_t;
-
- Arabica::DOM::Element<std::string> onEntry;
- Arabica::DOM::Element<std::string> onExit;
- Arabica::DOM::Element<std::string> transition;
- Arabica::DOM::Element<std::string> entered;
- Arabica::DOM::Element<std::string> exited;
- Arabica::DOM::Element<std::string> invoke;
- Arabica::DOM::Element<std::string> uninvoke;
-
- };
-
- GlobalTransition(const Arabica::XPath::NodeSet<std::string>& transitions, DataModel dataModel, ChartToFSM* flattener);
- static GlobalTransition* copyWithoutExecContent(GlobalTransition* other);
-
- bool isValid; // constructor will determine, calling code will delete if not
- std::string invalidMsg;
- InvalidReason invalidReason;
-
- bool isEventless; // whether or not all our transitions are eventless
- bool isTargetless; // whether or not all our transitions are eventless
- bool isSubset; // there is a superset to this set
- bool hasExecutableContent;
-
- uint32_t eventsRaised; // internal events this transition will raise
- uint32_t eventsSent; // external events this transition will send
- uint32_t eventsChainRaised; // maximum number of internal events raised when taking this transition in a chain
- uint32_t eventsChainSent; // maximum number of external events raised when taking this transition in a chain
-
- std::set<int> startTransitionRefs; // indices of eventful transitions that might trigger this transition
-
- std::set<int> transitionRefs; // indizes of constituting transitions
- Arabica::XPath::NodeSet<std::string> getTransitions() const;
-
- std::list<std::string> eventNames; // the list of longest event names that will enable this set
- std::string eventDesc; // space-seperated eventnames for convenience
- std::string condition; // conjunction of all the set's conditions
- std::string members; // a convenience string listing all constituting transitions
-
- // executable content we gathered when we took the transition
- std::list<Action> actions;
-
- std::string transitionId;
- std::string source;
- std::string destination;
- std::string activeDestination;
-
- GlobalTransition* historyBase; // we have a base transition that left our source with no history (-> we are a history transition)
- std::list<GlobalTransition*> historyTrans; // transitions from the same source but different histories
- std::set<std::string> histTargets; // constituting targets to history states
-
- long index;
- ChartToFSM* interpreter;
-
- bool operator< (const GlobalTransition& other) const;
-
-protected:
- std::list<std::string> getCommonEvents(const Arabica::XPath::NodeSet<std::string>& transitions);
-};
-
-
-class USCXML_API ChartToFSM : public InterpreterRC, public InterpreterMonitor {
-public:
- ChartToFSM(const Interpreter& other);
- virtual ~ChartToFSM();
-
- void indexTransitions();
- Arabica::DOM::Document<std::string> getDocument() const; // overwrite to return flat FSM
-
-protected:
-
- InterpreterState interpret();
-
- GlobalState* _start;
- Arabica::DOM::Document<std::string> _flatDoc;
- std::map<std::string, GlobalState*> _globalConf;
- std::map<std::string, GlobalState*> _activeConf; // potentially enabled transition sets per active configuration
- std::map<std::string, Arabica::DOM::Element<std::string> > _historyTargets; // ids of all history states
-
- uint32_t getMinInternalQueueLength(uint32_t defaultVal);
- uint32_t getMinExternalQueueLength(uint32_t defaultVal);
-
- bool _keepInvalidTransitions;
-
-private:
- Arabica::XPath::NodeSet<std::string> refsToStates(const std::set<int>&);
- Arabica::XPath::NodeSet<std::string> refsToTransitions(const std::set<int>&);
-
- std::vector<Arabica::DOM::Element<std::string> > indexedTransitions;
- std::vector<Arabica::DOM::Element<std::string> > indexedStates;
-
- // gather executable content per microstep
- void executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow = false);
-
- // invoke and uninvoke
- virtual void invoke(const Arabica::DOM::Element<std::string>& element);
- virtual void cancelInvoke(const Arabica::DOM::Element<std::string>& element);
-
- // override to do nothing
- void send(const Arabica::DOM::Element<std::string>& element) {}
- void internalDoneSend(const Arabica::DOM::Element<std::string>& state);
-
- // InterpreterMonitor
- virtual void beforeMicroStep(Interpreter interpreter);
- virtual void onStableConfiguration(Interpreter interpreter);
- virtual void beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
-
- void explode();
- void getPotentialTransitionsForConf(const Arabica::XPath::NodeSet<std::string>& conf, std::map<std::string, GlobalTransition*>& outMap);
-// void labelTransitions();
-
- void indexTransitions(const Arabica::DOM::Element<std::string>& root);
- void annotateRaiseAndSend(const Arabica::DOM::Element<std::string>& root);
- bool hasForeachInBetween(const Arabica::DOM::Node<std::string>& ancestor, const Arabica::DOM::Node<std::string>& child);
- void updateRaisedAndSendChains(GlobalState* state, GlobalTransition* source, std::set<GlobalTransition*> visited);
-
- void reassembleFromFlat();
-
- std::list<GlobalTransition*> sortTransitions(std::list<GlobalTransition*> list);
-
- // we need this static as we use it in a sort function
- static std::map<Arabica::DOM::Node<std::string>, Arabica::DOM::Node<std::string> > _transParents;
-
- static bool filterSameState(const Arabica::XPath::NodeSet<std::string>& transitions);
-
- uint64_t _perfTransProcessed;
- uint64_t _perfTransTotal;
- uint64_t _perfTransUsed;
- uint64_t _perfStatesProcessed;
- uint64_t _perfStatesSkippedProcessed;
- uint64_t _perfStatesSkippedTotal;
- uint64_t _perfStatesCachedProcessed;
- uint64_t _perfStatesCachedTotal;
- uint64_t _perfMicroStepProcessed;
- uint64_t _perfMicroStepTotal;
- uint64_t _lastTimeStamp;
-
- size_t _lastTransientStateId;
- size_t _lastStateIndex;
- size_t _lastActiveIndex;
- size_t _lastTransIndex;
-
- bool _alreadyFlat;
-
- bool _skipEventChainCalculations;
- size_t _maxEventSentChain;
- size_t _maxEventRaisedChain;
- size_t _doneEventRaiseTolerance;
-
- GlobalTransition* _currGlobalTransition;
-
- friend class GlobalTransition;
- friend class GlobalState;
-};
-
-}
-
-#endif /* end of include guard: CHARTTOFSM_H_IOKPYEBY */
diff --git a/src/uscxml/transform/ChartToFlatSCXML.cpp b/src/uscxml/transform/ChartToFlatSCXML.cpp
deleted file mode 100644
index ac91681..0000000
--- a/src/uscxml/transform/ChartToFlatSCXML.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "ChartToFlatSCXML.h"
-#include "uscxml/Convenience.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-
-#define CREATE_TRANSIENT_STATE_WITH_CHILDS(stateId) \
-if (childs.size() > 0) { \
- Element<std::string> transientState = _flatDoc.createElementNS(_nsInfo.nsURL, "state"); \
- _nsInfo.setPrefix(transientState);\
- transientState.setAttribute("transient", "true"); \
- for (std::list<Arabica::DOM::Comment<std::string> >::iterator commentIter = pendingComments.begin(); commentIter != pendingComments.end(); commentIter++) {\
- transientState.appendChild(*commentIter); \
- }\
- pendingComments.clear(); \
- if (stateId.length() > 0) \
- transientState.setAttribute("id", stateId); \
- for (size_t i = 0; i < childs.size(); i++) { \
- Node<std::string> imported = _flatDoc.importNode(childs[i], true); \
- transientState.appendChild(imported); \
- } \
- transientStateChain.push_back(transientState); \
-} \
-childs = NodeSet<std::string>();
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-ChartToFlatSCXML::operator Interpreter() {
- if (!HAS_ATTR(_scxml, "flat") || !stringIsTrue(ATTR(_scxml, "flat"))) {
- createDocument();
- }
-
- return Interpreter::fromClone(shared_from_this());
-}
-
-Transformer ChartToFlatSCXML::transform(const Interpreter& other) {
- return boost::shared_ptr<TransformerImpl>(new ChartToFlatSCXML(other));
-}
-
-void ChartToFlatSCXML::writeTo(std::ostream& stream) {
- if (!HAS_ATTR(_scxml, "flat") || !stringIsTrue(ATTR(_scxml, "flat"))) {
- createDocument();
- }
-
- // remove all debug attributes
- NodeSet<std::string> elementNodes = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, _scxml, true);
- for (size_t i = 0; i < elementNodes.size(); i++) {
- Element<std::string> element(elementNodes[i]);
- if (!envVarIsTrue("USCXML_ANNOTATE_GLOBAL_TRANS_SENDS") && HAS_ATTR(element, "send"))
- element.removeAttribute("send");
- if (!envVarIsTrue("USCXML_ANNOTATE_GLOBAL_TRANS_RAISES") && HAS_ATTR(element, "raise"))
- element.removeAttribute("raise");
- if (!envVarIsTrue("USCXML_ANNOTATE_GLOBAL_TRANS_MEMBERS") && HAS_ATTR(element, "members"))
- element.removeAttribute("members");
- if (!envVarIsTrue("USCXML_ANNOTATE_GLOBAL_TRANS_PRIO") && HAS_ATTR(element, "priority"))
- element.removeAttribute("priority");
- if (!envVarIsTrue("USCXML_ANNOTATE_GLOBAL_STATE_STEP") && HAS_ATTR(element, "step"))
- element.removeAttribute("step");
- if (HAS_ATTR(element, "final-target"))
- element.removeAttribute("final-target");
- }
-
- if (envVarIsTrue("USCXML_FLAT_FSM_METRICS_ONLY"))
- return;
-
- stream << _scxml;
-}
-
-void ChartToFlatSCXML::createDocument() {
-
- if (HAS_ATTR(_scxml, "flat") && stringIsTrue(ATTR(_scxml, "flat")))
- return;
-
- {
- NodeSet<std::string> allElements = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, _scxml, true);
- size_t nrElements = 0;
- for (size_t i = 0; i < allElements.size(); i++) {
- if (!isInEmbeddedDocument(allElements[i]))
- nrElements++;
- }
- std::cerr << "Number of elements before flattening: " << nrElements + 1 << std::endl;
- }
-
-
- if (_start == NULL)
- interpret(); // only if not already flat!
-
- if (envVarIsTrue("USCXML_FLAT_FSM_METRICS_ONLY"))
- return;
-
- Element<std::string> _origSCXML = _scxml;
-
- _scxml = _flatDoc.createElementNS(_nsInfo.nsURL, "scxml");
- _nsInfo.setPrefix(_scxml);
-
- _scxml.setAttribute("flat", "true");
- _flatDoc.appendChild(_scxml);
-
- if (HAS_ATTR(_origSCXML, "datamodel")) {
- _scxml.setAttribute("datamodel", ATTR(_origSCXML, "datamodel"));
- }
-
- if (HAS_ATTR(_origSCXML, "name")) {
- _scxml.setAttribute("name", ATTR(_origSCXML, "name"));
- }
-
- if (HAS_ATTR(_origSCXML, "binding")) {
- _scxml.setAttribute("binding", ATTR(_origSCXML, "binding"));
- }
-
- _scxml.setAttribute("initial", _start->stateId);
-
- NodeSet<std::string> datas;
- if (_binding == InterpreterImpl::LATE) {
- // with late binding, just copy direct datamodel childs
- datas = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", _origSCXML);
- } else {
- // with early binding, copy all datamodel elements into scxml element
- datas = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "datamodel", _origSCXML).asNodeSet();
- }
- for (size_t i = 0; i < datas.size(); i++) {
- if (isInEmbeddedDocument(datas[i]))
- continue; // nested document
- Node<std::string> imported = _flatDoc.importNode(datas[i], true);
- _scxml.appendChild(imported);
- }
-
-
- NodeSet<std::string> scripts = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", _origSCXML);
- for (size_t i = 0; i < scripts.size(); i++) {
- Node<std::string> imported = _flatDoc.importNode(scripts[i], true);
- _scxml.appendChild(imported);
- }
-
- NodeSet<std::string> comments = DOMUtils::filterChildType(Node_base::COMMENT_NODE, _origSCXML);
- for (size_t i = 0; i < comments.size(); i++) {
- Node<std::string> imported = _flatDoc.importNode(comments[i], true);
- _scxml.appendChild(imported);
- }
-
- std::vector<std::pair<std::string,GlobalState*> > sortedStates;
- sortedStates.insert(sortedStates.begin(), _globalConf.begin(), _globalConf.end());
- std::sort(sortedStates.begin(), sortedStates.end(), sortStatesByIndex);
-
- // int index = 0;
- // for (std::vector<Element<std::string> >::iterator transIter = indexedTransitions.begin(); transIter != indexedTransitions.end(); transIter++) {
- // const Element<std::string>& refTrans = *transIter;
- // std::cerr << index++ << ": " << refTrans << std::endl;
- // }
- // std::cerr << std::endl;
-
- for (std::vector<std::pair<std::string,GlobalState*> >::iterator confIter = sortedStates.begin();
- confIter != sortedStates.end();
- confIter++) {
- appendGlobalStateNode(confIter->second);
- }
-
- _document = _flatDoc;
-
- NodeSet<std::string> scxmls = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "scxml", _document);
- if (scxmls.size() > 0) {
- _scxml = Element<std::string>(scxmls[0]);
- }
-
- {
- NodeSet<std::string> allElements = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, _scxml, true);
- size_t nrElements = 0;
- for (size_t i = 0; i < allElements.size(); i++) {
- if (!isInEmbeddedDocument(allElements[i]))
- nrElements++;
- }
- std::cerr << "Number of elements after flattening: " << nrElements + 1 << std::endl;
- }
-
-
-}
-
-void ChartToFlatSCXML::appendGlobalStateNode(GlobalState* globalState) {
- Element<std::string> state = _flatDoc.createElementNS(_nsInfo.nsURL, "state");
- _nsInfo.setPrefix(state);
-
- state.setAttribute("step", toStr(globalState->index));
- state.setAttribute("id", globalState->stateId);
-
- if (globalState->isFinal)
- state.setAttribute("final", "true");
-
- std::list<GlobalTransition*>& transitionList = globalState->sortedOutgoing;
-
- // apend here, for transient state chains to trail the state
- _scxml.appendChild(state);
-
- size_t index = 0;
- for (std::list<GlobalTransition*>::iterator outIter = transitionList.begin();
- outIter != transitionList.end();
- outIter++) {
-// (*outIter)->index = globalState->index + ":" + toStr(index);
- state.appendChild(globalTransitionToNode(*outIter));
- index++;
- }
-}
-
-/**
- * Creates transient states for executable content as a side-effect
- */
-Node<std::string> ChartToFlatSCXML::globalTransitionToNode(GlobalTransition* globalTransition) {
- Element<std::string> transition = _flatDoc.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(transition);
-
- // transition.setAttribute("ref", globalTransition->index);
-
-#if 1
- transition.setAttribute("members", globalTransition->members);
-#endif
- // transition.setAttribute("priority", toStr(globalTransition->priority));
-
- if (!globalTransition->isEventless) {
- transition.setAttribute("event", globalTransition->eventDesc);
- }
-
- if (globalTransition->condition.size() > 0) {
- transition.setAttribute("cond", globalTransition->condition);
- }
-
- if (globalTransition->destination.size() > 0) {
- transition.setAttribute("final-target", globalTransition->destination);
- }
-
- NodeSet<std::string> transientStateChain;
-
- // current active state set
- FlatStateIdentifier flatId(globalTransition->source);
- std::list<std::string> currActiveStates = flatId.getActive();
-
- // std::cerr << "From " << globalTransition->source << " to " << globalTransition->destination << ":" << std::endl;
-
- // gather content for new transient state
- NodeSet<std::string> childs;
-
- // aggregated entering / exiting to avoid states without childs while still labeling
- std::list<Arabica::DOM::Comment<std::string> > pendingComments;
-
- // iterate all actions taken during the transition
- for (std::list<GlobalTransition::Action>::iterator actionIter = globalTransition->actions.begin();
- actionIter != globalTransition->actions.end();
- actionIter++) {
-
- if (actionIter->transition) {
- // DETAIL_EXEC_CONTENT(transition, actionIter);
-
- Element<std::string> onexit = _flatDoc.createElementNS(_nsInfo.nsURL, "onexit");
- _nsInfo.setPrefix(onexit);
- Node<std::string> child = actionIter->transition.getFirstChild();
- while(child) {
- Node<std::string> imported = _flatDoc.importNode(child, true);
- onexit.appendChild(imported);
- child = child.getNextSibling();
- }
- // only append if there is something done
- std::stringstream commentSS;
- commentSS << " Transition in '" << ATTR_CAST(getSourceState(actionIter->transition), "id") << "'";
- if (HAS_ATTR(actionIter->transition, "event"))
- commentSS << " for event '" << ATTR(actionIter->transition, "event") << "'";
- if (HAS_ATTR(actionIter->transition, "cond"))
- commentSS << " with condition '" << ATTR(actionIter->transition, "cond") << "'";
- if (HAS_ATTR(actionIter->transition, "target"))
- commentSS << " to target '" << ATTR(actionIter->transition, "target") << "'";
- commentSS << " ";
-
- if (onexit.hasChildNodes()) {
- if (envVarIsTrue("USCXML_ANNOTATE_VERBOSE_COMMENTS"))
- childs.push_back(_flatDoc.createComment(commentSS.str()));
- childs.push_back(onexit);
- } else {
- if (envVarIsTrue("USCXML_ANNOTATE_VERBOSE_COMMENTS"))
- pendingComments.push_back(_flatDoc.createComment(commentSS.str()));
- }
-
- continue;
- }
-
- if (actionIter->onExit) {
- // DETAIL_EXEC_CONTENT(onExit, actionIter);
- childs.push_back(actionIter->onExit);
- continue;
- }
-
- if (actionIter->onEntry) {
- // DETAIL_EXEC_CONTENT(onEntry, actionIter);
- childs.push_back(actionIter->onEntry);
- continue;
- }
-
- if (actionIter->raiseDone) {
- // DETAIL_EXEC_CONTENT(raiseDone, actionIter);
- childs.push_back(actionIter->raiseDone);
- continue;
- }
-
- if (actionIter->invoke) {
- // DETAIL_EXEC_CONTENT(invoke, actionIter);
- Element<std::string> invokeElem = Element<std::string>(actionIter->invoke);
- invokeElem.setAttribute("persist", "true");
- childs.push_back(invokeElem);
- continue;
- }
-
- if (actionIter->uninvoke) {
- // DETAIL_EXEC_CONTENT(uninvoke, actionIter);
- Element<std::string> uninvokeElem = _flatDoc.createElementNS(_nsInfo.nsURL, "uninvoke");
- _nsInfo.setPrefix(uninvokeElem);
-
- if (HAS_ATTR(actionIter->uninvoke, "type")) {
- uninvokeElem.setAttribute("type", ATTR(actionIter->uninvoke, "type"));
- }
- if (HAS_ATTR(actionIter->uninvoke, "typeexpr")) {
- uninvokeElem.setAttribute("typeexpr", ATTR(actionIter->uninvoke, "typeexpr"));
- }
- if (HAS_ATTR(actionIter->uninvoke, "id")) {
- uninvokeElem.setAttribute("id", ATTR(actionIter->uninvoke, "id"));
- }
- if (HAS_ATTR(actionIter->uninvoke, "idlocation")) {
- uninvokeElem.setAttribute("idlocation", ATTR(actionIter->uninvoke, "idlocation"));
- }
- childs.push_back(uninvokeElem);
- continue;
- }
-
- if (actionIter->exited) {
- currActiveStates.remove(ATTR_CAST(actionIter->exited, "id"));
- if (childs.size() > 0) {
- if (envVarIsTrue("USCXML_ANNOTATE_VERBOSE_COMMENTS"))
- childs.push_back(_flatDoc.createComment(" Exiting " + ATTR_CAST(actionIter->exited, "id") + " "));
- CREATE_TRANSIENT_STATE_WITH_CHILDS(FlatStateIdentifier::toStateId(currActiveStates)); // create a new transient state to update its id
- } else {
- // enqueue for next actual state
- if (envVarIsTrue("USCXML_ANNOTATE_VERBOSE_COMMENTS"))
- pendingComments.push_back(_flatDoc.createComment(" Exiting " + ATTR_CAST(actionIter->exited, "id") + " "));
- }
- }
-
- if (actionIter->entered) {
- if (childs.size() > 0) {
- if (envVarIsTrue("USCXML_ANNOTATE_VERBOSE_COMMENTS"))
- childs.push_back(_flatDoc.createComment(" Entering " + ATTR_CAST(actionIter->entered, "id") + " "));
- CREATE_TRANSIENT_STATE_WITH_CHILDS(FlatStateIdentifier::toStateId(currActiveStates)); // create a new transient state to update its id
- } else {
- if (envVarIsTrue("USCXML_ANNOTATE_VERBOSE_COMMENTS"))
- pendingComments.push_back(_flatDoc.createComment(" Entering " + ATTR_CAST(actionIter->entered, "id") + " "));
- }
- currActiveStates.push_back(ATTR_CAST(actionIter->entered, "id"));
-
- // we entered a new child - check if it has a datamodel and we entered for the first time
- if (_binding == InterpreterImpl::LATE) {
- NodeSet<std::string> datamodel = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", actionIter->entered);
- if (datamodel.size() > 0 && !isMember(actionIter->entered, _globalConf[globalTransition->source]->getAlreadyEnteredStates())) {
- childs.push_back(datamodel);
- }
- }
- }
- }
-
- CREATE_TRANSIENT_STATE_WITH_CHILDS(FlatStateIdentifier::toStateId(currActiveStates))
-
- if (transientStateChain.size() > 0) {
- Element<std::string> prevExitTransitionElem;
-
- for (size_t i = 0; i < transientStateChain.size(); i++) {
- Element<std::string> transientStateElem = Element<std::string>(transientStateChain[i]);
- transientStateElem.setAttribute("id", transientStateElem.getAttribute("id") + "-via-" + toStr(_lastTransientStateId++));
-
- Element<std::string> exitTransition = _flatDoc.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(exitTransition);
-
- if (prevExitTransitionElem) {
- // point previous to this one
- prevExitTransitionElem.setAttribute("target", transientStateElem.getAttribute("id"));
- } else {
- // update globalTransition->source target
- }
-
- transientStateElem.appendChild(exitTransition);
- prevExitTransitionElem = exitTransition;
-
- if (i == 0)
- transition.setAttribute("target", transientStateElem.getAttribute("id"));
-
- _scxml.appendChild(transientStateElem);
- }
-
- // last one points to actual target
- assert(prevExitTransitionElem);
- prevExitTransitionElem.setAttribute("target", globalTransition->destination);
-#if 0
- } else if (transientStateChain.size() == 1) {
- Element<std::string> transientStateElem = Element<std::string>(transientStateChain[0]);
- transientStateElem.setAttribute("onlyOne", "yes!");
-
- Element<std::string> exitTransition = _flatDoc.createElementNS(_nsInfo.nsURL, "transition");
- _nsInfo.setPrefix(exitTransition);
- exitTransition.setAttribute("target", globalTransition->destination);
-
- transientStateElem.appendChild(exitTransition);
-
- _scxml.appendChild(transientStateElem);
- transition.setAttribute("target", transientStateElem.getAttribute("id"));
-#endif
- } else {
- transition.setAttribute("target", globalTransition->destination);
- }
-
- assert(HAS_ATTR_CAST(transition, "target"));
- return transition;
-}
-
-bool ChartToFlatSCXML::sortStatesByIndex(const std::pair<std::string,GlobalState*>& s1, const std::pair<std::string,GlobalState*>& s2) {
- return s1.second->index < s2.second->index;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/transform/ChartToFlatSCXML.h b/src/uscxml/transform/ChartToFlatSCXML.h
deleted file mode 100644
index a278721..0000000
--- a/src/uscxml/transform/ChartToFlatSCXML.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef FSMTOSCXML_H_DC0B5E09
-#define FSMTOSCXML_H_DC0B5E09
-
-#include "ChartToFSM.h"
-#include "Transformer.h"
-
-namespace uscxml {
-
-class USCXML_API ChartToFlatSCXML : public TransformerImpl, public ChartToFSM {
-public:
- virtual ~ChartToFlatSCXML() {}
- static Transformer transform(const Interpreter& other);
-
- operator Interpreter();
-
- Arabica::DOM::Document<std::string> getDocument() const {
- if (_flatDoc)
- return _flatDoc;
- return _document;
- }
-
-protected:
- void writeTo(std::ostream& stream);
-
- ChartToFlatSCXML(const Interpreter& other) : TransformerImpl(), ChartToFSM(other), _lastTransientStateId(0) {}
- void createDocument();
-
- void appendGlobalStateNode(GlobalState* globalState);
- Arabica::DOM::Node<std::string> globalTransitionToNode(GlobalTransition* globalTransition);
- static bool sortStatesByIndex(const std::pair<std::string,GlobalState*>& s1, const std::pair<std::string,GlobalState*>& s2);
-
- size_t _lastTransientStateId;
-
-};
-
-}
-#endif /* end of include guard: FSMTOSCXML_H_DC0B5E09 */
diff --git a/src/uscxml/transform/ChartToMinimalSCXML.cpp b/src/uscxml/transform/ChartToMinimalSCXML.cpp
deleted file mode 100644
index 80db707..0000000
--- a/src/uscxml/transform/ChartToMinimalSCXML.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/transform/ChartToMinimalSCXML.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-#include "uscxml/Convenience.h"
-#include "uscxml/Factory.h"
-
-#include <DOM/io/Stream.hpp>
-#include <glog/logging.h>
-
-#include <iostream>
-
-namespace uscxml {
-
-using namespace Arabica::XPath;
-using namespace Arabica::DOM;
-
-Transformer ChartToMinimalSCXML::transform(const Interpreter& other) {
- return boost::shared_ptr<TransformerImpl>(new ChartToMinimalSCXML(other));
-}
-
-ChartToMinimalSCXML::ChartToMinimalSCXML(const Interpreter& other) : TransformerImpl(), _retainAsComments(false), _step(1) {
- cloneFrom(other.getImpl());
-
- // a bit messy but needed for SCXML IO Processor with session id target
- _selfPtr = boost::shared_ptr<InterpreterImpl>(this, Deleter());
- Interpreter::addInstance(_selfPtr);
-}
-
-void ChartToMinimalSCXML::writeTo(std::ostream& stream) {
-
- addMonitor(this);
-
- {
- NodeSet<std::string> allElements = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, _scxml, true);
- size_t nrElements = 0;
- for (size_t i = 0; i < allElements.size(); i++) {
- if (!isInEmbeddedDocument(allElements[i]))
- nrElements++;
- }
- std::cerr << "Number of elements before reduction: " << nrElements + 1 << std::endl;
- }
-
- // test 278 - move embedded datas to topmost datamodel
- if (_binding == EARLY) {
- // move all data elements into topmost datamodel element
- NodeSet<std::string> datas = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", _scxml, true);
-
- if (datas.size() > 0) {
- Node<std::string> topMostDatamodel;
- NodeSet<std::string> datamodels = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "datamodel", _scxml, false);
- if (datamodels.size() > 0) {
- topMostDatamodel = datamodels[0];
- } else {
- topMostDatamodel = _document.createElementNS(_nsInfo.nsURL, "datamodel");
- _scxml.insertBefore(topMostDatamodel, _scxml.getFirstChild());
- }
-
- while(topMostDatamodel.hasChildNodes())
- topMostDatamodel.removeChild(topMostDatamodel.getFirstChild());
-
- for (size_t i = 0; i < datas.size(); i++) {
- if (!isInEmbeddedDocument(datas[i])) {
- topMostDatamodel.appendChild(datas[i]);
- }
- }
- }
- }
-
- char* waitForEnv = getenv("USCXML_MINIMIZE_WAIT_MS");
- _retainAsComments = envVarIsTrue("USCXML_MINIMIZE_RETAIN_AS_COMMENTS");
-
- long waitFor = -1;
-
- if (waitForEnv != NULL) {
- try {
- waitFor = strTo<long>(waitForEnv);
- } catch (...) {
- waitFor = 0;
- }
- }
-
- if (envVarIsTrue("USCXML_MINIMIZE_WAIT_FOR_COMPLETION")) {
- interpret();
- } else {
- start();
- if (waitFor < 0) {
- // wait for EOF / CTRL+D
- char c;
- while(true) {
- std::cin >> c;
- if(std::cin.eof())
- break;
- }
- } else {
- tthread::this_thread::sleep_for(tthread::chrono::milliseconds(waitFor));
- }
- }
- stop();
-
- removeUnvisited(_scxml);
-
- {
- NodeSet<std::string> allElements = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, _scxml, true);
- size_t nrElements = 0;
- for (size_t i = 0; i < allElements.size(); i++) {
- if (!isInEmbeddedDocument(allElements[i]))
- nrElements++;
- }
- std::cerr << "Number of elements after reduction: " << nrElements + 1 << std::endl;
- }
-
- // unset data model
- _dmCopy = DataModel();
-
- stream << _scxml;
-}
-
-void ChartToMinimalSCXML::removeUnvisited(Arabica::DOM::Node<std::string>& node) {
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
- return;
-
- Element<std::string> elem(node);
-
- if (isInEmbeddedDocument(elem) ||
- (TAGNAME(elem) == _nsInfo.xmlNSPrefix + "param") ||
- (TAGNAME(elem) == _nsInfo.xmlNSPrefix + "donedata") ||
- (TAGNAME(elem) == _nsInfo.xmlNSPrefix + "datamodel") ||
- (TAGNAME(elem) == _nsInfo.xmlNSPrefix + "data") ||
- (TAGNAME(elem) == _nsInfo.xmlNSPrefix + "content")) {
- return;
- }
-
- // special handling for conditional blocks with if
- if (TAGNAME(elem) == _nsInfo.xmlNSPrefix + "if") {
- NodeSet<std::string> ifChilds = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, elem, false);
- Element<std::string> lastConditional = elem;
- bool hadVisitedChild = false;
- for (size_t j = 0; j < ifChilds.size(); j++) {
- Element<std::string> ifChildElem(ifChilds[j]);
- if (TAGNAME(ifChildElem) == _nsInfo.xmlNSPrefix + "else" || TAGNAME(ifChildElem) == _nsInfo.xmlNSPrefix + "elseif") {
- if (!hadVisitedChild && HAS_ATTR(lastConditional, "cond")) {
- lastConditional.setAttribute("cond", "false");
- }
- lastConditional = ifChildElem;
- hadVisitedChild = false;
- }
- if (_visited.find(ifChildElem) != _visited.end()) {
- _visited.insert(lastConditional);
- hadVisitedChild = true;
- }
- }
- }
-
- // test344
- if (_dmCopy &&
- TAGNAME(elem) == _nsInfo.xmlNSPrefix + "transition" &&
- HAS_ATTR(elem, "cond") &&
- !_dmCopy.isValidSyntax(ATTR(elem, "cond")))
- return;
-
- // detach unvisited nodes from DOM
- if (_visited.find(node) == _visited.end()) {
- std::cerr << DOMUtils::xPathForNode(node) << std::endl;
- if (_retainAsComments) {
- std::stringstream oldContent;
- oldContent << node;
- node.getParentNode().replaceChild(_document.createComment(boost::replace_all_copy(oldContent.str(),"--", "-")), node);
- } else {
- // removeChildren is not working as expected
-// node.getParentNode().replaceChild(_document.createTextNode(""), node);
- node.getParentNode().removeChild(node);
- }
- return;
- }
-
- // iterate and remove unvisited children
- NodeList<std::string> children = node.getChildNodes();
- for (size_t i = 0; i < children.getLength(); i++) {
- Node<std::string> child(children.item(i));
- removeUnvisited(child);
- }
-}
-
-void ChartToMinimalSCXML::markAsVisited(const Arabica::DOM::Element<std::string>& element) {
- if (_visited.find(element) != _visited.end())
- return;
-
- Arabica::DOM::Element<std::string> elem = const_cast<Arabica::DOM::Element<std::string>&>(element);
-
- _visited.insert(element);
- Node<std::string> parent = element.getParentNode();
- if (parent && parent.getNodeType() == Node_base::ELEMENT_NODE) {
- Arabica::DOM::Element<std::string> parentElem(parent);
- markAsVisited(parentElem);
- }
-}
-
-void ChartToMinimalSCXML::beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element) {
- markAsVisited(element);
- StateTransitionMonitor::beforeExecutingContent(interpreter, element);
-}
-
-void ChartToMinimalSCXML::beforeUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
- markAsVisited(invokeElem);
-}
-
-void ChartToMinimalSCXML::beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
- NodeSet<std::string> targets = getTargetStates(transition);
- // we need this for history pseudo states
- for (size_t i = 0; i < targets.size(); i++) {
- markAsVisited(Arabica::DOM::Element<std::string>(targets[i]));
- }
- markAsVisited(transition);
-
- std::stringstream commentSS;
- if (HAS_ATTR(transition, "event")) {
- commentSS << " Step #" << _step++ << " - transition taken for event '" << _currEvent.name << "' ";
- } else {
- commentSS << " Step #" << _step++ << " - spontaneous transition taken ";
- }
- if (envVarIsTrue("USCXML_ANNOTATE_PROGRESS"))
- transition.getParentNode().insertBefore(_document.createComment(commentSS.str()), transition);
-
- StateTransitionMonitor::beforeTakingTransition(interpreter, transition, moreComing);
-}
-
-void ChartToMinimalSCXML::beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
- markAsVisited(state);
-
- std::stringstream commentSS;
- commentSS << " Step #" << _step++ << " - state entered ";
-
- Arabica::DOM::Element<std::string> ncState = const_cast<Arabica::DOM::Element<std::string>&>(state);
- if (envVarIsTrue("USCXML_ANNOTATE_PROGRESS"))
- ncState.insertBefore(_document.createComment(commentSS.str()), ncState.getFirstChild());
-
- StateTransitionMonitor::beforeEnteringState(interpreter, state, moreComing);
-}
-
-void ChartToMinimalSCXML::beforeInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
- markAsVisited(invokeElem);
-}
-
-void ChartToMinimalSCXML::beforeCompletion(Interpreter interpreter) {
- _dmCopy = _dataModel; // retain a copy;
-}
-
-void ChartToMinimalSCXML::executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow) {
- markAsVisited(content);
- InterpreterRC::executeContent(content, rethrow);
-}
-
-void ChartToMinimalSCXML::invoke(const Arabica::DOM::Element<std::string>& element) {
- markAsVisited(element);
- InterpreterRC::invoke(element);
-}
-
-void ChartToMinimalSCXML::cancelInvoke(const Arabica::DOM::Element<std::string>& element) {
- markAsVisited(element);
- InterpreterRC::cancelInvoke(element);
-}
-
-void ChartToMinimalSCXML::onStableConfiguration(uscxml::Interpreter interpreter) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/transform/ChartToMinimalSCXML.h b/src/uscxml/transform/ChartToMinimalSCXML.h
deleted file mode 100644
index 4eb0b92..0000000
--- a/src/uscxml/transform/ChartToMinimalSCXML.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CHARTTOMINIMALSCXML_H_7B97677A
-#define CHARTTOMINIMALSCXML_H_7B97677A
-
-#include "uscxml/interpreter/InterpreterRC.h"
-#include "uscxml/dom/DOMUtils.h"
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
-#include <ostream>
-#include <list>
-#include <set>
-
-#include "Transformer.h"
-
-namespace uscxml {
-
-class USCXML_API ChartToMinimalSCXML : public InterpreterRC, public StateTransitionMonitor, public TransformerImpl {
-public:
- virtual ~ChartToMinimalSCXML() {}
- static Transformer transform(const Interpreter& other);
-
- // InterpreterMonitor
- virtual void beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element);
- virtual void beforeUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid);
- virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing);
- virtual void beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing);
- virtual void beforeInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid);
- virtual void beforeCompletion(Interpreter interpreter);
- virtual void onStableConfiguration(Interpreter interpreter);
-
- // gather executable content per microstep
- void executeContent(const Arabica::DOM::Element<std::string>& content, bool rethrow = false);
-
- // invoke and uninvoke
- virtual void invoke(const Arabica::DOM::Element<std::string>& element);
- virtual void cancelInvoke(const Arabica::DOM::Element<std::string>& element);
-
-protected:
- void writeTo(std::ostream& stream);
-
- ChartToMinimalSCXML(const Interpreter& other);
-
- void markAsVisited(const Arabica::DOM::Element<std::string>& element);
- void removeUnvisited(Arabica::DOM::Node<std::string>& node);
-
- std::set<Arabica::DOM::Node<std::string> > _visited;
- DataModel _dmCopy;
- bool _retainAsComments;
-
-private:
- size_t _step;
-
- // we need this to register as an instance at Interpreter::_instances
- boost::shared_ptr<InterpreterImpl> _selfPtr;
-
- // prevent deletion from shared_ptr
- class Deleter {
- public:
- void operator()(ChartToMinimalSCXML* p) {
- /* do nothing */
- }
- };
-
-};
-
-}
-
-
-#endif /* end of include guard: CHARTTOMINIMALSCXML_H_7B97677A */
diff --git a/src/uscxml/transform/ChartToPromela.cpp b/src/uscxml/transform/ChartToPromela.cpp
deleted file mode 100644
index a9afea6..0000000
--- a/src/uscxml/transform/ChartToPromela.cpp
+++ /dev/null
@@ -1,3578 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#define NEW_DELAY_RESHUFFLE 1
-
-#include "uscxml/transform/ChartToFSM.h"
-#include "uscxml/transform/ChartToPromela.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-#include "uscxml/plugins/datamodel/promela/PromelaParser.h"
-#include "uscxml/plugins/datamodel/promela/parser/promela.tab.hpp"
-
-#include <DOM/io/Stream.hpp>
-#include <DOM/SAX2DOM/SAX2DOM.hpp>
-#include <iostream>
-#include "uscxml/UUID.h"
-#include <math.h>
-#include <boost/algorithm/string.hpp>
-#include <glog/logging.h>
-
-#define MSG_QUEUE_LENGTH 5
-#define MAX_MACRO_CHARS 64
-#define MIN_COMMENT_PADDING 60
-#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
-
-#define ADAPT_SRC(code) _analyzer->adaptCode(code, _prefix)
-
-#define BIT_WIDTH(number) (number > 1 ? (int)ceil(log((double)number) / log((double)2.0)) : 1)
-#define LENGTH_FOR_NUMBER(input, output) \
-{ \
- int number = input; \
- int output = 0; \
- do { \
- number /= 10; \
- output++; \
- } while (number != 0); \
-}
-
-#define INDENT_MIN(stream, start, cols) \
-for (size_t indentIndex = start; indentIndex < cols; indentIndex++) \
- stream << " ";
-
-#define DIFF_MAPS(base, compare, result) \
-{ \
- histIter_t baseIter = base.begin(); \
- while(baseIter != base.end()) { \
- if (compare.find(baseIter->first) == compare.end()) { \
- result[baseIter->first] = baseIter->second; \
- } else { \
- histMemberIter_t baseMemberIter = baseIter->second.begin(); \
- while(baseMemberIter != baseIter->second.end()) { \
- if (compare.at(baseIter->first).find(*baseMemberIter) == compare.at(baseIter->first).end()) { \
- result[baseIter->first].insert(*baseMemberIter); \
- } \
- baseMemberIter++; \
- } \
- } \
- baseIter++; \
- } \
-}
-
-#define INTERSECT_MAPS(base, compare, result) \
-{ \
- histIter_t baseIter = base.begin(); \
- while(baseIter != base.end()) { \
- if (compare.find(baseIter->first) != compare.end()) { \
- histMemberIter_t baseMemberIter = baseIter->second.begin(); \
- while(baseMemberIter != baseIter->second.end()) { \
- if (compare.at(baseIter->first).find(*baseMemberIter) != compare.at(baseIter->first).end()) { \
- result[baseIter->first].insert(*baseMemberIter); \
- } \
- baseMemberIter++; \
- } \
- } \
- baseIter++; \
- } \
-}
-
-#define PRETTY_PRINT_LIST(stream, var) \
-{ \
- std::list<std::string>::const_iterator listIter = var.begin(); \
- std::string sep;\
- while(listIter != var.end()) { \
- stream << sep << *listIter; \
- sep = ", "; \
- listIter++; \
- } \
-}
-
-#define TRANSITION_TRACE(transList, value) \
-if (_traceTransitions) { \
-for (std::set<int>::iterator transRefIter = transList->transitionRefs.begin(); \
- transRefIter != transList->transitionRefs.end(); \
- transRefIter++) { \
- stream << padding << _prefix << "transitions[" << *transRefIter << "] = "#value"; " << std::endl; \
- } \
-} \
-
-
-#define DUMP_STATS(disregardTime) \
-uint64_t now = tthread::chrono::system_clock::now(); \
-if (now - _lastTimeStamp > 1000 || disregardTime) { \
- std::cerr << "## State : " << _perfStatesTotal << " [" << _perfStatesProcessed << "/sec]" << std::endl; \
- std::cerr << "## Transition: " << _perfTransTotal << " [" << _perfHistoryProcessed << "/sec]" << std::endl; \
- std::cerr << "## History : " << _perfHistoryTotal << " [" << _perfHistoryProcessed << "/sec]" << std::endl; \
- std::cerr << "toPML: "; \
- std::cerr << _perfStatesTotal << ", " << _perfStatesProcessed << ", "; \
- std::cerr << _perfTransTotal << ", " << _perfTransProcessed << ", "; \
- std::cerr << _perfHistoryTotal << ", " << _perfHistoryProcessed; \
- std::cerr << std::endl << std::endl; \
- _perfTransProcessed = 0; \
- _perfHistoryProcessed = 0; \
- _perfStatesProcessed = 0; \
- if (!disregardTime)\
- _lastTimeStamp = now; \
-}
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-Transformer ChartToPromela::transform(const Interpreter& other) {
- return boost::shared_ptr<TransformerImpl>(new ChartToPromela(other));
-}
-
-void ChartToPromela::writeTo(std::ostream& stream) {
- writeProgram(stream);
-}
-
-
-void PromelaCodeAnalyzer::addCode(const std::string& code, ChartToPromela* interpreter) {
- PromelaParser parser(code);
-// parser.dump();
-
- // find all strings
- std::list<PromelaParserNode*> astNodes;
- astNodes.push_back(parser.ast);
-
- while(astNodes.size() > 0) {
- PromelaParserNode* node = astNodes.front();
- astNodes.pop_front();
-
-// node->dump();
-
- bool hasValue = false;
- int assignedValue = 0;
-
-
- switch (node->type) {
- case PML_STRING: {
- std::string unquoted = node->value;
- if (boost::starts_with(unquoted, "'")) {
- unquoted = unquoted.substr(1, unquoted.size() - 2);
- }
- addLiteral(unquoted);
- break;
- }
- case PML_ASGN:
- if (node->operands.back()->type == PML_CONST) {
- hasValue = true;
- if (isInteger(node->operands.back()->value.c_str(), 10)) {
- assignedValue = strTo<int>(node->operands.back()->value);
- }
- }
- if (node->operands.back()->type == PML_STRING) {
- // remember strings for later
- astNodes.push_back(node->operands.back());
- }
- if (node->operands.front()->type == PML_CMPND) {
- node = node->operands.front();
- } else {
- break;
- }
-// if (node->operands.front()->type != PML_NAME)
-// break; // this will skip array assignments
- case PML_CMPND: {
- std::string nameOfType;
- std::list<PromelaParserNode*>::iterator opIter = node->operands.begin();
- if ((*opIter)->type != PML_NAME) {
- node->dump();
- return;
- assert(false);
- }
-
- PromelaTypedef* td = &_typeDefs;
- std::string seperator;
-
- while(opIter != node->operands.end()) {
- switch ((*opIter)->type) {
- case PML_NAME:
- td = &td->types[(*opIter)->value];
- td->occurrences.insert(interpreter);
-
- nameOfType += seperator + (*opIter)->value;
- if (nameOfType.compare("_x") == 0)
- _usesPlatformVars = true;
- seperator = "_";
- td->name = nameOfType + "_t";
- break;
- case PML_VAR_ARRAY: {
- PromelaParserNode* name = (*opIter)->operands.front();
- PromelaParserNode* subscript = *(++(*opIter)->operands.begin());
- td = &td->types[name->value];
- td->occurrences.insert(interpreter);
-
- nameOfType += seperator + name->value;
- td->name = nameOfType + "_t";
-
- if (isInteger(subscript->value.c_str(), 10)) {
- td->arraySize = strTo<int>(subscript->value);
- }
- break;
- }
- default:
- if ((*opIter)->type == PML_CONST) {
- // break fall through from ASGN
- break;
- }
-// node->dump();
-// assert(false);
- break;
- }
-
- if (nameOfType.compare("_x_states") == 0) {
- _usesInPredicate = true;
- }
- if (nameOfType.compare("_event_type") == 0) {
- addLiteral("internal");
- addLiteral("external");
- addLiteral("platform");
- }
- if (nameOfType.compare("_event_origintype") == 0) {
- addLiteral("http://www.w3.org/TR/scxml/#SCXMLEventProcessor");
- }
- opIter++;
- }
-
- if (hasValue) {
- if (td->maxValue < assignedValue)
- td->maxValue = assignedValue;
- if (td->minValue > assignedValue)
- td->minValue = assignedValue;
- }
-
- continue; // skip processing nested AST nodes
- }
- case PML_NAME: {
- _typeDefs.types[node->value].occurrences.insert(interpreter);
- _typeDefs.types[node->value].minValue = 0;
- _typeDefs.types[node->value].maxValue = 0;
- // test325
- if (node->value.compare("_ioprocessors") == 0) {
- addCode("_ioprocessors.scxml.location", interpreter);
- }
-
- break;
- }
-
- default:
-// node->dump();
- break;
-// assert(false);
- }
-
- astNodes.insert(astNodes.end(), node->operands.begin(), node->operands.end());
-
- }
-}
-
-void PromelaCodeAnalyzer::addEvent(const std::string& eventName) {
- if (_events.find(eventName) != _events.end())
- return;
-
- addLiteral(eventName, _lastEventIndex);
- assert(_strIndex.find(eventName) != _strIndex.end());
-
- _eventTrie.addWord(eventName);
- _events[eventName] = _strIndex[eventName];
- _lastEventIndex++;
-}
-
-void PromelaCodeAnalyzer::addOrigState(const std::string& stateName) {
- if (_origStateIndex.find(stateName) == _origStateIndex.end()) {
- _origStateIndex[stateName] = _lastStateIndex++;
- createMacroName(stateName);
- }
-}
-
-void PromelaCodeAnalyzer::addState(const std::string& stateName) {
- if (_states.find(stateName) != _states.end())
- return;
-
- createMacroName(stateName);
-}
-
-void PromelaCodeAnalyzer::addLiteral(const std::string& literal, int forceIndex) {
- if (boost::starts_with(literal, "'"))
- throw std::runtime_error("Literal " + literal + " passed with quotes");
-
- if (_strLiterals.find(literal) != _strLiterals.end())
- return;
-
- _strLiterals.insert(literal);
- createMacroName(literal);
- enumerateLiteral(literal, forceIndex);
-}
-
-int PromelaCodeAnalyzer::enumerateLiteral(const std::string& literal, int forceIndex) {
- if (forceIndex >= 0) {
- _strIndex[literal] = forceIndex;
- return forceIndex;
- }
-
- if (_strIndex.find(literal) != _strIndex.end())
- return _strIndex[literal];
-
- _strIndex[literal] = _lastStrIndex++;
- return _lastStrIndex + 1;
-}
-
-std::string PromelaCodeAnalyzer::createMacroName(const std::string& literal) {
- if (_strMacroNames.find(literal) != _strMacroNames.end())
- return _strMacroNames[literal];
-
- // find a suitable macro name for the strings
- std::string macroName = literal; //literal.substr(1, literal.size() - 2);
-
- // cannot start with digit
- if (isInteger(macroName.substr(0,1).c_str(), 10))
- macroName = "_" + macroName;
-
- macroName = macroName.substr(0, MAX_MACRO_CHARS);
- boost::to_upper(macroName);
-
- std::string illegalChars = "#\\/:?\"<>| \n\t()[]{}',.-";
- std::string tmp;
- std::string::iterator it = macroName.begin();
- while (it < macroName.end()) {
- bool found = illegalChars.find(*it) != std::string::npos;
- if(found) {
- tmp += '_';
- it++;
- while(it < macroName.end() && illegalChars.find(*it) != std::string::npos) {
- it++;
- }
- } else {
- tmp += *it++;
- }
- }
- macroName = tmp;
- if(macroName.length() < 1)
- macroName = "_EMPTY_STRING";
- if(macroName.length() < 2 && macroName[0] == '_')
- macroName = "_WEIRD_CHARS";
-
- unsigned int index = 2;
- while (_macroNameSet.find(macroName) != _macroNameSet.end()) {
- std::string suffix = toStr(index);
- if (macroName.size() > suffix.size()) {
- macroName = macroName.substr(0, macroName.size() - suffix.size()) + suffix;
- } else {
- macroName = suffix;
- }
- index++;
- }
-
- _macroNameSet.insert(macroName);
- _strMacroNames[literal] = macroName;
- return macroName;
-}
-
-std::string PromelaCodeAnalyzer::getTypeReset(const std::string& var, const PromelaTypedef& type, const std::string padding) {
- std::stringstream assignment;
-
- std::map<std::string, PromelaTypedef>::const_iterator typeIter = type.types.begin();
- while(typeIter != type.types.end()) {
- const PromelaTypedef& innerType = typeIter->second;
- if (innerType.arraySize > 0) {
- for (size_t i = 0; i < innerType.arraySize; i++) {
- assignment << padding << var << "." << typeIter->first << "[" << i << "] = 0;" << std::endl;
- }
- } else if (innerType.types.size() > 0) {
- assignment << getTypeReset(var + "." + typeIter->first, typeIter->second, padding);
- } else {
- assignment << padding << var << "." << typeIter->first << " = 0;" << std::endl;
- }
- typeIter++;
- }
- return assignment.str();
-
-}
-
-std::string PromelaCodeAnalyzer::getTypeAssignment(const std::string& varTo, const std::string& varFrom, const PromelaTypedef& type, const std::string padding) {
- std::stringstream assignment;
-
- std::map<std::string, PromelaTypedef>::const_iterator typeIter = type.types.begin();
- while(typeIter != type.types.end()) {
- const PromelaTypedef& innerType = typeIter->second;
- if (innerType.arraySize > 0) {
- for (size_t i = 0; i < innerType.arraySize; i++) {
- assignment << padding << varTo << "." << typeIter->first << "[" << i << "] = " << varFrom << "." << typeIter->first << "[" << i << "];" << std::endl;
- }
- } else if (innerType.types.size() > 0) {
- assignment << getTypeAssignment(varTo + "." + typeIter->first, varFrom + "." + typeIter->first, typeIter->second, padding);
- } else {
- assignment << padding << varTo << "." << typeIter->first << " = " << varFrom << "." << typeIter->first << ";" << std::endl;
- }
- typeIter++;
- }
- return assignment.str();
-}
-
-std::string PromelaCodeAnalyzer::macroForLiteral(const std::string& literal) {
- if (boost::starts_with(literal, "'"))
- throw std::runtime_error("Literal " + literal + " passed with quotes");
-
- if (_strMacroNames.find(literal) == _strMacroNames.end())
- throw std::runtime_error("No macro for literal '" + literal + "' known");
- return _strMacroNames[literal];
-}
-
-int PromelaCodeAnalyzer::indexForLiteral(const std::string& literal) {
- if (boost::starts_with(literal, "'"))
- throw std::runtime_error("Literal " + literal + " passed with quotes");
-
- if (_strIndex.find(literal) == _strIndex.end())
- throw std::runtime_error("No index for literal " + literal + " known");
- return _strIndex[literal];
-}
-
-std::string PromelaCodeAnalyzer::adaptCode(const std::string& code, const std::string& prefix) {
-// for (std::map<std::string, std::string>::const_iterator litIter = _strMacroNames.begin(); litIter != _strMacroNames.end(); litIter++) {
-// boost::replace_all(replaced, "'" + litIter->first + "'", litIter->second);
-// }
-// boost::replace_all(replaced, "_event", prefix + "_event");
- // replace all variables from analyzer
-
- std::string processed = code;
- std::stringstream processedStr;
- std::list<std::pair<size_t, size_t> > posList;
- std::list<std::pair<size_t, size_t> >::iterator posIter;
- size_t lastPos;
-
- // prepend all identifiers with our prefix
- {
- PromelaParser parsed(processed);
-// parsed.dump();
- posList = getTokenPositions(code, PML_NAME, parsed.ast);
- posList.sort();
- posIter = posList.begin();
- lastPos = 0;
-
- while (posIter != posList.end()) {
- processedStr << code.substr(lastPos, posIter->first - lastPos) << prefix;
- lastPos = posIter->first;
- posIter++;
- }
- processedStr << processed.substr(lastPos, processed.size() - lastPos);
-
- processed = processedStr.str();
- processedStr.clear();
- processedStr.str("");
- }
-
- // replace string literals
- {
- PromelaParser parsed(processed);
- posList = getTokenPositions(code, PML_STRING, parsed.ast);
- posList.sort();
- posIter = posList.begin();
- lastPos = 0;
-
- while (posIter != posList.end()) {
- processedStr << processed.substr(lastPos, posIter->first - lastPos);
-// std::cout << processed.substr(posIter->first + 1, posIter->second - posIter->first - 2) << std::endl;
- assert(_strMacroNames.find(processed.substr(posIter->first + 1, posIter->second - posIter->first - 2)) != _strMacroNames.end());
- processedStr << _strMacroNames[processed.substr(posIter->first + 1, posIter->second - posIter->first - 2)];
- lastPos = posIter->second;
- posIter++;
- }
- processedStr << processed.substr(lastPos, processed.size() - lastPos);
-
- processed = processedStr.str();
- processedStr.clear();
- processedStr.str("");
- }
-
- return processed;
-}
-
-//std::string PromelaCodeAnalyzer::prefixIdentifiers(const std::string& expr, const std::string& prefix) {
-// PromelaParser parsed(expr);
-// std::list<size_t> posList = getTokenPositions(expr, PML_NAME, parsed.ast);
-// posList.sort();
-//
-// std::stringstream prefixed;
-// std::list<size_t>::iterator posIter = posList.begin();
-// size_t lastPos = 0;
-// while (posIter != posList.end()) {
-// prefixed << expr.substr(lastPos, *posIter - lastPos) << prefix;
-// lastPos = *posIter;
-// posIter++;
-// }
-//
-// prefixed << expr.substr(lastPos, expr.size() - lastPos);
-// return prefixed.str();
-//}
-
-std::list<std::pair<size_t, size_t> > PromelaCodeAnalyzer::getTokenPositions(const std::string& expr, int type, PromelaParserNode* ast) {
- std::list<std::pair<size_t, size_t> > posList;
- if (ast->type == type && ast->loc != NULL) {
-// ast->dump();
- if (type == PML_NAME && ast->parent &&
- ((ast->parent->type == PML_CMPND && ast->parent->operands.front() != ast) ||
- (ast->parent->parent && ast->parent->type == PML_VAR_ARRAY && ast->parent->parent->type == PML_CMPND))) {
- // field in a compound
- } else {
- if (ast->loc->firstLine == 0) {
- posList.push_back(std::make_pair(ast->loc->firstCol, ast->loc->lastCol));
- } else {
- int line = ast->loc->firstLine;
- size_t lastPos = 0;
- while(line > 0) {
- lastPos = expr.find_first_of('\n', lastPos + 1);
- line--;
- }
- posList.push_back(std::make_pair(lastPos + ast->loc->firstCol, lastPos + ast->loc->lastCol));
- }
- }
- }
- for (std::list<PromelaParserNode*>::iterator opIter = ast->operands.begin(); opIter != ast->operands.end(); opIter++) {
- std::list<std::pair<size_t, size_t> > tmp = getTokenPositions(expr, type, *opIter);
- posList.insert(posList.end(), tmp.begin(), tmp.end());
- }
- return posList;
-}
-
-std::set<std::string> PromelaCodeAnalyzer::getEventsWithPrefix(const std::string& prefix) {
- std::set<std::string> eventNames;
- std::list<TrieNode*> trieNodes = _eventTrie.getWordsWithPrefix(prefix);
-
- std::list<TrieNode*>::iterator trieIter = trieNodes.begin();
- while(trieIter != trieNodes.end()) {
- eventNames.insert((*trieIter)->value);
- trieIter++;
- }
-
- return eventNames;
-}
-
-ChartToPromela::~ChartToPromela() {
- if (_analyzer != NULL)
- delete(_analyzer);
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator nestedIter = _machines.begin(); nestedIter != _machines.end(); nestedIter++) {
- nestedIter->second->_analyzer = NULL;
- delete (nestedIter->second);
- }
-}
-
-
-void ChartToPromela::writeEvents(std::ostream& stream) {
- std::map<std::string, int> events = _analyzer->getEvents();
- std::map<std::string, int>::iterator eventIter = events.begin();
- stream << "/* event name identifiers */" << std::endl;
- while(eventIter != events.end()) {
- if (eventIter->first.length() > 0) {
- stream << "#define " << _analyzer->macroForLiteral(eventIter->first) << " " << _analyzer->indexForLiteral(eventIter->first);
- stream << " /* from \"" << eventIter->first << "\" */" << std::endl;
- }
- eventIter++;
- }
-}
-
-void ChartToPromela::writeStates(std::ostream& stream) {
- stream << "/* state name identifiers */" << std::endl;
-
- std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin();
- while(stateIter != _activeConf.end()) {
- stream << "#define " << "s" << stateIter->second->activeIndex << " " << stateIter->second->activeIndex;
- stream << " /* from \"" << stateIter->first << "\" */" << std::endl;
- stateIter++;
- }
-
-// for (size_t i = 0; i < _globalConf.size(); i++) {
-// stream << "#define " << "s" << i << " " << i;
-// stream << " /* from \"" << ATTR_CAST(_globalStates[i], "id") << "\" */" << std::endl;
-// }
-}
-
-void ChartToPromela::writeStateMap(std::ostream& stream) {
- stream << "/* original state names */" << std::endl;
- std::map<std::string, int> origStates = _analyzer->getOrigStates();
- for (std::map<std::string, int>::iterator origIter = origStates.begin(); origIter != origStates.end(); origIter++) {
- stream << "#define " << _analyzer->macroForLiteral(origIter->first) << " " << origIter->second;
- stream << " /* from \"" << origIter->first << "\" */" << std::endl;
- }
-
-// std::map<std::string, int> states = _analyzer->getStates();
-// size_t stateIndex = 0;
-// for (std::map<std::string, int>::iterator stateIter = states.begin(); stateIter != states.end(); stateIter++) {
-// stream << "_x"
-// std::list<std::string> origStates = _analyzer->getOrigState(stateIter->first);
-// size_t origIndex = 0;
-// for (std::list<std::string>::iterator origIter = origStates.begin(); origIter != origStates.end(); origIter++) {
-//
-// }
-// }
-}
-
-void ChartToPromela::writeHistoryArrays(std::ostream& stream) {
- std::map<std::string, std::map<std::string, size_t> >::iterator histNameIter = _historyMembers.begin();
- while(histNameIter != _historyMembers.end()) {
- stream << "/* history assignments for " << histNameIter->first << std::endl;
- std::map<std::string, size_t>::iterator histMemberIter = histNameIter->second.begin();
- while(histMemberIter != histNameIter->second.end()) {
- stream << " " << histMemberIter->second << ": " << histMemberIter->first << std::endl;;
- histMemberIter++;
- }
- stream << "*/" << std::endl;
- stream << "bool " << _prefix << "_hist_" << boost::replace_all_copy(boost::to_lower_copy(histNameIter->first), ".", "_") << "[" << histNameIter->second.size() << "];" << std::endl;
-
- histNameIter++;
- }
-}
-
-void ChartToPromela::writeTypeDefs(std::ostream& stream) {
- stream << "/* type definitions */" << std::endl;
- PromelaCodeAnalyzer::PromelaTypedef typeDefs = _analyzer->getTypes();
- if (typeDefs.types.size() == 0)
- return;
-
- std::list<PromelaCodeAnalyzer::PromelaTypedef> individualDefs;
- std::list<PromelaCodeAnalyzer::PromelaTypedef> currDefs;
- currDefs.push_back(typeDefs);
-
- while(currDefs.size() > 0) {
- if (std::find(individualDefs.begin(), individualDefs.end(), currDefs.front()) == individualDefs.end()) {
- individualDefs.push_back(currDefs.front());
- for (std::map<std::string, PromelaCodeAnalyzer::PromelaTypedef>::iterator typeIter = currDefs.front().types.begin(); typeIter != currDefs.front().types.end(); typeIter++) {
- currDefs.push_back(typeIter->second);
- }
- }
- currDefs.pop_front();
- }
- individualDefs.pop_front();
-
- for (std::list<PromelaCodeAnalyzer::PromelaTypedef>::reverse_iterator rIter = individualDefs.rbegin(); rIter != individualDefs.rend(); rIter++) {
- PromelaCodeAnalyzer::PromelaTypedef currDef = *rIter;
-
- if (currDef.types.size() == 0 || currDef.name.size() == 0)
- continue;
-
- stream << "typedef " << currDef.name << " {" << std::endl;
- if (currDef.name.compare("_event_t") ==0) {
- if (_analyzer->usesEventField("delay")) {
- // make sure delay is the first member for sorted enqueuing to work
- stream << " int delay;" << std::endl;
-#if NEW_DELAY_RESHUFFLE
-#else
- stream << " int seqNr;" << std::endl;
-#endif
- }
- stream << " int name;" << std::endl;
- if (_analyzer->usesEventField("invokeid")) {
- stream << " int invokeid;" << std::endl;
- }
- }
- for (std::map<std::string, PromelaCodeAnalyzer::PromelaTypedef>::iterator tIter = currDef.types.begin(); tIter != currDef.types.end(); tIter++) {
- if (currDef.name.compare("_event_t") == 0 && (tIter->first.compare("name") == 0 ||
- tIter->first.compare("seqNr") == 0 ||
- tIter->first.compare("invokeid") == 0 ||
- tIter->first.compare("delay") == 0)) { // special treatment for _event
- continue;
- }
- if (currDef.name.compare("_x_t") == 0 && tIter->first.compare("states") == 0) {
- stream << " bool states[" << _analyzer->getOrigStates().size() << "];" << std::endl;
- continue;
- }
- if (tIter->second.types.size() == 0) {
- stream << " " << declForRange(tIter->first, tIter->second.minValue, tIter->second.maxValue, true) << ";" << std::endl; // not further nested
-// stream << " int " << tIter->first << ";" << std::endl; // not further nested
- } else {
- stream << " " << tIter->second.name << " " << tIter->first << ";" << std::endl;
- }
- }
- stream << "};" << std::endl << std::endl;
- }
-
-// stream << "/* typedef instances */" << std::endl;
-// PromelaCodeAnalyzer::PromelaTypedef allTypes = _analyzer->getTypes();
-// std::map<std::string, PromelaCodeAnalyzer::PromelaTypedef>::iterator typeIter = allTypes.types.begin();
-// while(typeIter != allTypes.types.end()) {
-// if (typeIter->second.types.size() > 0) {
-// // an actual typedef
-// stream << "hidden " << typeIter->second.name << " " << typeIter->first << ";" << std::endl;
-// } else {
-// stream << "hidden " << declForRange(typeIter->first, typeIter->second.minValue, typeIter->second.maxValue) << ";" << std::endl;
-// }
-// typeIter++;
-// }
-
-}
-
-std::string ChartToPromela::declForRange(const std::string& identifier, long minValue, long maxValue, bool nativeOnly) {
-// return "int " + identifier; // just for testing
-
- // we know nothing about this type
- if (minValue == 0 && maxValue == 0)
- return "int " + identifier;
-
- if (minValue < 0) {
- // only short or int for negatives
- if (minValue < -32769 || maxValue > 32767)
- return "int " + identifier;
- return "short " + identifier;
- }
-
- // type is definitely positive
- if (nativeOnly) {
- if (maxValue > 32767)
- return "int " + identifier;
- if (maxValue > 255)
- return "short " + identifier;
- if (maxValue > 1)
- return "byte " + identifier;
- return "bool " + identifier;
- } else {
- return "unsigned " + identifier + " : " + toStr(BIT_WIDTH(maxValue));
- }
-}
-
-
-void ChartToPromela::writeInlineComment(std::ostream& stream, const Arabica::DOM::Node<std::string>& node) {
- if (node.getNodeType() != Node_base::COMMENT_NODE)
- return;
-
- std::string comment = node.getNodeValue();
- boost::trim(comment);
- if (!boost::starts_with(comment, "#promela-inline"))
- return;
-
- std::stringstream ssLine(comment);
- std::string line;
- std::getline(ssLine, line); // consume first line
- while(std::getline(ssLine, line)) {
- if (line.length() == 0)
- continue;
- stream << line;
- }
-}
-
-std::string ChartToPromela::conditionForHistoryTransition(const GlobalTransition* transition) {
- FlatStateIdentifier flatSource(transition->source);
- FlatStateIdentifier flatTarget(transition->destination);
- std::string condition;
-
- return condition;
-}
-
-std::string ChartToPromela::conditionalizeForHist(GlobalTransition* transition, int indent) {
- std::set<GlobalTransition*> transitions;
- transitions.insert(transition);
- return conditionalizeForHist(transitions);
-}
-
-std::string ChartToPromela::conditionalizeForHist(const std::set<GlobalTransition*>& transitions, int indent) {
- std::stringstream condition;
- std::string memberSep;
-
- std::set<std::map<std::string, std::list<std::string> > > histSeen;
-
- for (std::set<GlobalTransition*>::const_iterator transIter = transitions.begin(); transIter != transitions.end(); transIter++) {
- if ((*transIter)->histTargets.size() == 0) // there are no history transitions in here!
- continue;
-
- std::map<std::string, std::list<std::string> > relevantHist;
- std::map<std::string, std::list<std::string> > currentHist;
- FlatStateIdentifier flatSource((*transIter)->source);
- currentHist = flatSource.getHistory();
-
- std::set<std::string>::iterator histTargetIter = (*transIter)->histTargets.begin();
- while(histTargetIter != (*transIter)->histTargets.end()) {
- if (currentHist.find(*histTargetIter) != currentHist.end()) {
- relevantHist[*histTargetIter] = currentHist[*histTargetIter];
- }
- histTargetIter++;
- }
- if (relevantHist.size() == 0)
- continue;
-
- if (histSeen.find(relevantHist) != histSeen.end())
- continue;
- histSeen.insert(relevantHist);
-
- std::string itemSep;
- std::map<std::string, std::list<std::string> >::iterator relevanthistIter = relevantHist.begin();
-
- if (relevantHist.size() > 0)
- condition << memberSep;
-
- while(relevanthistIter != relevantHist.end()) {
- std::list<std::string>::iterator histItemIter = relevanthistIter->second.begin();
- while(histItemIter != relevanthistIter->second.end()) {
- assert(_historyMembers.find(relevanthistIter->first) != _historyMembers.end());
- assert(_historyMembers[relevanthistIter->first].find(*histItemIter) != _historyMembers[relevanthistIter->first].end());
- condition << itemSep << _prefix << "_hist_" << boost::to_lower_copy(_analyzer->macroForLiteral(relevanthistIter->first)) << "[" << _historyMembers[relevanthistIter->first][*histItemIter] << "]";
- itemSep = " && ";
- histItemIter++;
- }
- relevanthistIter++;
- }
-
- if (relevantHist.size() > 0)
- memberSep = " || ";
-
- }
- if (condition.str().size() > 0) {
- return "(" + condition.str() + ")";
- } else {
- assert(false);
- }
- return "true";
-}
-
-//std::list<GlobalTransition::Action> ChartToPromela::getTransientContent(GlobalTransition* transition) {
-// std::list<GlobalTransition::Action> content;
-// GlobalTransition* currTrans = transition;
-// for (;;) {
-// if (!HAS_ATTR(currState, "transient") || !DOMUtils::attributeIsTrue(ATTR(currState, "transient")))
-// break;
-// content.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", currState));
-// content.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onentry", currState));
-// content.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "onexit", currState));
-// NodeSet<std::string> transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", currState);
-// currState = _globalConf[ATTR_CAST(transitions[0], "target")];
-// }
-//
-// return content;
-//}
-
-void ChartToPromela::writeTransition(std::ostream& stream, GlobalTransition* transition, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
- std::list<GlobalTransition*>::const_iterator histIter;
-
- if (envVarIsTrue("USCXML_ANNOTATE_NOCOMMENT")) {
- stream << std::endl << _prefix << "t" << transition->index << ": /* ######################## */ " << std::endl;
-
- } else {
-
- stream << std::endl << _prefix << "t" << transition->index << ": /* ######################## " << std::endl;
- FlatStateIdentifier flatActiveSource(transition->source);
- stream << " from state: ";
- PRETTY_PRINT_LIST(stream, flatActiveSource.getActive());
- stream << std::endl;
- // stream << " with history: " << flatActiveSource.getFlatHistory() << std::endl;
- stream << " ----- on event: " << (transition->eventDesc.size() > 0 ? transition->eventDesc : "SPONTANEOUS") << " --" << std::endl;
- stream << " to state: ";
- std::set<FlatStateIdentifier> destinations;
- destinations.insert(FlatStateIdentifier(transition->destination));
- histIter = transition->historyTrans.begin();
- while(histIter != transition->historyTrans.end()) {
- destinations.insert(FlatStateIdentifier((*histIter)->destination));
- histIter++;
- }
- std::string seperator = "";
- for (std::set<FlatStateIdentifier>::iterator destIter = destinations.begin(); destIter != destinations.end(); destIter++) {
- stream << seperator;
- PRETTY_PRINT_LIST(stream, destIter->getActive());
- stream << " with " << (destIter->getFlatHistory().size() > 0 ? destIter->getFlatHistory() : "no history");
- seperator = "\n ";
- }
- stream << std::endl;
-
- stream << "############################### */" << std::endl;
- }
- stream << std::endl;
- stream << padding << "skip;" << std::endl;
- stream << padding << "d_step {" << std::endl;
- if (_writeTransitionPrintfs)
- stream << padding << " printf(\"Taking Transition " << _prefix << "t" << transition->index << "\\n\");" << std::endl;
-
- padding += " ";
- indent++;
-
- // iterators of history transitions executable content
- std::map<GlobalTransition*, std::pair<GlobalTransition::Action::iter_t, GlobalTransition::Action::iter_t> > actionIters;
- std::map<GlobalTransition*, std::set<GlobalTransition::Action> > actionsInTransition;
-
- typedef std::map<GlobalTransition*, std::pair<GlobalTransition::Action::iter_t, GlobalTransition::Action::iter_t> > actionIters_t;
-
- histIter = transition->historyTrans.begin();
- while(histIter != transition->historyTrans.end()) {
- actionIters.insert(std::make_pair((*histIter), std::make_pair((*histIter)->actions.begin(), (*histIter)->actions.end())));
- // add history transitions actions to the set
- for (std::list<GlobalTransition::Action>::iterator actionIter = (*histIter)->actions.begin(); actionIter != (*histIter)->actions.end(); actionIter++) {
- actionsInTransition[*histIter].insert(*actionIter);
- }
-// std::copy((*histIter)->actions.begin(), (*histIter)->actions.end(), std::inserter(actionsInTransition[*histIter], actionsInTransition[*histIter].begin()));
- histIter++;
- }
-// std::cout << "###" << std::endl;
- for (std::list<GlobalTransition::Action>::iterator actionIter = transition->actions.begin(); actionIter != transition->actions.end(); actionIter++) {
- actionsInTransition[transition].insert(*actionIter);
- }
-// std::copy(transition->actions.begin(), transition->actions.end(), std::inserter(actionsInTransition[transition], actionsInTransition[transition].begin()));
-
-
-// GlobalTransition::Action action;
- std::set<GlobalTransition*> allBut;
- std::list<ExecContentSeqItem> ecSeq;
-
- for (std::list<GlobalTransition::Action>::const_iterator actionIter = transition->actions.begin(); actionIter != transition->actions.end(); actionIter++) {
- // for every executable content in base transition
- const GlobalTransition::Action& baseAction = *actionIter;
- allBut.clear();
-
- for (actionIters_t::iterator histActionIter = actionIters.begin(); histActionIter != actionIters.end(); histActionIter++) {
- // iterate every history transition
- GlobalTransition* histTrans = histActionIter->first;
- if (histActionIter->second.first == histActionIter->second.second) // TODO: is this correct?
- continue;
- GlobalTransition::Action& histAction = *(histActionIter->second.first);
-
- // is the current action identical or a generated raise for done.state.ID?
-// std::cerr << baseAction << std::endl;
-// std::cerr << histAction << std::endl;
- if (baseAction != histAction && !baseAction.raiseDone) {
-// std::cout << baseAction << std::endl;
-// std::cout << histAction << std::endl;
-
- // executable content differs - will given executable content appear later in history?
- if (actionsInTransition[histTrans].find(baseAction) != actionsInTransition[histTrans].end()) {
- // yes -> write all exec content exclusive to this history transition until base executable content
- while(baseAction != *(histActionIter->second.first)) {
- histAction = *(histActionIter->second.first);
- ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR, histTrans, histAction));
- actionsInTransition[histTrans].erase(histAction);
- histActionIter->second.first++;
- }
- } else {
- // no -> exclude this history transition
- allBut.insert(histTrans);
- }
- } else {
- // that's great, they are equal, just increase iterator
- histActionIter->second.first++;
- }
- }
-
- if (allBut.empty()) {
- // everyone has the current actionIter one behind the base action
- ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_EVERY, NULL, baseAction));
- } else {
- // everyone but some have this content
- ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_ALL_BUT, allBut, baseAction));
- }
- }
-
- // see what remains in history transitions and add as exclusive
- for (actionIters_t::iterator histActionIter = actionIters.begin(); histActionIter != actionIters.end(); histActionIter++) {
- GlobalTransition* histTrans = histActionIter->first;
-
- while(histActionIter->second.first != histActionIter->second.second) {
- GlobalTransition::Action& histAction = *(histActionIter->second.first);
- ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR, histTrans, histAction));
- histActionIter->second.first++;
- }
- }
-
- bool isConditionalized = false;
- bool wroteHistoryAssignments = false;
-
- for (std::list<ExecContentSeqItem>::const_iterator ecIter = ecSeq.begin(); ecIter != ecSeq.end(); ecIter++) {
- const GlobalTransition::Action& action = ecIter->action;
-
- if (action.exited) {
- // first onexit handler writes history assignments
- if (!wroteHistoryAssignments) {
- writeHistoryAssignments(stream, transition, indent);
- wroteHistoryAssignments = true;
- }
- }
-
- if (!_analyzer->usesInPredicate() && (action.entered || action.exited)) {
- continue;
- }
-
- if (!isConditionalized && ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR) {
-// assert(!wroteHistoryAssignments); // we need to move assignments after dispatching?
- stream << padding << "if" << std::endl;
- stream << padding << ":: " << conditionalizeForHist(ecIter->transitions) << " -> {" << std::endl;
- padding += " ";
- indent++;
- isConditionalized = true;
- } else if (!isConditionalized && ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ALL_BUT) {
-// assert(!wroteHistoryAssignments); // we need to move assignments after dispatching?
- stream << padding << "if" << std::endl;
- stream << padding << ":: " << conditionalizeForHist(ecIter->transitions) << " -> skip;" << std::endl;
- stream << padding << ":: else -> {" << std::endl;
- padding += " ";
- indent++;
- isConditionalized = true;
- }
-
-#if 0
- switch (ecIter->type) {
- case ExecContentSeqItem::EXEC_CONTENT_ALL_BUT:
- std::cout << "ALL_BUT" << std::endl;
- break;
- case ExecContentSeqItem::EXEC_CONTENT_EVERY:
- std::cout << "EVERY" << std::endl;
- break;
- case ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR:
- std::cout << "ONLY_FOR" << std::endl;
- break;
-
- default:
- break;
- }
-#endif
-
- if (action.exited) {
- // we left a state
- stream << padding << _prefix << "_x.states[" << _analyzer->macroForLiteral(ATTR(action.exited, "id")) << "] = false; " << std::endl;
-// continue;
- }
-
- if (action.entered) {
- // we entered a state
- stream << padding << _prefix << "_x.states[" << _analyzer->macroForLiteral(ATTR(action.entered, "id")) << "] = true; " << std::endl;
-// continue;
- }
-
- if (action.transition) {
- // this is executable content from a transition
- stream << "/* executable content for transition */" << std::endl;
- writeExecutableContent(stream, action.transition, indent);
-// continue;
- }
-
- if (action.onExit) {
-// std::cout<< action.onExit << std::endl;
- // executable content from an onexit element
- if (action.onExit.getParentNode()) // this should not be necessary?
- stream << "/* executable content for exiting state " << ATTR_CAST(action.onExit.getParentNode(), "id") << " */" << std::endl;
- writeExecutableContent(stream, action.onExit, indent);
-// continue;
- }
-
- if (action.onEntry) {
- // executable content from an onentry element
- if (action.onEntry.getParentNode()) // this should not be necessary?
- stream << "/* executable content for entering state " << ATTR_CAST(action.onEntry.getParentNode(), "id") << " */" << std::endl;
- writeExecutableContent(stream, action.onEntry, indent);
-// continue;
- }
-
- if (action.raiseDone) {
- // executable content from an onentry element
- if (action.raiseDone.getParentNode()) // this should not be necessary?
- stream << "/* raising done event for " << ATTR_CAST(action.raiseDone.getParentNode(), "id") << " */" << std::endl;
- writeExecutableContent(stream, action.raiseDone, indent);
- // continue;
- }
-
- if (action.invoke) {
- // an invoke element
-
- if (_machines.find(action.invoke) != _machines.end()) {
- stream << padding << _prefix << "start!" << _analyzer->macroForLiteral(_machines[action.invoke]->_invokerid) << ";" << std::endl;
- } else {
- if (HAS_ATTR_CAST(action.invoke, "id")) {
- stream << padding << _prefix << ATTR_CAST(action.invoke, "id") << "Running = true;" << std::endl;
- }
- }
-
- }
-
- if (action.uninvoke) {
- if (_machines.find(action.uninvoke) != _machines.end()) {
- stream << padding << "do" << std::endl;
- stream << padding << ":: " << _prefix << "start??" << _analyzer->macroForLiteral(_machines[action.uninvoke]->_invokerid) << " -> skip" << std::endl;
- stream << padding << ":: else -> break;" << std::endl;
- stream << padding << "od" << std::endl;
-
- stream << padding << _machines[action.uninvoke]->_prefix << "canceled = true;" << std::endl;
- if (_analyzer->usesEventField("delay")) {
- stream << padding << "removePendingEventsForInvoker(" << _analyzer->macroForLiteral(_machines[action.uninvoke]->_invokerid) << ");" << std::endl;
- }
- } else {
- if (HAS_ATTR_CAST(action.uninvoke, "id")) {
- stream << padding << _prefix << ATTR_CAST(action.uninvoke, "id") << "Running = false;" << std::endl;
- }
- }
- }
-
- if (isConditionalized) {
- // peek into next content and see if same conditions apply -> keep conditionalization
- bool sameCondition = false;
- std::list<ExecContentSeqItem>::const_iterator nextIter = ecIter;
- nextIter++;
- if (nextIter != ecSeq.end() && ecIter->type == nextIter->type && ecIter->transitions == nextIter->transitions) {
- sameCondition = true;
- }
-
- if (!sameCondition) {
- padding = padding.substr(2);
- indent--;
-
- if (ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ALL_BUT) {
- stream << padding << "}" << std::endl;
- stream << padding << "fi" << std::endl << std::endl;
- } else if(ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR) {
- stream << padding << "}" << std::endl;
- stream << padding << ":: else -> skip;" << std::endl;
- stream << padding << "fi;" << std::endl << std::endl;
- }
- isConditionalized = false;
- }
- }
- }
-
- if (!wroteHistoryAssignments) {
- writeHistoryAssignments(stream, transition, indent);
- wroteHistoryAssignments = true;
- }
-
- // write new state assignment and goto dispatching
- GlobalState* origNewState = NULL;
-
- // sort history transitions by new active state
- std::map<GlobalState*, std::set<GlobalTransition*> > histTargets;
- histIter = transition->historyTrans.begin();
- while(histIter != transition->historyTrans.end()) {
- origNewState = _activeConf[(*histIter)->activeDestination];
- assert(origNewState != NULL);
- histTargets[origNewState].insert(*histIter);
- histIter++;
- }
-
- origNewState = _activeConf[transition->activeDestination];
- bool hasHistoryTarget = false;
-
- for (std::map<GlobalState*, std::set<GlobalTransition*> >::const_iterator histTargetIter = histTargets.begin(); histTargetIter != histTargets.end(); histTargetIter++) {
- GlobalState* histNewState = histTargetIter->first;
- if (histNewState == origNewState)
- continue;
- stream << padding << "if" << std::endl;
-
- if (!envVarIsTrue("USCXML_ANNOTATE_NOCOMMENT")) {
- stream << "/* to state ";
- FlatStateIdentifier flatActiveDest(histNewState->activeId);
- PRETTY_PRINT_LIST(stream, flatActiveDest.getActive());
- stream << " via history */" << std::endl;
- }
-
- stream << padding << ":: " << conditionalizeForHist(histTargetIter->second) << " -> " << _prefix << "s = s" << histNewState->activeIndex << ";" << std::endl;
-// writeTransitionClosure(stream, *histTargetIter->second.begin(), histNewState, indent + 1); // is this correct for everyone in set?
-
-
- hasHistoryTarget = true;
- }
-
- origNewState = _activeConf[transition->activeDestination];
- FlatStateIdentifier flatActiveDest(transition->activeDestination);
- assert(origNewState != NULL);
-
- if (!envVarIsTrue("USCXML_ANNOTATE_NOCOMMENT")) {
- stream << "/* to state ";
- PRETTY_PRINT_LIST(stream, flatActiveDest.getActive());
- stream << " */" << std::endl;
- }
- if (hasHistoryTarget) {
- stream << padding << ":: else -> ";
- padding += " ";
- indent++;
- }
-
- stream << padding << _prefix << "s = s" << origNewState->activeIndex << ";" << std::endl;
-
-
- if (hasHistoryTarget) {
- padding = padding.substr(2);
- indent--;
-// stream << padding << "}" << std::endl;
- stream << padding << "fi;" << std::endl;
- }
-
- TRANSITION_TRACE(transition, false);
-
- padding = padding.substr(2);
- stream << padding << "}" << std::endl;
-
- // moved up here for goto from d_step
- writeTransitionClosure(stream, transition, origNewState, indent-1);
-
- _perfTransProcessed++;
- _perfTransTotal++;
-
- DUMP_STATS(false);
-
-}
-
-void ChartToPromela::writeHistoryAssignments(std::ostream& stream, GlobalTransition* transition, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- if (transition->historyTrans.size() == 0)
- return;
-
- // GlobalState to *changed* history configuration
- std::list<HistoryTransitionClass> histClasses;
-
- std::set<GlobalTransition*> allTrans;
- allTrans.insert(transition);
- allTrans.insert(transition->historyTrans.begin(), transition->historyTrans.end());
-
- // iterate all transitions
- std::set<GlobalTransition*>::iterator transIter = allTrans.begin();
- while(transIter != allTrans.end()) {
- histClasses.push_back(HistoryTransitionClass(*transIter));
- transIter++;
- }
-
- // nothing to do here
- if (histClasses.size() == 0)
- return;
-
-// std::cout << histClasses.size() << " / ";
-
- // now sort into equivalence classes
- std::list<HistoryTransitionClass>::iterator outerHistClassIter = histClasses.begin();
- std::list<HistoryTransitionClass>::iterator innerHistClassIter = histClasses.begin();
- while(outerHistClassIter != histClasses.end()) {
- HistoryTransitionClass& outerClass = *outerHistClassIter;
-
- // iterate inner iter for every outer iter and see if we can merge
- innerHistClassIter = outerHistClassIter;
- innerHistClassIter++;
-
- while(innerHistClassIter != histClasses.end()) {
- // can we merge the inner class into the outer one?
- HistoryTransitionClass& innerClass = *innerHistClassIter;
-
- if (outerClass.matches(innerClass)) {
- outerClass.merge(innerClass);
- histClasses.erase(innerHistClassIter++);
- } else {
- innerHistClassIter++;
- }
- }
-
- _perfHistoryProcessed++;
- _perfHistoryTotal++;
-
- outerHistClassIter++;
- }
-// std::cout << histClasses.size() << std::endl;
-
- bool preambelWritten = false;
- std::list<HistoryTransitionClass>::iterator histClassIter = histClasses.begin();
- std::list<HistoryTransitionClass>::iterator defaultHistClassIter = histClasses.end();
- size_t nrMembers = 0;
- while(histClassIter != histClasses.end() || defaultHistClassIter != histClasses.end()) {
-
- // remember iterator position with default transition
- if (histClassIter == histClasses.end() && defaultHistClassIter != histClasses.end()) {
- histClassIter = defaultHistClassIter;
- } else if (histClassIter->members.find(transition) != histClassIter->members.end()) {
- defaultHistClassIter = histClassIter;
- histClassIter++;
- continue;
- }
-
- nrMembers += histClassIter->members.size();
-
- if (!preambelWritten && histClasses.size() > 1) {
- stream << padding << "if" << std::endl;
- preambelWritten = true;
- }
-
- if (histClasses.size() > 1) {
- stream << padding << "::" << conditionalizeForHist(histClassIter->members) << " {" << std::endl;
- }
-
- {
- std::map<std::string, std::set<std::string> >::iterator forgetIter = histClassIter->toForget.begin();
- while(forgetIter != histClassIter->toForget.end()) {
- std::set<std::string>::iterator forgetMemberIter = forgetIter->second.begin();
- while(forgetMemberIter != forgetIter->second.end()) {
- stream << padding << _prefix << "_hist_" << boost::to_lower_copy(_analyzer->macroForLiteral(forgetIter->first));
- stream << "[" << _historyMembers[forgetIter->first][*forgetMemberIter] << "] = 0;";
- stream << " \t/* " << *forgetMemberIter << " */" << std::endl;
- forgetMemberIter++;
- }
- forgetIter++;
- }
- }
-
- {
- std::map<std::string, std::set<std::string> >::iterator rememberIter = histClassIter->toRemember.begin();
- while(rememberIter != histClassIter->toRemember.end()) {
- std::set<std::string>::iterator rememberMemberIter = rememberIter->second.begin();
- while(rememberMemberIter != rememberIter->second.end()) {
- stream << padding << _prefix << "_hist_" << boost::to_lower_copy(_analyzer->macroForLiteral(rememberIter->first));
- stream << "[" << _historyMembers[rememberIter->first][*rememberMemberIter] << "] = 1;";
- stream << " \t/* " << *rememberMemberIter << " */" << std::endl;
- rememberMemberIter++;
- }
- rememberIter++;
- }
- }
-
- if (histClasses.size() > 1) {
- stream << padding << "}" << std::endl;
- }
-
- if (histClassIter == defaultHistClassIter) {
- break;
- }
-
- histClassIter++;
- }
- assert(nrMembers == allTrans.size());
-
-}
-
-HistoryTransitionClass::HistoryTransitionClass(GlobalTransition* transition) {
- members.insert(transition);
- init(transition->source, transition->destination);
-}
-
-HistoryTransitionClass::HistoryTransitionClass(const std::string& from, const std::string& to) {
- init(from, to);
-}
-
-void HistoryTransitionClass::init(const std::string& from, const std::string& to) {
- if (from == to)
- return;
-
- FlatStateIdentifier flatSource(from);
- FlatStateIdentifier flatTarget(to);
-
- std::map<std::string, std::set<std::string> > activeBefore = flatSource.getHistorySets();
- std::map<std::string, std::set<std::string> > activeAfter = flatTarget.getHistorySets();
-
- std::map<std::string, std::set<std::string> >::const_iterator targetHistIter = activeAfter.begin();
- while(targetHistIter != activeAfter.end()) {
- // for every history state in target, see if it existed in source
- if (activeBefore.find(targetHistIter->first) == activeBefore.end()) {
- // this target history did not exist source -> every item is changed
- std::set<std::string>::const_iterator histMemberIter = activeAfter.at(targetHistIter->first).begin();
- while(histMemberIter != activeAfter.at(targetHistIter->first).end()) {
- toRemember[targetHistIter->first].insert(*histMemberIter);
- histMemberIter++;
- }
- } else {
- // this target *did* already exist, but was it equally assigned?
- std::set<std::string>::const_iterator sourceHistMemberIter = activeBefore.at(targetHistIter->first).begin();
- while(sourceHistMemberIter != activeBefore.at(targetHistIter->first).end()) {
- // iterate every item in source and try to find it in target
- if (targetHistIter->second.find(*sourceHistMemberIter) == targetHistIter->second.end()) {
- // no, source is no longer in target
- toForget[targetHistIter->first].insert(*sourceHistMemberIter);
- } else {
- toKeep[targetHistIter->first].insert(*sourceHistMemberIter);
- }
- sourceHistMemberIter++;
- }
-
- std::set<std::string>::const_iterator targetHistMemberIter = activeAfter.at(targetHistIter->first).begin();
- while(targetHistMemberIter != activeAfter.at(targetHistIter->first).end()) {
- // iterate member of target history and see if it is new
- if (activeBefore.at(targetHistIter->first).find(*targetHistMemberIter) == activeBefore.at(targetHistIter->first).end()) {
- // not found -> new assignment
- toRemember[targetHistIter->first].insert(*targetHistMemberIter);
- }
- targetHistMemberIter++;
- }
- }
- targetHistIter++;
- }
-}
-
-bool HistoryTransitionClass::matches(const HistoryTransitionClass& other) {
-
- /* does the given transition match this one?:
- 1. everything remembered has to be remembered as well or already enabled
- 2. everything forgot has to be forgotten as well or already disabled
- and vice versa
- */
-
- std::map<std::string, std::set<std::string> > tmp;
-
- typedef std::map<std::string, std::set<std::string> >::const_iterator histIter_t;
- typedef std::set<std::string>::const_iterator histMemberIter_t;
-
- // we will remember these - will the other try to forget them?
- INTERSECT_MAPS(toRemember, other.toForget, tmp);
- if (tmp.size() > 0)
- return false;
-
- // we will keep these - will the other try to forget them?
- INTERSECT_MAPS(toKeep, other.toForget, tmp);
- if (tmp.size() > 0)
- return false;
-
- // we will forget these - will the other try to keep or even remember?
- INTERSECT_MAPS(toForget, other.toKeep, tmp);
- if (tmp.size() > 0)
- return false;
- INTERSECT_MAPS(toForget, other.toRemember, tmp);
- if (tmp.size() > 0)
- return false;
-
- return true;
-}
-
-void HistoryTransitionClass::merge(const HistoryTransitionClass& other) {
- members.insert(other.members.begin(), other.members.end());
-
- std::map<std::string, std::set<std::string> >::const_iterator histIter;
-
- histIter = other.toRemember.begin();
- while(histIter != other.toRemember.end()) {
- toRemember[histIter->first].insert(histIter->second.begin(), histIter->second.end());
- histIter++;
- }
-
- histIter = other.toForget.begin();
- while(histIter != other.toForget.end()) {
- toForget[histIter->first].insert(histIter->second.begin(), histIter->second.end());
- histIter++;
- }
-
- histIter = other.toKeep.begin();
- while(histIter != other.toKeep.end()) {
- toKeep[histIter->first].insert(histIter->second.begin(), histIter->second.end());
- histIter++;
- }
-
-}
-
-void ChartToPromela::writeTransitionClosure(std::ostream& stream, GlobalTransition* transition, GlobalState* state, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
-// if (_traceTransitions) {
-// for (std::set<int>::iterator transRefIter = transition->transitionRefs.begin(); transRefIter != transition->transitionRefs.end(); transRefIter++) {
-// stream << padding << _prefix << "transitions[" << *transRefIter << "] = false; " << std::endl;
-// }
-// }
-
- if (state->isFinal) {
- stream << padding << "goto " << _prefix << "terminate;" << std::endl;
- } else {
- if (!transition->isEventless) {
- stream << padding << _prefix << "spontaneous = true;" << std::endl;
- }
- stream << padding << "goto " << _prefix << "microStep;" << std::endl;
- }
-}
-
-void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent) {
- if (!node)
- return;
-
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- if (node.getNodeType() == Node_base::TEXT_NODE) {
- if (boost::trim_copy(node.getNodeValue()).length() > 0)
- stream << beautifyIndentation(ADAPT_SRC(node.getNodeValue()), indent) << std::endl;
- }
-
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
- return; // skip anything not an element
-
- Arabica::DOM::Element<std::string> nodeElem = Arabica::DOM::Element<std::string>(node);
-
- if (false) {
- } else if(TAGNAME(nodeElem) == "onentry" || TAGNAME(nodeElem) == "onexit" || TAGNAME(nodeElem) == "transition" || TAGNAME(nodeElem) == "finalize") {
- // descent into childs and write their contents
- Arabica::DOM::Node<std::string> child = node.getFirstChild();
- while(child) {
- writeExecutableContent(stream, child, indent);
- child = child.getNextSibling();
- }
- } else if(TAGNAME(nodeElem) == "script") {
- NodeSet<std::string> scriptText = DOMUtils::filterChildType(Node_base::TEXT_NODE, node, true);
- for (size_t i = 0; i < scriptText.size(); i++) {
- stream << ADAPT_SRC(beautifyIndentation(scriptText[i].getNodeValue(), indent)) << std::endl;
- }
-
- } else if(TAGNAME(nodeElem) == "log") {
- std::string label = (HAS_ATTR(nodeElem, "label") ? ATTR(nodeElem, "label") : "");
- std::string expr = (HAS_ATTR(nodeElem, "expr") ? ADAPT_SRC(ATTR(nodeElem, "expr")) : "");
- std::string trimmedExpr = boost::trim_copy(expr);
- bool isStringLiteral = (boost::starts_with(trimmedExpr, "\"") || boost::starts_with(trimmedExpr, "'"));
-
- std::string formatString;
- std::string varString;
- std::string seperator;
-
- if (label.size() > 0) {
- if (expr.size() > 0) {
- formatString += label + ": ";
- } else {
- formatString += label;
- }
- }
-
- if (isStringLiteral) {
- formatString += expr;
- } else if (expr.size() > 0) {
- formatString += "%d";
- varString += seperator + expr;
- }
-
- if (varString.length() > 0) {
- stream << padding << "printf(\"" + formatString + "\", " + varString + ");" << std::endl;
- } else {
- stream << padding << "printf(\"" + formatString + "\");" << std::endl;
- }
-
- } else if(TAGNAME(nodeElem) == "foreach") {
- stream << padding << "for (" << _prefix << (HAS_ATTR(nodeElem, "index") ? ATTR(nodeElem, "index") : "_index") << " in " << _prefix << ATTR(nodeElem, "array") << ") {" << std::endl;
- if (HAS_ATTR(nodeElem, "item")) {
- stream << padding << " " << _prefix << ATTR(nodeElem, "item") << " = " << _prefix << ATTR(nodeElem, "array") << "[" << _prefix << (HAS_ATTR(nodeElem, "index") ? ATTR(nodeElem, "index") : "_index") << "];" << std::endl;
- }
- Arabica::DOM::Node<std::string> child = node.getFirstChild();
- while(child) {
- writeExecutableContent(stream, child, indent + 1);
- child = child.getNextSibling();
- }
-// if (HAS_ATTR(nodeElem, "index"))
-// stream << padding << " " << _prefix << ATTR(nodeElem, "index") << "++;" << std::endl;
- stream << padding << "}" << std::endl;
-
- } else if(TAGNAME(nodeElem) == "if") {
- NodeSet<std::string> condChain;
- condChain.push_back(node);
- condChain.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "elseif", node));
- condChain.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "else", node));
-
- writeIfBlock(stream, condChain, indent);
-
- } else if(TAGNAME(nodeElem) == "assign") {
- NodeSet<std::string> assignTexts = DOMUtils::filterChildType(Node_base::TEXT_NODE, nodeElem, true);
- assert(assignTexts.size() > 0);
- stream << beautifyIndentation(ADAPT_SRC(boost::trim_copy(assignTexts[0].getNodeValue())), indent) << std::endl;
-
- } else if(TAGNAME(nodeElem) == "send" || TAGNAME(nodeElem) == "raise") {
- std::string targetQueue;
- std::string insertOp = "!";
- if (TAGNAME(nodeElem) == "raise") {
- targetQueue = _prefix + "iQ";
- } else if (!HAS_ATTR(nodeElem, "target")) {
- if (_allowEventInterleaving) {
- targetQueue = _prefix + "tmpQ";
- } else {
- targetQueue = _prefix + "eQ";
- }
- } else if (ATTR(nodeElem, "target").compare("#_internal") == 0) {
- targetQueue = _prefix + "iQ";
- } else if (ATTR(nodeElem, "target").compare("#_parent") == 0) {
- targetQueue = _parent->_prefix + "eQ";
- } else if (boost::starts_with(ATTR(nodeElem, "target"), "#_") && _machinesPerId.find(ATTR(nodeElem, "target").substr(2)) != _machinesPerId.end()) {
- targetQueue = _machines[_machinesPerId[ATTR(nodeElem, "target").substr(2)]]->_prefix + "eQ";
- }
- if (targetQueue.length() > 0) {
- // this is for our external queue
- std::string event;
-
- if (HAS_ATTR(nodeElem, "event")) {
- event = _analyzer->macroForLiteral(ATTR(nodeElem, "event"));
- } else if (HAS_ATTR(nodeElem, "eventexpr")) {
- event = ADAPT_SRC(ATTR(nodeElem, "eventexpr"));
- }
- if (_analyzer->usesComplexEventStruct()) {
- stream << padding << "{" << std::endl;
- std::string typeReset = _analyzer->getTypeReset("tmpE", _analyzer->getType("_event"), padding + " ");
- std::stringstream typeAssignSS;
- typeAssignSS << padding << " tmpE.name = " << event << ";" << std::endl;
-
- if (HAS_ATTR(nodeElem, "idlocation")) {
- typeAssignSS << padding << " /* idlocation */" << std::endl;
- typeAssignSS << padding << " _lastSendId = _lastSendId + 1;" << std::endl;
- typeAssignSS << padding << " " << _prefix << ATTR(nodeElem, "idlocation") << " = _lastSendId;" << std::endl;
- typeAssignSS << padding << " tmpE.sendid = _lastSendId;" << std::endl;
- typeAssignSS << padding << " if" << std::endl;
- typeAssignSS << padding << " :: _lastSendId == 2147483647 -> _lastSendId = 0;" << std::endl;
- typeAssignSS << padding << " :: else -> skip;" << std::endl;
- typeAssignSS << padding << " fi;" << std::endl;
- } else if (HAS_ATTR(nodeElem, "id")) {
- typeAssignSS << padding << " tmpE.sendid = " << _analyzer->macroForLiteral(ATTR(nodeElem, "id")) << ";" << std::endl;
- }
-
- if (_invokerid.length() > 0) { // do not send invokeid if we send / raise to ourself
- typeAssignSS << padding << " tmpE.invokeid = " << _analyzer->macroForLiteral(_invokerid) << ";" << std::endl;
- }
-
- if (_analyzer->usesEventField("origintype") && !boost::ends_with(targetQueue, "iQ")) {
- typeAssignSS << padding << " tmpE.origintype = " << _analyzer->macroForLiteral("http://www.w3.org/TR/scxml/#SCXMLEventProcessor") << ";" << std::endl;
- }
-
- if (_analyzer->usesEventField("delay")) {
-#if NEW_DELAY_RESHUFFLE
-#else
- insertOp += "!";
- typeAssignSS << padding << " _lastSeqId = _lastSeqId + 1;" << std::endl;
-#endif
- if (HAS_ATTR_CAST(nodeElem, "delay")) {
- typeAssignSS << padding << " tmpE.delay = " << ATTR_CAST(nodeElem, "delay") << ";" << std::endl;
- } else if (HAS_ATTR_CAST(nodeElem, "delayexpr")) {
- typeAssignSS << padding << " tmpE.delay = " << ADAPT_SRC(ATTR_CAST(nodeElem, "delayexpr")) << ";" << std::endl;
- } else {
- typeAssignSS << padding << " tmpE.delay = 0;" << std::endl;
- }
-#if NEW_DELAY_RESHUFFLE
-#else
- typeAssignSS << padding << " tmpE.seqNr = _lastSeqId;" << std::endl;
-#endif
- }
-
- if (_analyzer->usesEventField("type")) {
- std::string eventType = (targetQueue.compare("iQ!") == 0 ? _analyzer->macroForLiteral("internal") : _analyzer->macroForLiteral("external"));
- typeAssignSS << padding << " tmpE.type = " << eventType << ";" << std::endl;
- }
-
- NodeSet<std::string> sendParams = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", nodeElem);
- NodeSet<std::string> sendContents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", nodeElem);
- std::string sendNameList = ATTR(nodeElem, "namelist");
- if (sendParams.size() > 0) {
- for (size_t i = 0; i < sendParams.size(); i++) {
- Element<std::string> paramElem = Element<std::string>(sendParams[i]);
- typeAssignSS << padding << " tmpE.data." << ATTR(paramElem, "name") << " = " << ADAPT_SRC(ATTR(paramElem, "expr")) << ";" << std::endl;
- }
- }
- if (sendNameList.size() > 0) {
- std::list<std::string> nameListIds = tokenize(sendNameList);
- std::list<std::string>::iterator nameIter = nameListIds.begin();
- while(nameIter != nameListIds.end()) {
- typeAssignSS << padding << " tmpE.data." << *nameIter << " = " << ADAPT_SRC(*nameIter) << ";" << std::endl;
- nameIter++;
- }
- }
-
- if (sendParams.size() == 0 && sendNameList.size() == 0 && sendContents.size() > 0) {
- Element<std::string> contentElem = Element<std::string>(sendContents[0]);
- if (contentElem.hasChildNodes() && contentElem.getFirstChild().getNodeType() == Node_base::TEXT_NODE) {
- std::string content = spaceNormalize(contentElem.getFirstChild().getNodeValue());
- if (!isNumeric(content.c_str(), 10)) {
- typeAssignSS << padding << " tmpE.data = " << _analyzer->macroForLiteral(content) << ";" << std::endl;
- } else {
- typeAssignSS << padding << " tmpE.data = " << content << ";" << std::endl;
- }
- } else if (HAS_ATTR(contentElem, "expr")) {
- typeAssignSS << padding << " tmpE.data = " << ADAPT_SRC(ATTR(contentElem, "expr")) << ";" << std::endl;
- }
- }
-
- // remove all fields from typeReset that are indeed set by typeAssign
-// for (std::string assigned; std::getline(typeAssignSS, assigned); ) {
-// assigned = assigned.substr(0, assigned.find('='));
-// assigned = assigned.substr(assigned.find('.'));
-// std::istringstream typeResetSS (typeReset);
-// for (std::string reset; std::getline(typeResetSS, reset); ) {
-// if (!boost::find_first(reset, assigned)) {
-// stream << reset << std::endl;
-// }
-// }
-// }
-// stream << typeAssignSS.str();
-
- std::istringstream typeResetSS (typeReset);
- for (std::string reset; std::getline(typeResetSS, reset); ) {
- std::string resetField = reset.substr(0, reset.find('='));
- resetField = resetField.substr(resetField.find('.'));
- for (std::string assigned; std::getline(typeAssignSS, assigned); ) {
- if (boost::find_first(resetField, assigned)) {
- break;
- }
- }
- stream << reset << std::endl;
- }
- stream << typeAssignSS.str();
-
-
- stream << padding << " " << targetQueue << insertOp <<"tmpE;" << std::endl;
-
-#if NEW_DELAY_RESHUFFLE
- if (_analyzer->usesEventField("delay") && !boost::ends_with(targetQueue, "iQ")) {
- stream << padding << " insertWithDelay(" << targetQueue << ");" << std::endl;
- }
-#endif
-
- stream << padding << "}" << std::endl;
- } else {
- stream << padding << targetQueue << insertOp << event << ";" << std::endl;
- }
- }
- } else if(TAGNAME(nodeElem) == "cancel") {
- if (HAS_ATTR(nodeElem, "sendid")) {
- stream << padding << "cancelSendId(" << _analyzer->macroForLiteral(ATTR(nodeElem, "sendid")) << ", " << (_invokerid.size() > 0 ? _analyzer->macroForLiteral(_invokerid) : "0") << ");" << std::endl;
- } else if (HAS_ATTR(nodeElem, "sendidexpr")) {
- stream << padding << "cancelSendId(" << ADAPT_SRC(ATTR(nodeElem, "sendidexpr")) << ", " << (_invokerid.size() > 0 ? _analyzer->macroForLiteral(_invokerid) : "0") << ");" << std::endl;
- }
- } else {
- std::cerr << "'" << TAGNAME(nodeElem) << "'" << std::endl << nodeElem << std::endl;
- assert(false);
- }
-}
-
-PromelaInlines::~PromelaInlines() {
- return;
-}
-
-std::list<PromelaInline*> PromelaInlines::getRelatedTo(const Arabica::DOM::Node<std::string>& node, PromelaInline::PromelaInlineType type) {
- std::list<PromelaInline*> related;
-
- std::map<Arabica::DOM::Node<std::string>, std::list<PromelaInline*> >::iterator inlIter = inlines.begin();
- while (inlIter != inlines.end()) {
- std::list<PromelaInline*>::iterator pmlIter = inlIter->second.begin();
- while (pmlIter != inlIter->second.end()) {
- if ((type != PromelaInline::PROMELA_NIL || (*pmlIter)->type == type) && (*pmlIter)->relatesTo(node)) {
- related.push_back(*pmlIter);
- }
- pmlIter++;
- }
- inlIter++;
- }
- return related;
-
- return related;
-}
-
-std::list<PromelaInline*> PromelaInlines::getAllOfType(uint32_t type) {
- std::list<PromelaInline*> related;
-
- std::map<Arabica::DOM::Node<std::string>, std::list<PromelaInline*> >::iterator inlIter = inlines.begin();
- while (inlIter != inlines.end()) {
- std::list<PromelaInline*>::iterator pmlIter = inlIter->second.begin();
- while (pmlIter != inlIter->second.end()) {
- if ((*pmlIter)->type & type) {
- related.push_back(*pmlIter);
- }
- pmlIter++;
- }
- inlIter++;
- }
- return related;
-}
-
-PromelaInline::PromelaInline(const Arabica::DOM::Node<std::string>& node) : prevSibling(NULL), nextSibling(NULL), type(PROMELA_NIL) {
- if (node.getNodeType() != Node_base::COMMENT_NODE && node.getNodeType() != Node_base::TEXT_NODE)
- return; // nothing to do
-
- std::stringstream ssLine(node.getNodeValue());
- std::string line;
-
- while(std::getline(ssLine, line)) {
- // skip to first promela line
- boost::trim(line);
- if (boost::starts_with(line, "promela"))
- break;
- }
-
- if (!boost::starts_with(line, "promela"))
- return;
-
- if (false) {
- } else if (boost::starts_with(line, "promela-code")) {
- type = PROMELA_CODE;
- } else if (boost::starts_with(line, "promela-ltl")) {
- type = PROMELA_LTL;
- } else if (boost::starts_with(line, "promela-event-all")) {
- type = PROMELA_EVENT_ALL_BUT;
- } else if (boost::starts_with(line, "promela-event")) {
- type = PROMELA_EVENT_ONLY;
- } else if (boost::starts_with(line, "promela-progress")) {
- type = PROMELA_PROGRESS_LABEL;
- } else if (boost::starts_with(line, "promela-accept")) {
- type = PROMELA_ACCEPT_LABEL;
- } else if (boost::starts_with(line, "promela-end")) {
- type = PROMELA_END_LABEL;
- }
-
- std::stringstream contentSS;
- size_t endType = line.find_first_of(": \n");
-
- std::string seperator;
- if (endType != std::string::npos && endType + 1 < line.size()) {
- contentSS << line.substr(endType + 1, line.size() - endType + 1);
- seperator = "\n";
- }
-
- while(std::getline(ssLine, line)) {
- boost::trim(line);
- if (boost::starts_with(line, "promela")) {
- std::cerr << "Split multiple #promela pragmas into multiple comments!" << std::endl;
- break;
- }
- contentSS << seperator << line;
- seperator = "\n";
- }
- content = contentSS.str();
-}
-
-
-PromelaInlines::PromelaInlines(const Arabica::DOM::Node<std::string>& node) {
- NodeSet<std::string> levelNodes;
- levelNodes.push_back(node);
-
- size_t level = 0;
- while(levelNodes.size() > 0) {
- PromelaInline* predecessor = NULL;
-
- // iterate all nodes at given level
- for (size_t i = 0; i < levelNodes.size(); i++) {
-
- // get all comments
- NodeSet<std::string> comments = DOMUtils::filterChildType(Node_base::COMMENT_NODE, levelNodes[i]);
- for (size_t j = 0; j < comments.size(); j++) {
- PromelaInline* tmp = new PromelaInline(comments[j]);
- if (tmp->type == PromelaInline::PROMELA_NIL) {
- delete tmp;
- continue;
- }
-
- if (predecessor != NULL) {
- tmp->prevSibling = predecessor;
- predecessor->nextSibling = tmp;
- }
- tmp->level = level;
- tmp->container = Element<std::string>(levelNodes[i]);
- predecessor = tmp;
- inlines[levelNodes[i]].push_back(tmp);
- allInlines.push_back(tmp);
- }
- }
-
- levelNodes = DOMUtils::filterChildType(Node_base::ELEMENT_NODE, levelNodes);
- level++;
- }
-}
-
-void PromelaInline::dump() {
-#if 0
- switch(type) {
- case PROMELA_NIL:
- std::cerr << "PROMELA_NIL" << std::endl;
- break;
- case PROMELA_CODE:
- std::cerr << "PROMELA_CODE" << std::endl;
- break;
- case PROMELA_EVENT_SOURCE_ALL:
- std::cerr << "PROMELA_EVENT_SOURCE" << std::endl;
- break;
- case PROMELA_INVOKER:
- std::cerr << "PROMELA_INVOKER" << std::endl;
- break;
- case PROMELA_PROGRESS_LABEL:
- std::cerr << "PROMELA_PROGRESS_LABEL" << std::endl;
- break;
- case PROMELA_ACCEPT_LABEL:
- std::cerr << "PROMELA_ACCEPT_LABEL" << std::endl;
- break;
- case PROMELA_END_LABEL:
- std::cerr << "PROMELA_END_LABEL" << std::endl;
- break;
- }
-#endif
-}
-
-
-void ChartToPromela::writeIfBlock(std::ostream& stream, const Arabica::XPath::NodeSet<std::string>& condChain, int indent) {
- if (condChain.size() == 0)
- return;
-
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- bool noNext = condChain.size() == 1;
- bool nextIsElse = false;
- if (condChain.size() > 1) {
- if (TAGNAME_CAST(condChain[1]) == "else") {
- nextIsElse = true;
- }
- }
-
- Element<std::string> ifNode = Element<std::string>(condChain[0]);
-
- stream << padding << "if" << std::endl;
- // we need to nest the elseifs to resolve promela if semantics
- stream << padding << ":: (" << ADAPT_SRC(ATTR(ifNode, "cond")) << ") -> {" << std::endl;
-
- Arabica::DOM::Node<std::string> child;
- if (TAGNAME(ifNode) == "if") {
- child = ifNode.getFirstChild();
- } else {
- child = ifNode.getNextSibling();
- }
- while(child) {
- if (child.getNodeType() == Node_base::ELEMENT_NODE) {
- Arabica::DOM::Element<std::string> childElem = Arabica::DOM::Element<std::string>(child);
- if (TAGNAME(childElem) == "elseif" || TAGNAME_CAST(childElem) == "else")
- break;
- writeExecutableContent(stream, childElem, indent + 1);
- }
- child = child.getNextSibling();
- }
- stream << padding << "}" << std::endl;
- stream << padding << ":: else -> ";
-
- if (nextIsElse) {
- child = condChain[1].getNextSibling();
- stream << "{" << std::endl;
- while(child) {
- if (child.getNodeType() == Node_base::ELEMENT_NODE) {
- writeExecutableContent(stream, child, indent + 1);
- }
- child = child.getNextSibling();
- }
- stream << padding << "}" << std::endl;
-
- } else if (noNext) {
- stream << "skip;" << std::endl;
- } else {
- stream << "{" << std::endl;
-
- Arabica::XPath::NodeSet<std::string> cdrCondChain;
- for (size_t i = 1; i < condChain.size(); i++) {
- cdrCondChain.push_back(condChain[i]);
- }
- writeIfBlock(stream, cdrCondChain, indent + 1);
- stream << padding << "}" << std::endl;
- }
-
- stream << padding << "fi;" << std::endl;
-
-}
-
-
-std::string ChartToPromela::beautifyIndentation(const std::string& code, int indent) {
-
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- // remove topmost indentation from every line and reindent
- std::stringstream beautifiedSS;
-
- std::string initialIndent;
- bool gotIndent = false;
- bool isFirstLine = true;
- std::stringstream ssLine(code);
- std::string line;
-
- while(std::getline(ssLine, line)) {
- size_t firstChar = line.find_first_not_of(" \t\r\n");
- if (firstChar != std::string::npos) {
- if (!gotIndent) {
- initialIndent = line.substr(0, firstChar);
- gotIndent = true;
- }
- beautifiedSS << (isFirstLine ? "" : "\n") << padding << boost::replace_first_copy(line, initialIndent, "");
- isFirstLine = false;
- }
- }
-
- return beautifiedSS.str();
-}
-
-void ChartToPromela::writeStrings(std::ostream& stream) {
- stream << "/* string literals */" << std::endl;
- std::set<std::string> literals = _analyzer->getLiterals();
- std::map<std::string, int> events = _analyzer->getEvents();
- std::map<std::string, int> origStates = _analyzer->getOrigStates();
-
- for (std::set<std::string>::const_iterator litIter = literals.begin(); litIter != literals.end(); litIter++) {
- if (events.find(*litIter) == events.end() && (origStates.find(*litIter) == origStates.end() || !_analyzer->usesInPredicate()))
- stream << "#define " << _analyzer->macroForLiteral(*litIter) << " " << _analyzer->indexForLiteral(*litIter) << " /* " << *litIter << " */" << std::endl;
- }
-}
-
-void ChartToPromela::writeDeclarations(std::ostream& stream) {
-
- stream << "/* global variables " << (_prefix.size() > 0 ? "for " + _prefix : "") << " */" << std::endl;
-
- // we cannot know our event queue with nested invokers? Adding some for test422
- size_t tolerance = 6;
-
- if (_analyzer->usesComplexEventStruct()) {
- // event is defined with the typedefs
- stream << "_event_t " << _prefix << "_event; /* current event */" << std::endl;
- stream << "unsigned " << _prefix << "s : " << BIT_WIDTH(_activeConf.size() + 1) << "; /* current state */" << std::endl;
- stream << "chan " << _prefix << "iQ = [" << MAX(_internalQueueLength, 1) << "] of {_event_t} /* internal queue */" << std::endl;
- stream << "chan " << _prefix << "eQ = [" << _externalQueueLength + tolerance << "] of {_event_t} /* external queue */" << std::endl;
- if (_allowEventInterleaving)
- stream << "chan " << _prefix << "tmpQ = [" << MAX(_externalQueueLength + tolerance, 1) << "] of {_event_t} /* temporary queue for external events in transitions */" << std::endl;
- } else {
- stream << "unsigned " << _prefix << "_event : " << BIT_WIDTH(_analyzer->getEvents().size() + 1) << "; /* current event */" << std::endl;
- stream << "unsigned " << _prefix << "s : " << BIT_WIDTH(_activeConf.size() + 1) << "; /* current state */" << std::endl;
- stream << "chan " << _prefix << "iQ = [" << MAX(_internalQueueLength, 1) << "] of {int} /* internal queue */" << std::endl;
- stream << "chan " << _prefix << "eQ = [" << _externalQueueLength + tolerance << "] of {int} /* external queue */" << std::endl;
- if (_allowEventInterleaving)
- stream << "chan " << _prefix << "tmpQ = [" << MAX(_externalQueueLength + tolerance, 1) << "] of {int} /* temporary queue for external events in transitions */" << std::endl;
-// stream << "hidden unsigned " << _prefix << "tmpQItem : " << BIT_WIDTH(_analyzer->getEvents().size() + 1) << ";" << std::endl;
- }
- if (_machines.size() > 0) {
- stream << "chan " << _prefix << "start = [" << _machines.size() << "] of {int} /* nested machines to start at next macrostep */" << std::endl;
- }
-
- if (_hasIndexLessLoops)
- stream << "hidden int " << _prefix << "_index; /* helper for indexless foreach loops */" << std::endl;
-
- stream << "hidden int " << _prefix << "procid; /* the process id running this machine */" << std::endl;
- stream << "bool " << _prefix << "spontaneous; /* whether to take spontaneous transitions */" << std::endl;
- stream << "bool " << _prefix << "done; /* is the state machine stopped? */" << std::endl;
- stream << "bool " << _prefix << "canceled; /* is the state machine canceled? */" << std::endl;
-
- if (_traceTransitions)
- stream << "bool " << _prefix << "transitions[" << indexedTransitions.size() << "]; /* transitions in the optimal transition set */" << std::endl;
-
- if (_analyzer->getTypes().types.find("_ioprocessors") != _analyzer->getTypes().types.end()) {
- stream << "hidden _ioprocessors_t " << _prefix << "_ioprocessors;" << std::endl;
- _varInitializers.push_front("_ioprocessors.scxml.location = " + (_invokerid.size() > 0 ? _analyzer->macroForLiteral(_invokerid) : "1") + ";");
- }
-
- if (_prefix.size() == 0 || _prefix == "MAIN_") {
- if (_analyzer->usesEventField("sendid")) {
-// stream << "chan sendIdQ = [" << MAX(_externalQueueLength + 1, 1) << "] of {_event_t} /* temporary queue to cancel events per sendidexpr */" << std::endl;
- stream << "hidden int _lastSendId = 0; /* sequential counter for send ids */" << std::endl;
- }
-
- if (_analyzer->usesEventField("delay")) {
-#if NEW_DELAY_RESHUFFLE
-#else
- stream << "hidden int _lastSeqId = 0; /* sequential counter for delayed events */" << std::endl;
-#endif
- }
- }
-// if (_analyzer->usesPlatformVars()) {
-// stream << "_x_t _x;" << std::endl;
-// }
-
- if (_analyzer->usesInPredicate()) {
- stream << "_x_t " << _prefix << "_x;" << std::endl;
- }
-
- std::list<PromelaInline*> pmls = pmlInlines.getAllOfType(PromelaInline::PROMELA_EVENT_ALL_BUT | PromelaInline::PROMELA_EVENT_ONLY);
- for (std::list<PromelaInline*>::iterator pmlIter = pmls.begin(); pmlIter != pmls.end(); pmlIter++) {
- if ((*pmlIter)->container && LOCALNAME((*pmlIter)->container) == "invoke") {
- stream << "bool " << _prefix << ATTR_CAST((*pmlIter)->container, "id") << "Running;" << std::endl;
- }
- }
-
- stream << std::endl << std::endl;
-
- // get all data elements
- NodeSet<std::string> datas = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "data", _scxml).asNodeSet();
-
- // write their text content
- stream << "/* data model variables" << (_prefix.size() > 0 ? " for " + _prefix : "") << " */" << std::endl;
- std::set<std::string> processedIdentifiers;
-
- // automatic types
- PromelaCodeAnalyzer::PromelaTypedef allTypes = _analyzer->getTypes();
-
- for (size_t i = 0; i < datas.size(); i++) {
-
- Node<std::string> data = datas[i];
- if (isInEmbeddedDocument(data))
- continue;
-
- std::string identifier = (HAS_ATTR_CAST(data, "id") ? ATTR_CAST(data, "id") : "");
- std::string type = boost::trim_copy(HAS_ATTR_CAST(data, "type") ? ATTR_CAST(data, "type") : "");
-
- _dataModelVars.insert(identifier);
- if (processedIdentifiers.find(identifier) != processedIdentifiers.end())
- continue;
-
- processedIdentifiers.insert(identifier);
-
- if (boost::starts_with(type, "string")) {
- type = "int" + type.substr(6, type.length() - 6);
- }
-
- if (type.length() == 0 || type == "auto") {
- if (allTypes.types.find(identifier) != allTypes.types.end()) {
- type = allTypes.types[identifier].name;
- } else {
- LOG(ERROR) << "Automatic or no type for '" << identifier << "' but no type resolved";
- continue;
- }
- }
-
- std::string arrSize;
- size_t bracketPos = type.find("[");
- if (bracketPos != std::string::npos) {
- arrSize = type.substr(bracketPos, type.length() - bracketPos);
- type = type.substr(0, bracketPos);
- }
- std::string decl = type + " " + _prefix + identifier + arrSize;
- stream << decl << ";" << std::endl;
-
- }
-
-
- // implicit and dynamic types
- std::map<std::string, PromelaCodeAnalyzer::PromelaTypedef>::iterator typeIter = allTypes.types.begin();
- while(typeIter != allTypes.types.end()) {
- if (typeIter->second.occurrences.find(this) == typeIter->second.occurrences.end()) {
- typeIter++;
- continue;
- }
-
- if (processedIdentifiers.find(typeIter->first) != processedIdentifiers.end()) {
- typeIter++;
- continue;
- }
-
- if (typeIter->first == "_event" ||
- typeIter->first == "_x" ||
- typeIter->first == "_ioprocessors" ||
- typeIter->first == "_SESSIONID" ||
- typeIter->first == "_NAME") {
- typeIter++;
- continue;
- }
-
- processedIdentifiers.insert(typeIter->first);
-
- if (typeIter->second.types.size() == 0) {
- stream << "hidden " << declForRange(_prefix + typeIter->first, typeIter->second.minValue, typeIter->second.maxValue) << ";" << std::endl;
- } else {
- stream << "hidden " << _prefix << typeIter->second.name << " " << typeIter->first << ";" << std::endl;
- }
- typeIter++;
- }
-
- stream << std::endl;
-
-}
-
-void ChartToPromela::writeEventSources(std::ostream& stream) {
-}
-
-void ChartToPromela::writeStartInvoker(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, ChartToPromela* invoker, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- // set from namelist
- if (HAS_ATTR_CAST(node, "namelist")) {
- std::list<std::string> namelist = tokenize(ATTR_CAST(node, "namelist"));
- for (std::list<std::string>::iterator nlIter = namelist.begin(); nlIter != namelist.end(); nlIter++) {
- if (invoker->_dataModelVars.find(*nlIter) != invoker->_dataModelVars.end()) {
- stream << padding << invoker->_prefix << *nlIter << " = " << _prefix << *nlIter << ";" << std::endl;
- }
- }
- }
-
- // set from params
- NodeSet<std::string> invokeParams = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", node);
- for (size_t i = 0; i < invokeParams.size(); i++) {
- std::string identifier = ATTR_CAST(invokeParams[i], "name");
- std::string expression = ATTR_CAST(invokeParams[i], "expr");
- if (invoker->_dataModelVars.find(identifier) != invoker->_dataModelVars.end()) {
- stream << padding << invoker->_prefix << identifier << " = " << ADAPT_SRC(expression) << ";" << std::endl;
- }
- }
-
- stream << padding << "run " << invoker->_prefix << "run() priority 20;" << std::endl;
- if (HAS_ATTR_CAST(node, "idlocation")) {
- stream << padding << ADAPT_SRC(ATTR_CAST(node, "idlocation")) << " = " << _analyzer->macroForLiteral(invoker->_invokerid) << ";" << std::endl;
- }
-
-}
-
-void ChartToPromela::writeFSM(std::ostream& stream) {
- NodeSet<std::string> transitions;
-
- stream << "proctype " << (_prefix.size() == 0 ? "machine_" : _prefix) << "run() {" << std::endl;
- stream << " d_step {" << std::endl;
- stream << " " << _prefix << "done = false;" << std::endl;
- stream << " " << _prefix << "canceled = false;" << std::endl;
- stream << " " << _prefix << "spontaneous = true;" << std::endl;
- stream << " " << _prefix << "procid = _pid;" << std::endl;
- stream << " }" << std::endl;
- // write initial transition
-// transitions = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _startState);
-// assert(transitions.size() == 1);
-
- NodeSet<std::string> scripts = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", _scxml, false);
- if (scripts.size() > 0) {
- stream << std::endl << "/* global scripts */" << std::endl;
- for (size_t i = 0; i < scripts.size(); i++) {
- writeExecutableContent(stream, scripts[i], 1);
- }
- stream << std::endl;
- }
-
- stream << std::endl << "/* transition to initial state */" << std::endl;
- assert(_start->sortedOutgoing.size() == 1);
- // initial transition has to be first one for control flow at start
- writeTransition(stream, _start->sortedOutgoing.front(), 1);
- stream << std::endl;
-
- // every other transition
- for (std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin(); stateIter != _activeConf.end(); stateIter++) {
- for (std::list<GlobalTransition*>::iterator transIter = stateIter->second->sortedOutgoing.begin(); transIter != stateIter->second->sortedOutgoing.end(); transIter++) {
- // don't write invalid transition
- if (!(*transIter)->isValid) {
- LOG(ERROR) << "Sorted outgoing transitions contains invalid transitions - did you instruct ChartToFSM to keep those?";
- abort();
- }
-
- // don't write initial transition
- if (_start->sortedOutgoing.front() == *transIter)
- continue;
- // don't write trivial or history transitions
- if ((*transIter)->historyBase == NULL) // TODO!
-// if ((*transIter)->hasExecutableContent && (*transIter)->historyBase == NULL)
- writeTransition(stream, *transIter, 1);
- }
- _perfStatesProcessed++;
- _perfStatesTotal++;
-
- DUMP_STATS(false);
- }
- DUMP_STATS(true);
-
- stream << std::endl;
- stream << _prefix << "macroStep: skip;" << std::endl;
- if (_allowEventInterleaving) {
- stream << " /* push send events to external queue - this needs to be interleavable! */" << std::endl;
- stream << " do" << std::endl;
- if (_analyzer->usesEventField("delay")) {
-#if NEW_DELAY_RESHUFFLE
- stream << " :: len(" << _prefix << "tmpQ) != 0 -> { " << _prefix << "tmpQ?" << _prefix << "_event; " << _prefix << "eQ!" << _prefix << "_event; insertWithDelay(" << _prefix << "eQ); }" << std::endl;
-#else
- stream << " :: len(" << _prefix << "tmpQ) != 0 -> { " << _prefix << "tmpQ?" << _prefix << "_event; " << _prefix << "eQ!!" << _prefix << "_event }" << std::endl;
-#endif
- } else {
- stream << " :: len(" << _prefix << "tmpQ) != 0 -> { " << _prefix << "tmpQ?" << _prefix << "_event; " << _prefix << "eQ!" << _prefix << "_event }" << std::endl;
- }
- stream << " :: else -> break;" << std::endl;
- stream << " od;" << std::endl << std::endl;
- }
-
- if (_machines.size() > 0) {
- stream << " /* start pending invokers */" << std::endl;
- stream << " int invokerId;" << std::endl;
- stream << " do" << std::endl;
- stream << " :: " << _prefix << "start?invokerId -> {" << std::endl;
- stream << " if " << std::endl;
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator machIter = _machines.begin(); machIter != _machines.end(); machIter++) {
- stream << " :: invokerId == " << _analyzer->macroForLiteral(machIter->second->_invokerid) << " -> {" << std::endl;
- writeStartInvoker(stream, machIter->first, machIter->second, 3);
- stream << " }" << std::endl;
- }
- stream << " :: else -> skip; " << std::endl;
- stream << " fi " << std::endl;
- stream << " }" << std::endl;
- stream << " :: else -> break;" << std::endl;
- stream << " od" << std::endl << std::endl;
- }
-
- if (_analyzer->usesEventField("delay") && _machinesAll->size() > 1) {
- stream << "/* Determine machines with smallest delay and set their process priority */" << std::endl;
- stream << " scheduleMachines();" << std::endl << std::endl;
- }
-
- std::list<PromelaInline*> eventSources = pmlInlines.getAllOfType(PromelaInline::PROMELA_EVENT_ALL_BUT |
- PromelaInline::PROMELA_EVENT_ONLY);
-
- stream << " atomic {" << std::endl;
- stream << "/* pop an event */" << std::endl;
- stream << " if" << std::endl;
- stream << " :: len(" << _prefix << "iQ) != 0 -> " << _prefix << "iQ ? " << _prefix << "_event /* from internal queue */" << std::endl;
- if (eventSources.size() > 0) {
- stream << " :: len(" << _prefix << "eQ) != 0 -> " << _prefix << "eQ ? " << _prefix << "_event /* from external queue */" << std::endl;
- stream << " :: else -> {" << std::endl;
- stream << " /* external queue is empty -> automatically enqueue external event */" << std::endl;
- stream << " if" << std::endl;
-
- for (std::list<PromelaInline*>::iterator esIter = eventSources.begin(); esIter != eventSources.end(); esIter++) {
- PromelaEventSource es(**esIter);
-
- std::string condition = "true";
-
- if (LOCALNAME(es.container) == "invoke") {
- if (HAS_ATTR_CAST(es.container, "id")) {
- condition = _prefix + ATTR_CAST(es.container, "id") + "Running";
- } else {
- LOG(ERROR) << "Invoker has no id";
- }
- } else if (HAS_ATTR(es.container, "id")) {
- condition = _prefix + "_x.states[" + _analyzer->macroForLiteral(ATTR(es.container, "id")) + "]";
- }
- stream << " :: " << condition << " -> {" << std::endl;
-
- if (es.type == PromelaInline::PROMELA_EVENT_ALL_BUT) {
- std::string excludeEventDescs;
- for (std::list<Data>::iterator evIter = es.events.array.begin(); evIter != es.events.array.end(); evIter++) {
- excludeEventDescs += " " + evIter->atom;
- }
-
- NodeSet<std::string> transitions = DOMUtils::filterChildElements("transition", es.container, true);
- std::set<std::string> eventNames;
- for (size_t i = 0; i < transitions.size(); i++) {
- if (!HAS_ATTR_CAST(transitions[i], "event"))
- continue;
- if (HAS_ATTR_CAST(transitions[i], "cond") && ATTR_CAST(transitions[i], "cond").find("_event.") != std::string::npos)
- continue;
- std::list<std::string> events = tokenize(ATTR_CAST(transitions[i], "event"));
- for (std::list<std::string>::iterator evIter = events.begin(); evIter != events.end(); evIter++) {
- std::string eventName = *evIter;
- if (boost::ends_with(eventName, "*"))
- eventName = eventName.substr(0, eventName.size() - 1);
- if (boost::ends_with(eventName, "."))
- eventName = eventName.substr(0, eventName.size() - 1);
-
- // is this event excluded?
- if (!nameMatch(excludeEventDescs, eventName)) {
- eventNames.insert(eventName);
- }
- }
- }
-
- if (eventNames.size() > 0) {
- stream << " if " << std::endl;
- for (std::set<std::string>::iterator evIter = eventNames.begin(); evIter != eventNames.end(); evIter++) {
- stream << " :: true -> { " << _prefix << "_event" << (_analyzer->usesComplexEventStruct() ? ".name" : "")<< " = " << _analyzer->macroForLiteral(*evIter) << " }" << std::endl;
- }
- stream << " fi " << std::endl;
- }
-
- } else if (es.type == PromelaInline::PROMELA_EVENT_ONLY) {
- if (es.events.array.size() > 0) {
- stream << " if " << std::endl;
- for (std::list<Data>::iterator evIter = es.events.array.begin(); evIter != es.events.array.end(); evIter++) {
- stream << " :: true -> { " << std::endl;
- stream << dataToAssignments(" _event", *evIter);
- stream << " } " << std::endl;
- }
- stream << " fi " << std::endl;
- } else {
- stream << dataToAssignments(" _event", es.events);
- }
- } else {
- assert(false);
- }
- stream << " }" << std::endl;
- }
-
- stream << " fi" << std::endl;
- stream << " }" << std::endl;
- } else {
- stream << " :: else -> " << _prefix << "eQ ? " << _prefix << "_event /* from external queue */" << std::endl;
- }
- stream << " fi;" << std::endl << std::endl;
-
-
- stream << "/* terminate if we are stopped */" << std::endl;
- stream << " if" << std::endl;
- stream << " :: " << _prefix << "done -> goto " << _prefix << "terminate;" << std::endl;
- if (_parent != NULL) {
- stream << " :: " << _prefix << "canceled -> goto " << _prefix << "cancel;" << std::endl;
- }
- stream << " :: else -> skip;" << std::endl;
- stream << " fi;" << std::endl << std::endl;
-
- {
- bool finalizeFound = false;
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator invIter = _machines.begin(); invIter != _machines.end(); invIter++) {
- NodeSet<std::string> finalizes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invIter->first, false);
- if (finalizes.size() > 0) {
- finalizeFound = true;
- break;
- }
- }
- if (finalizeFound) {
- stream << "/* <finalize> event */" << std::endl;
- stream << " if" << std::endl;
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator invIter = _machines.begin(); invIter != _machines.end(); invIter++) {
- NodeSet<std::string> finalizes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invIter->first, false);
- if (finalizes.size() > 0) {
- stream << " :: " << _prefix << "_event.invokeid == " << _analyzer->macroForLiteral(invIter->second->_invokerid) << " -> {" << std::endl;
- writeExecutableContent(stream, finalizes[0], 3);
- stream << " } " << std::endl;
- }
- }
- stream << " :: else -> skip;" << std::endl;
- stream << " fi;" << std::endl << std::endl;
- }
- }
-
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator invIter = _machines.begin(); invIter != _machines.end(); invIter++) {
- if (invIter->second == this) {
- continue;
- }
- //std::cout << invIter->first << std::endl;
- if (stringIsTrue(ATTR_CAST(invIter->first, "autoforward"))) {
- stream << "/* autoforward event to " << invIter->second->_invokerid << " invokers */" << std::endl;
- stream << " if" << std::endl;
- stream << " :: " << invIter->second->_prefix << "done -> skip;" << std::endl;
- stream << " :: " << invIter->second->_prefix << "canceled -> skip;" << std::endl;
-#if NEW_DELAY_RESHUFFLE
- stream << " :: else -> { " << invIter->second->_prefix << "eQ!" << _prefix << "_event" << "; insertWithDelay(" << invIter->second->_prefix << "eQ" << "); }" << std::endl;
-#else
- stream << " :: else -> { " << invIter->second->_prefix << "eQ!!" << _prefix << "_event" << " }" << std::endl;
-#endif
- stream << " fi;" << std::endl << std::endl;
-
- }
- }
- stream << std::endl;
-
- stream << _prefix << "microStep:" << std::endl;
- stream << "/* event dispatching per state */" << std::endl;
- stream << " if" << std::endl;
-
- writeEventDispatching(stream);
-
- stream << "/* this is an error as we dispatched all valid states */" << std::endl;
- stream << " :: else -> assert(false);" << std::endl;
- stream << " fi;" << std::endl;
- stream << std::endl;
- stream << _prefix << "terminate: skip;" << std::endl;
-
- if (_parent != NULL) {
- stream << " {" << std::endl;
- stream << _analyzer->getTypeReset("tmpE", _analyzer->getType("_event"), " ");
- stream << " tmpE.name = " << _analyzer->macroForLiteral("done.invoke." + _invokerid) << ";" << std::endl;
- if (_invokerid.length() > 0) {
- stream << " tmpE.invokeid = " << _analyzer->macroForLiteral(_invokerid) << ";" << std::endl;
- }
- if (_analyzer->usesEventField("delay")) {
-#if NEW_DELAY_RESHUFFLE
- stream << " " << _parent->_prefix << "eQ!tmpE;" << std::endl;
- stream << " insertWithDelay(" << _parent->_prefix << "eQ);" << std::endl;
-
-#else
- stream << " _lastSeqId = _lastSeqId + 1;" << std::endl;
- stream << " tmpE.seqNr = _lastSeqId;" << std::endl;
- stream << " " << _parent->_prefix << "eQ!!tmpE;" << std::endl;
-#endif
- } else {
- stream << " " << _parent->_prefix << "eQ!tmpE;" << std::endl;
- }
- stream << " }" << std::endl;
- stream << _prefix << "cancel: skip;" << std::endl;
- if (_analyzer->usesEventField("delay"))
- stream << " removePendingEventsForInvoker(" << _analyzer->macroForLiteral(this->_invokerid) << ")" << std::endl;
- }
-
- stream << " }" << std::endl;
- stream << "}" << std::endl;
-}
-
-void ChartToPromela::writeRescheduleProcess(std::ostream& stream, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- if (_allowEventInterleaving) {
- stream << padding << "inline rescheduleProcess(smallestDelay, procId, internalQ, externalQ, tempQ) {" << std::endl;
- } else {
- stream << padding << "inline rescheduleProcess(smallestDelay, procId, internalQ, externalQ) {" << std::endl;
- }
-// stream << _analyzer->getTypeReset("tmpE", _analyzer->getType("_event"), " ");
-
- stream << padding << " set_priority(procId, 1);" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: len(internalQ) > 0 -> set_priority(procId, 10);" << std::endl;
- stream << padding << " :: else {" << std::endl;
- stream << padding << " if" << std::endl;
-
- stream << padding << " :: len(externalQ) > 0 -> {" << std::endl;
- stream << padding << " externalQ?<tmpE>;" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: smallestDelay == tmpE.delay -> set_priority(procId, 10);" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << " }" << std::endl;
-
- if (_allowEventInterleaving) {
- stream << padding << " :: len(tempQ) > 0 -> {" << std::endl;
- stream << padding << " tempQ?<tmpE>;" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: smallestDelay == tmpE.delay -> set_priority(procId, 10);" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << " }" << std::endl;
- }
-
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << "}" << std::endl;
-}
-
-void ChartToPromela::writeDetermineShortestDelay(std::ostream& stream, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- stream << padding << "inline determineSmallestDelay(smallestDelay, queue) {" << std::endl;
-// stream << padding << _analyzer->getTypeReset("tmpE", _analyzer->getType("_event"), " ");
- stream << padding << " if" << std::endl;
- stream << padding << " :: len(queue) > 0 -> {" << std::endl;
- stream << padding << " queue?<tmpE>;" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: (tmpE.delay < smallestDelay) -> { smallestDelay = tmpE.delay; }" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << "}" << std::endl;
-}
-
-void ChartToPromela::writeInsertWithDelay(std::ostream& stream, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- uint32_t maxExternalQueueLength = 1;
- std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator machineIter = _machinesAll->begin();
- while(machineIter != _machinesAll->end()) {
- maxExternalQueueLength = MAX(maxExternalQueueLength, machineIter->second->_externalQueueLength);
- machineIter++;
- }
-
- maxExternalQueueLength += 6;
-
- if (maxExternalQueueLength <= 1) {
- stream << padding << "/* noop for external queues with length <= 1 */" << std::endl;
- stream << padding << "inline insertWithDelay(queue) {}" << std::endl;
- }
-
- stream << padding << "hidden _event_t _iwdQ[" << maxExternalQueueLength - 1 << "];" << std::endl;
- stream << padding << "hidden int _iwdQLength = 0;" << std::endl;
- stream << padding << "hidden int _iwdIdx1 = 0;" << std::endl;
- stream << padding << "hidden int _iwdIdx2 = 0;" << std::endl;
- stream << padding << "hidden _event_t _iwdTmpE;" << std::endl;
- stream << padding << "hidden _event_t _iwdLastE;" << std::endl;
- stream << padding << "bool _iwdInserted = false;" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << "/* last event in given queue is potentially at wrong position */" << std::endl;
- stream << padding << "inline insertWithDelay(queue) {" << std::endl;
- stream << padding << " d_step {" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " /* only process for non-trivial queues */" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: len(queue) > 1 -> {" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " /* move all events but last over and remember the last one */" << std::endl;
- stream << padding << " _iwdIdx1 = 0;" << std::endl;
- stream << padding << " _iwdQLength = len(queue) - 1;" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " do" << std::endl;
- stream << padding << " :: _iwdIdx1 < _iwdQLength -> {" << std::endl;
- stream << padding << " queue?_iwdTmpE;" << std::endl;
- stream << padding << " _iwdQ[_iwdIdx1].name = _iwdTmpE.name;" << std::endl;
-
- stream << _analyzer->getTypeAssignment("_iwdQ[_iwdIdx1]", "_iwdTmpE", _analyzer->getType("_event"), padding + " ");
-
- stream << padding << " _iwdIdx1++;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " :: else -> break;" << std::endl;
- stream << padding << " od" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " queue?_iwdLastE;" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " /* _iwdQ now contains all but last item in _iwdLastE */" << std::endl;
- stream << padding << " assert(len(queue) == 0);" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " /* reinsert into queue and place _iwdLastE correctly */" << std::endl;
- stream << padding << " _iwdInserted = false;" << std::endl;
- stream << padding << " _iwdIdx2 = 0;" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " do" << std::endl;
- stream << padding << " :: _iwdIdx2 < _iwdIdx1 -> {" << std::endl;
- stream << padding << " _iwdTmpE.name = _iwdQ[_iwdIdx2].name;" << std::endl;
-
- stream << _analyzer->getTypeAssignment("_iwdTmpE", "_iwdQ[_iwdIdx2]", _analyzer->getType("_event"), padding + " ");
-
- stream << padding << "" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: _iwdTmpE.delay > _iwdLastE.delay -> {" << std::endl;
- stream << padding << " queue!_iwdLastE;" << std::endl;
- stream << padding << " _iwdInserted = true;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " :: else -> skip" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " queue!_iwdTmpE;" << std::endl;
- stream << padding << " _iwdIdx2++;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " :: else -> break;" << std::endl;
- stream << padding << " od" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: !_iwdInserted -> queue!_iwdLastE;" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << "" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << "}" << std::endl;
-}
-
-void ChartToPromela::writeAdvanceTime(std::ostream& stream, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- stream << padding << "inline advanceTime(increment, queue) {" << std::endl;
- stream << padding << " tmpIndex = 0;" << std::endl;
- stream << padding << " do" << std::endl;
- stream << padding << " :: tmpIndex < len(queue) -> {" << std::endl;
- stream << padding << " queue?tmpE;" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: tmpE.delay >= increment -> tmpE.delay = tmpE.delay - increment;" << std::endl;
- stream << padding << " :: else -> skip;" << std::endl;
- stream << padding << " fi" << std::endl;
- stream << padding << " queue!tmpE;" << std::endl;
- stream << padding << " tmpIndex++;" << std::endl;
- stream << padding << " }" << std::endl;
- stream << padding << " :: else -> break;" << std::endl;
- stream << padding << " od" << std::endl;
- stream << padding << "}" << std::endl;
-}
-
-void ChartToPromela::writeRemovePendingEventsFromInvoker(std::ostream& stream, int indent) {
- std::list<std::string> queues;
- queues.push_back("eQ");
- if (_allowEventInterleaving)
- queues.push_back("tmpQ");
-
- stream << "inline removePendingEventsForInvoker(invokeIdentifier) {" << std::endl;
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator queueIter = _machinesAll->begin(); queueIter != _machinesAll->end(); queueIter++) {
- for (std::list<std::string>::iterator qIter = queues.begin(); qIter != queues.end(); qIter++) {
- stream << " removePendingEventsForInvokerOnQueue(invokeIdentifier, " << queueIter->second->_prefix << *qIter << ");" << std::endl;
- }
- }
- stream << "}" << std::endl;
- stream << std::endl;
-
- stream << "inline removePendingEventsForInvokerOnQueue(invokeIdentifier, queue) {" << std::endl;
- stream << " tmpIndex = 0;" << std::endl;
-// stream << _analyzer->getTypeReset("tmpE", _analyzer->getType("_event"), " ");
- stream << " do" << std::endl;
- stream << " :: tmpIndex < len(queue) -> {" << std::endl;
- stream << " queue?tmpE;" << std::endl;
- stream << " if" << std::endl;
- stream << " :: tmpE.delay == 0 || tmpE.invokeid != invokeIdentifier -> queue!tmpE;" << std::endl;
- stream << " :: else -> skip;" << std::endl;
- stream << " fi" << std::endl;
- stream << " tmpIndex++;" << std::endl;
- stream << " }" << std::endl;
- stream << " :: else -> break;" << std::endl;
- stream << " od" << std::endl;
- stream << "}" << std::endl;
-}
-
-void ChartToPromela::writeCancelEvents(std::ostream& stream, int indent) {
- std::list<std::string> queues;
- queues.push_back("eQ");
- if (_allowEventInterleaving)
- queues.push_back("tmpQ");
-
- stream << "inline cancelSendId(sendIdentifier, invokerIdentifier) {" << std::endl;
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator queueIter = _machinesAll->begin(); queueIter != _machinesAll->end(); queueIter++) {
- for (std::list<std::string>::iterator qIter = queues.begin(); qIter != queues.end(); qIter++) {
- stream << " cancelSendIdOnQueue(sendIdentifier, " << queueIter->second->_prefix << *qIter << ", invokerIdentifier);" << std::endl;
- }
- }
- stream << "}" << std::endl;
- stream << std::endl;
-
-
- stream << "inline cancelSendIdOnQueue(sendIdentifier, queue, invokerIdentifier) {" << std::endl;
- stream << " tmpIndex = 0;" << std::endl;
-// stream << _analyzer->getTypeReset("tmpE", _analyzer->getType("_event"), " ");
- stream << " do" << std::endl;
- stream << " :: tmpIndex < len(queue) -> {" << std::endl;
- stream << " queue?tmpE;" << std::endl;
- stream << " if" << std::endl;
- stream << " :: tmpE.invokeid != invokerIdentifier || tmpE.sendid != sendIdentifier || tmpE.delay == 0 -> queue!tmpE;" << std::endl;
- stream << " :: else -> skip;" << std::endl;
- stream << " fi" << std::endl;
- stream << " tmpIndex++;" << std::endl;
- stream << " }" << std::endl;
- stream << " :: else -> break;" << std::endl;
- stream << " od" << std::endl;
- stream << "}" << std::endl;
-}
-
-void ChartToPromela::writeScheduleMachines(std::ostream& stream, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- stream << padding << "inline scheduleMachines() {" << std::endl;
- std::list<std::string> queues;
- queues.push_back("eQ");
-
- if (_allowEventInterleaving)
- queues.push_back("tmpQ");
-
- stream << " /* schedule state-machines with regard to their event's delay */" << std::endl;
- stream << " skip;" << std::endl;
- stream << " d_step {" << std::endl;
-
- stream << std::endl << "/* determine smallest delay */" << std::endl;
- stream << " int smallestDelay = 2147483647;" << std::endl;
-
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator queueIter = _machinesAll->begin(); queueIter != _machinesAll->end(); queueIter++) {
- for (std::list<std::string>::iterator qIter = queues.begin(); qIter != queues.end(); qIter++) {
- stream << " determineSmallestDelay(smallestDelay, " << queueIter->second->_prefix << *qIter << ");" << std::endl;
- }
- }
- // stream << " printf(\"======= Lowest delay is %d\\n\", smallestDelay);" << std::endl;
-
- stream << std::endl << "/* prioritize processes with lowest delay or internal events */" << std::endl;
-
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator queueIter = _machinesAll->begin(); queueIter != _machinesAll->end(); queueIter++) {
- stream << " rescheduleProcess(smallestDelay, "
- << queueIter->second->_prefix << "procid, "
- << queueIter->second->_prefix << "iQ, "
- << queueIter->second->_prefix << "eQ";
- if (_allowEventInterleaving) {
- stream << ", " << queueIter->second->_prefix << "tmpQ);" << std::endl;
- } else {
- stream << ");" << std::endl;
- }
- }
-
- stream << std::endl << "/* advance time by subtracting the smallest delay from all event delays */" << std::endl;
- stream << " if" << std::endl;
- stream << " :: (smallestDelay > 0) -> {" << std::endl;
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator queueIter = _machinesAll->begin(); queueIter != _machinesAll->end(); queueIter++) {
- for (std::list<std::string>::iterator qIter = queues.begin(); qIter != queues.end(); qIter++) {
- stream << " advanceTime(smallestDelay, " << queueIter->second->_prefix << *qIter << ");" << std::endl;
- }
- }
- stream << " }" << std::endl;
- stream << " :: else -> skip;" << std::endl;
- stream << " fi;" << std::endl;
- stream << " }" << std::endl;
- stream << " set_priority(_pid, 10);" << std::endl << std::endl;
- stream << padding << "}" << std::endl;
-}
-
-void ChartToPromela::writeEventDispatching(std::ostream& stream) {
- for (std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin(); stateIter != _activeConf.end(); stateIter++) {
-
- const std::string& stateId = stateIter->first;
- const GlobalState* state = stateIter->second;
-
- stream << std::endl << "/* ### current state ";
- FlatStateIdentifier flatActiveSource(stateId);
- PRETTY_PRINT_LIST(stream, flatActiveSource.getActive());
- stream << " ######################## */" << std::endl;
-
- stream << " :: (" << _prefix << "s == s" << state->activeIndex << ") -> {" << std::endl;
-
- writeDispatchingBlock(stream, state->sortedOutgoing, 3);
- stream << " }" << std::endl;
- }
-}
-
-void ChartToPromela::writeDispatchingBlock(std::ostream& stream, std::list<GlobalTransition*> transitions, int indent) {
- std::string padding;
- for (size_t i = 0; i < indent; i++) {
- padding += " ";
- }
-
- if (transitions.size() == 0) {
- stream << "/* no transition applicable */" << std::endl;
- stream << padding << _prefix << "spontaneous = false;" << std::endl;
- stream << padding << "goto " << _prefix << "macroStep;" << std::endl;
- return;
- }
-
-
- GlobalTransition* currTrans = transitions.front();
- transitions.pop_front();
-
- stream << padding << "if" << std::endl;
-
- if (currTrans->condition.size() > 0) {
- stream << padding << ":: ((";
- } else {
- stream << padding << ":: (";
- }
-
- if (currTrans->isEventless) {
- stream << _prefix << "spontaneous";
- } else {
- std::string eventDescs = currTrans->eventDesc;
-
- std::list<std::string> eventNames = tokenize(eventDescs);
- std::set<std::string> eventPrefixes;
- std::list<std::string>::iterator eventNameIter = eventNames.begin();
- while(eventNameIter != eventNames.end()) {
- std::string eventDesc = *eventNameIter;
- if (boost::ends_with(eventDesc, "*"))
- eventDesc = eventDesc.substr(0, eventDesc.size() - 1);
- if (boost::ends_with(eventDesc, "."))
- eventDesc = eventDesc.substr(0, eventDesc.size() - 1);
- if (eventDesc.length() > 0) {
- std::set<std::string> tmp = _analyzer->getEventsWithPrefix(*eventNameIter);
- eventPrefixes.insert(tmp.begin(), tmp.end());
- }
- eventNameIter++;
- }
-
- if (eventPrefixes.size() > 0) {
- stream << "!" << _prefix << "spontaneous";
- } else {
- stream << "!" << _prefix << "spontaneous";
- }
-
- if (eventPrefixes.size() > 0)
- stream << " &&";
-
- if (eventPrefixes.size() > 1)
- stream << " (";
-
- std::string seperator;
- std::set<std::string>::iterator eventIter = eventPrefixes.begin();
- while(eventIter != eventPrefixes.end()) {
- if (_analyzer->usesComplexEventStruct()) {
- stream << seperator << " " << _prefix << "_event.name == " << _analyzer->macroForLiteral(*eventIter);
- } else {
- stream << seperator << " " << _prefix << "_event == " << _analyzer->macroForLiteral(*eventIter);
- }
- seperator = " || ";
- eventIter++;
- }
-
- if (eventPrefixes.size() > 1)
- stream << ")";
-
- }
-
- stream << ")";
- if (currTrans->condition.size() > 0) {
- stream << " && (" + ADAPT_SRC(currTrans->condition) + "))";
- }
- if (currTrans->hasExecutableContent || currTrans->historyTrans.size() > 0) {
- stream << " -> { " << std::endl;
- if (!envVarIsTrue("USCXML_ANNOTATE_NOCOMMENT")) {
- stream << "/* transition to ";
- FlatStateIdentifier flatActiveSource(currTrans->activeDestination);
- PRETTY_PRINT_LIST(stream, flatActiveSource.getActive());
- stream << " */" << std::endl;
- }
-
- if (_traceTransitions) {
- for (std::set<int>::iterator transRefIter = currTrans->transitionRefs.begin(); transRefIter != currTrans->transitionRefs.end(); transRefIter++) {
- stream << padding << " " << _prefix << "transitions[" << *transRefIter << "] = true; " << std::endl;
- }
- }
-
- stream << padding << " goto " << _prefix << "t" << currTrans->index << ";" << std::endl;
- stream << padding << "}" << std::endl;
-
- } else {
-
- stream << " -> {" << std::endl;
- GlobalState* newState = _activeConf[currTrans->activeDestination];
- assert(newState != NULL);
-
- if (!envVarIsTrue("USCXML_ANNOTATE_NOCOMMENT")) {
- stream << "/* new state ";
- FlatStateIdentifier flatActiveDest(currTrans->activeDestination);
- PRETTY_PRINT_LIST(stream, flatActiveDest.getActive());
- stream << " */" << std::endl;
- }
- stream << padding << " " << _prefix << "s = s" << newState->activeIndex << ";" << std::endl;
-
- TRANSITION_TRACE(currTrans, false);
- writeTransitionClosure(stream, currTrans, newState, indent + 1);
- stream << padding << "}" << std::endl;
- }
-
- stream << padding << ":: else -> {" << std::endl;
-
- writeDispatchingBlock(stream, transitions, indent + 1);
-
- stream << padding << "}" << std::endl;
- stream << padding << "fi;" << std::endl;
-}
-
-void ChartToPromela::writeMain(std::ostream& stream) {
- stream << std::endl;
- stream << "init {" << std::endl;
- if (_varInitializers.size() > 0) {
- stream << "/* initialize data model variables */" << std::endl;
- std::list<std::string>::iterator initIter = _varInitializers.begin();
- while(initIter != _varInitializers.end()) {
- stream << ADAPT_SRC(beautifyIndentation(*initIter, 1)) << std::endl;
- initIter++;
- }
- stream << std::endl;
- }
-
- stream << " run " << (_prefix.size() == 0 ? "machine_" : _prefix) << "run() priority 10;" << std::endl;
- stream << "}" << std::endl;
-
-}
-
-
-void ChartToPromela::initNodes() {
- // some things we share with our invokers
- if (_analyzer == NULL)
- _analyzer = new PromelaCodeAnalyzer();
-
- if (_machinesAll == NULL) {
- _machinesAll = new std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>();
- (*_machinesAll)[_scxml] = this;
- }
-
- if (_machinesAllPerId == NULL)
- _machinesAllPerId = new std::map<std::string, Arabica::DOM::Node<std::string> >();
-
- if (_parentTopMost == NULL)
- _parentTopMost = this;
-
- _internalQueueLength = getMinInternalQueueLength(MSG_QUEUE_LENGTH);
- _externalQueueLength = getMinExternalQueueLength(MSG_QUEUE_LENGTH);
-
- // get all states
- NodeSet<std::string> states = getAllStates();
- for (size_t i = 0; i < states.size(); i++) {
- if (InterpreterImpl::isInEmbeddedDocument(states[i]))
- continue;
- Element<std::string> stateElem(states[i]);
- _analyzer->addOrigState(ATTR(stateElem, "id"));
- if (isCompound(stateElem) || isParallel(stateElem)) {
- _analyzer->addEvent("done.state." + ATTR(stateElem, "id"));
- }
- }
-
- {
- // shorten UUID ids at invokers for readability
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
- invokes.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "uninvoke", _scxml, true));
-
- // make sure all invokers have an id!
- for (size_t i = 0; i < invokes.size(); i++) {
- if (!HAS_ATTR_CAST(invokes[i], "id")) {
- Element<std::string> invokeElem(invokes[i]);
- invokeElem.setAttribute("id", "INV_" + UUID::getUUID().substr(0,5));
- } else if (HAS_ATTR_CAST(invokes[i], "id") && UUID::isUUID(ATTR_CAST(invokes[i], "id"))) {
- // shorten UUIDs
- Element<std::string> invokeElem(invokes[i]);
- invokeElem.setAttribute("id", "INV_" + ATTR_CAST(invokes[i], "id").substr(0,5));
- }
- }
-
- }
-
- // are there nestes SCXML invokers?
- {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
- for (size_t i = 0; i < invokes.size(); i++) {
- if (!HAS_ATTR_CAST(invokes[i], "type") ||
- ATTR_CAST(invokes[i], "type") == "scxml" ||
- ATTR_CAST(invokes[i], "type") == "http://www.w3.org/TR/scxml/#SCXMLEventProcessor" ||
- ATTR_CAST(invokes[i], "type") == "http://www.w3.org/TR/scxml/") {
- assert(HAS_ATTR_CAST(invokes[i], "id"));
- Element<std::string>(invokes[i]).setAttribute("name", ATTR_CAST(invokes[i], "id"));
-
- _prefix = "MAIN_";
- Interpreter nested;
- if (HAS_ATTR_CAST(invokes[i], "src")) {
- URL absUrl(ATTR_CAST(invokes[i], "src"));
- absUrl.toAbsolute(_baseURL[_scxml]);
- nested = Interpreter::fromURL(absUrl);
-
- } else {
- NodeSet<std::string> nestedContent = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", invokes[i]);
- assert(nestedContent.size() == 1);
- NodeSet<std::string> nestedRoot = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "scxml", nestedContent[0]);
- assert(nestedRoot.size() == 1);
-
- DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Document<std::string> nestedDoc = domFactory.createDocument(_scxml.getOwnerDocument().getNamespaceURI(), "", 0);
- Node<std::string> importRoot = nestedDoc.importNode(nestedRoot[0], true);
- nestedDoc.appendChild(importRoot);
-
- nested = Interpreter::fromDOM(nestedDoc, _nsInfo, _sourceURL);
- }
-
-// std::cout << invokes[i] << std::endl;
-
- // we found machines but have no prefix
- if (_prefix.length() == 0)
- _prefix = "MAIN_";
-
- _machines[invokes[i]] = new ChartToPromela(nested);
- _machines[invokes[i]]->_analyzer = _analyzer;
- _machines[invokes[i]]->_parent = this;
- _machines[invokes[i]]->_parentTopMost = _parentTopMost;
- _machines[invokes[i]]->_machinesAll = _machinesAll;
- (*_machinesAll)[invokes[i]] = _machines[invokes[i]];
-
- _machines[invokes[i]]->_invokerid = ATTR_CAST(invokes[i], "id");
- _machines[invokes[i]]->_prefix = ATTR_CAST(invokes[i], "id") + "_";
-
- _analyzer->addLiteral(_machines[invokes[i]]->_invokerid);
- _analyzer->addEvent("done.invoke." + _machines[invokes[i]]->_invokerid);
-
- _machinesPerId[ATTR_CAST(invokes[i], "id")] = invokes[i];
- (*_machinesAllPerId)[ATTR_CAST(invokes[i], "id")] = invokes[i];
- }
- }
- }
-
- if (_machines.size() > 0) {
- _analyzer->addCode("_event.invokeid", this);
- }
-
- // gather all potential members per history
- std::map<std::string, Arabica::DOM::Element<std::string> >::iterator histIter = _historyTargets.begin();
- while(histIter != _historyTargets.end()) {
- NodeSet<std::string> histStatesMembers;
- bool isDeep = (HAS_ATTR_CAST(histIter->second, "type") && ATTR_CAST(histIter->second, "type") == "deep");
- histStatesMembers.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "state", histIter->second.getParentNode(), isDeep));
- histStatesMembers.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "parallel", histIter->second.getParentNode(), isDeep));
- histStatesMembers.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "final", histIter->second.getParentNode(), isDeep));
-
- for (size_t i = 0; i < histStatesMembers.size(); i++) {
- _historyMembers[histIter->first].insert(std::make_pair(ATTR_CAST(histStatesMembers[i], "id"), i));
- }
- histIter++;
- }
-
- // initialize event trie with all events that might occur
- NodeSet<std::string> internalEventNames;
- internalEventNames.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "transition", _scxml).asNodeSet());
- internalEventNames.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "raise", _scxml).asNodeSet());
- internalEventNames.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "send", _scxml).asNodeSet());
-
- for (size_t i = 0; i < internalEventNames.size(); i++) {
- if (HAS_ATTR_CAST(internalEventNames[i], "event")) {
- std::string eventNames = ATTR_CAST(internalEventNames[i], "event");
- std::list<std::string> events = tokenize(eventNames);
- for (std::list<std::string>::iterator eventIter = events.begin();
- eventIter != events.end(); eventIter++) {
- std::string eventName = *eventIter;
- if (boost::ends_with(eventName, "*"))
- eventName = eventName.substr(0, eventName.size() - 1);
- if (boost::ends_with(eventName, "."))
- eventName = eventName.substr(0, eventName.size() - 1);
- if (eventName.size() > 0)
- _analyzer->addEvent(eventName);
- }
- }
- }
-
-// _analyzer->addCode("bumpDownArrow = 1; _event.foo = 3; forgetSelectedServer = 1;", this);
-// exit(0);
-
- // transform data / assign json into PROMELA statements
- {
- NodeSet<std::string> asgn;
- asgn.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", _scxml, true));
- asgn.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "assign", _scxml, true));
-
- for (size_t i = 0; i < asgn.size(); i++) {
- if (isInEmbeddedDocument(asgn[i]))
- continue;
-
- Element<std::string> asgnElem(asgn[i]);
-
- std::string key;
- if (HAS_ATTR(asgnElem, "id")) {
- key = ATTR(asgnElem, "id");
- } else if (HAS_ATTR(asgnElem, "location")) {
- key = ATTR(asgnElem, "location");
- }
-
- if (key.length() == 0)
- continue;
-
- std::string value;
- if (HAS_ATTR(asgnElem, "expr")) {
- value = ATTR(asgnElem, "expr");
- } else if (HAS_ATTR(asgnElem, "src")) {
- URL absUrl(ATTR_CAST(asgnElem, "src"));
- absUrl.toAbsolute(_baseURL[_scxml]);
- value = absUrl.getInContent();
- } else {
- NodeSet<std::string> textChilds = DOMUtils::filterChildType(Node_base::TEXT_NODE, asgnElem);
- if (textChilds.size() > 0) {
- for (size_t j = 0; j < textChilds.size(); j++) {
- value += textChilds[j].getNodeValue();
- }
- }
- }
-
- boost::trim(value);
- if (value.size() == 0)
- continue;
-
- // remove all children, we will replae by suitable promela statements
- while(asgnElem.hasChildNodes())
- asgnElem.removeChild(asgnElem.getFirstChild());
-
- std::string newValue;
- Data json = Data::fromJSON(value);
- if (!json.empty()) {
- newValue = dataToAssignments(key, json);
- } else {
- newValue = key + " = " + value + ";";
- }
- newValue = sanitizeCode(newValue);
- _analyzer->addCode(newValue, this);
-
- if (asgnElem.getLocalName() == "data")
- _varInitializers.push_back(newValue);
- Text<std::string> newText = _document.createTextNode(newValue);
- asgnElem.insertBefore(newText, Node<std::string>());
- }
- }
-
- // do we need sendid / invokeid?
- {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
- NodeSet<std::string> sends = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "send", _scxml, true);
- NodeSet<std::string> cancels = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "cancel", _scxml, true);
-
- if (cancels.size() > 0) {
- _analyzer->addCode("_event.invokeid", this);
- }
-
- for (size_t i = 0; i < sends.size(); i++) {
- if (HAS_ATTR_CAST(sends[i], "idlocation")) {
- _analyzer->addCode("_event.sendid", this);
- }
- if (HAS_ATTR_CAST(sends[i], "id")) {
- _analyzer->addLiteral(ATTR_CAST(sends[i], "id"));
- _analyzer->addCode("_event.sendid", this);
- }
- }
-
- // do we need delays?
- for (size_t i = 0; i < sends.size(); i++) {
- if (HAS_ATTR_CAST(sends[i], "delay") || HAS_ATTR_CAST(sends[i], "delayexpr")) {
- _analyzer->addCode("_event.delay", this);
-#if NEW_DELAY_RESHUFFLE
-#else
- _analyzer->addCode("_event.seqNr", this);
-#endif
- }
- }
- }
-
- {
- // string literals for raise / send content
- NodeSet<std::string> withContent;
- withContent.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "send", _scxml, true));
- withContent.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "raise", _scxml, true));
-
- for (size_t i = 0; i < withContent.size(); i++) {
- NodeSet<std::string> content = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", withContent[i], true);
- for (size_t j = 0; j < content.size(); j++) {
- Element<std::string> contentElem(content[j]);
- std::string content = spaceNormalize(contentElem.getFirstChild().getNodeValue());
- if (!isNumeric(content.c_str(), 10))
- _analyzer->addLiteral(content);
- }
- }
- }
-
- {
- // gather all inline promela comments
- pmlInlines = PromelaInlines(_scxml);
- if (pmlInlines.getAllOfType(PromelaInline::PROMELA_EVENT_ONLY).size() > 0)
- _analyzer->addCode("_x.states", this);
-
- // register events and string literals
- for (std::list<PromelaInline*>::iterator inlIter = pmlInlines.allInlines.begin(); inlIter != pmlInlines.allInlines.end(); inlIter++) {
- if ((*inlIter)->type != (PromelaInline::PROMELA_EVENT_ONLY))
- continue;
-
- Data json = Data::fromJSON((*inlIter)->content);
- if (!json.empty()) {
- std::list<std::string> eventNames = PromelaInlines::getEventNames(json);
- for (std::list<std::string>::iterator evIter = eventNames.begin(); evIter != eventNames.end(); evIter++) {
- _analyzer->addEvent(*evIter);
- }
-
- std::list<std::string> stringLiterals = PromelaInlines::getStringLiterals(json);
- for (std::list<std::string>::iterator strIter = stringLiterals.begin(); strIter != stringLiterals.end(); strIter++) {
- _analyzer->addLiteral(*strIter);
- }
-
- if (json.array.size() > 0) {
- for (size_t i = 0; i < json.array.size(); i++) {
- std::string expr = dataToAssignments("_event", json.item(i));
- _analyzer->addCode(expr, this);
- }
- } else {
- std::string expr = dataToAssignments("_event", json);
- _analyzer->addCode(expr, this);
-
- }
-
- }
- }
- }
-
- // add platform variables as string literals
- _analyzer->addLiteral(_prefix + "_sessionid");
- _analyzer->addLiteral(_prefix + "_name");
-
- if (HAS_ATTR(_scxml, "name")) {
- _analyzer->addLiteral(ATTR(_scxml, "name"), _analyzer->indexForLiteral(_prefix + "_sessionid"));
- }
-
- NodeSet<std::string> contents = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", _scxml, true);
- for (size_t i = 0; i < contents.size(); i++) {
- Element<std::string> contentElem = Element<std::string>(contents[i]);
- if (contentElem.hasChildNodes() && contentElem.getFirstChild().getNodeType() == Node_base::TEXT_NODE && contentElem.getChildNodes().getLength() == 1) {
- std::string content = contentElem.getFirstChild().getNodeValue();
- _analyzer->addLiteral(spaceNormalize(content));
- }
- }
-
-
- // extract and analyze source code
- std::set<std::string> allCode;
- std::set<std::string> allStrings;
- {
- NodeSet<std::string> withCond;
- withCond.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true));
- withCond.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "if", _scxml, true));
- withCond.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "elseif", _scxml, true));
- for (size_t i = 0; i < withCond.size(); i++) {
- Element<std::string> elem = Element<std::string>(withCond[i]);
- if (HAS_ATTR(elem, "cond")) {
- std::string code = ATTR(elem, "cond");
- code = sanitizeCode(code);
- elem.setAttribute("cond", code);
- allCode.insert(code);
- }
- }
- }
- {
- NodeSet<std::string> withExpr;
- withExpr.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "log", _scxml, true));
- withExpr.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", _scxml, true));
- withExpr.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "assign", _scxml, true));
- withExpr.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "content", _scxml, true));
- withExpr.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "param", _scxml, true));
- for (size_t i = 0; i < withExpr.size(); i++) {
- Element<std::string> elem = Element<std::string>(withExpr[i]);
- if (HAS_ATTR(elem, "expr")) {
- std::string code = ATTR(elem, "expr");
- code = sanitizeCode(code);
- elem.setAttribute("expr", code);
- allCode.insert(code);
- }
- }
- }
- {
- NodeSet<std::string> withLocation;
- withLocation.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "assign", _scxml, true));
- for (size_t i = 0; i < withLocation.size(); i++) {
- Element<std::string> elem = Element<std::string>(withLocation[i]);
- if (HAS_ATTR(elem, "location")) {
- std::string code = ATTR(elem, "location");
- code = sanitizeCode(code);
- elem.setAttribute("location", code);
- allCode.insert(code);
- }
- }
- }
- {
- NodeSet<std::string> withText;
- withText.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "script", _scxml, true));
-// withText.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "data", _scxml, true));
- for (size_t i = 0; i < withText.size(); i++) {
- NodeSet<std::string> texts = DOMUtils::filterChildType(Node_base::TEXT_NODE, withText[i], true);
- for (size_t j = 0; j < texts.size(); j++) {
- if (texts[j].getNodeValue().size() > 0) {
- Text<std::string> elem = Text<std::string>(texts[j]);
- std::string code = elem.getNodeValue();
- code = sanitizeCode(code);
- elem.setNodeValue(code);
- allCode.insert(code);
- }
- }
- }
- }
- {
- NodeSet<std::string> foreachs = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "foreach", _scxml, true);
- for (size_t i = 0; i < foreachs.size(); i++) {
- if (HAS_ATTR_CAST(foreachs[i], "index")) {
- allCode.insert(ATTR_CAST(foreachs[i], "index"));
- } else {
- _hasIndexLessLoops = true;
- }
- if (HAS_ATTR_CAST(foreachs[i], "item")) {
- allCode.insert(ATTR_CAST(foreachs[i], "item"));
- }
- }
- }
- for (std::set<std::string>::const_iterator codeIter = allCode.begin(); codeIter != allCode.end(); codeIter++) {
- _analyzer->addCode(*codeIter, this);
- }
-
- // add all namelist entries to the _event structure
- {
- NodeSet<std::string> withNamelist;
- withNamelist.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "send", _scxml, true));
- withNamelist.push_back(DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true));
- for (size_t i = 0; i < withNamelist.size(); i++) {
- if (HAS_ATTR_CAST(withNamelist[i], "namelist")) {
- std::string namelist = ATTR_CAST(withNamelist[i], "namelist");
- std::list<std::string> names = tokenize(namelist);
- for (std::list<std::string>::iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
- _analyzer->addCode("_event.data." + *nameIter + " = 0;", this); // introduce for _event_t typedef
- }
- }
- }
- }
-}
-
-std::list<std::string> PromelaInlines::getStringLiterals(const Data& data) {
- std::list<std::string> literals;
- if (data.atom.size() > 0 && data.type == Data::VERBATIM) {
- literals.push_back(data.atom);
- }
- if (data.array.size() > 0) {
- for (std::list<Data>::const_iterator arrIter = data.array.begin(); arrIter != data.array.end(); arrIter++) {
- std::list<std::string> nested = getStringLiterals(*arrIter);
- literals.insert(literals.end(), nested.begin(), nested.end());
- }
- }
- if (data.compound.size() > 0) {
- for (std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); compIter != data.compound.end(); compIter++) {
- std::list<std::string> nested = getStringLiterals(compIter->second);
- literals.insert(literals.end(), nested.begin(), nested.end());
- }
- }
- return literals;
-}
-
-std::list<std::string> PromelaInlines::getEventNames(const Data& data) {
- std::list<std::string> eventNames;
- if (data.compound.size() > 0 && data.hasKey("name")) {
- eventNames.push_back(data.at("name"));
- }
- if (data.array.size() > 0) {
- for (std::list<Data>::const_iterator arrIter = data.array.begin(); arrIter != data.array.end(); arrIter++) {
- std::list<std::string> nested = getEventNames(*arrIter);
- eventNames.insert(eventNames.end(), nested.begin(), nested.end());
- }
- }
- if (data.compound.size() > 0) {
- for (std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); compIter != data.compound.end(); compIter++) {
- std::list<std::string> nested = getEventNames(compIter->second);
- eventNames.insert(eventNames.end(), nested.begin(), nested.end());
- }
- }
-
- return eventNames;
-}
-
-std::string ChartToPromela::dataToAssignments(const std::string& prefix, const Data& data) {
- std::stringstream retVal;
- if (data.atom.size() > 0) {
- if (data.type == Data::VERBATIM) {
- retVal << prefix << " = " << _analyzer->macroForLiteral(data.atom) << ";" << std::endl;
- } else {
- retVal << prefix << " = " << data.atom << ";" << std::endl;
- }
- } else if (data.compound.size() > 0) {
- for (std::map<std::string, Data>::const_iterator cIter = data.compound.begin(); cIter != data.compound.end(); cIter++) {
- retVal << dataToAssignments(prefix + "." + cIter->first, cIter->second);
- }
- } else if (data.array.size() > 0) {
- size_t index = 0;
- for(std::list<Data>::const_iterator aIter = data.array.begin(); aIter != data.array.end(); aIter++) {
- retVal << dataToAssignments(prefix + "[" + toStr(index) + "]", *aIter);
- index++;
- }
- }
- return retVal.str();
-}
-
-std::string ChartToPromela::sanitizeCode(const std::string& code) {
- std::string replaced = code;
- boost::replace_all(replaced, "\"", "'");
- boost::replace_all(replaced, "_sessionid", "_SESSIONID");
- boost::replace_all(replaced, "_name", "_NAME");
- return replaced;
-}
-
-
-void ChartToPromela::writeProgram(std::ostream& stream) {
-
- _traceTransitions = envVarIsTrue("USCXML_PROMELA_TRANSITION_TRACE");
- _writeTransitionPrintfs = envVarIsTrue("USCXML_PROMELA_TRANSITION_DEBUG");
-
- if (!HAS_ATTR(_scxml, "datamodel") || ATTR(_scxml, "datamodel") != "promela") {
- LOG(ERROR) << "Can only convert SCXML documents with \"promela\" datamodel";
- return;
- }
-
- if (_start == NULL) {
- interpret();
- }
-
- if (HAS_ATTR(_scxml, "binding") && ATTR(_scxml, "binding") != "early") {
- LOG(ERROR) << "Can only convert for early data bindings";
- return;
- }
-
-// std::cerr << _scxml << std::endl;
-
- stream << "/* " << _sourceURL.asString() << " */" << std::endl;
- stream << std::endl;
-
- initNodes();
-
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator nestedIter = _machines.begin(); nestedIter != _machines.end(); nestedIter++) {
- if (nestedIter->second->_start == NULL) {
- nestedIter->second->interpret();
- }
- nestedIter->second->initNodes();
- }
-
- writeEvents(stream);
- stream << std::endl;
- writeStates(stream);
- stream << std::endl;
- writeStrings(stream);
- stream << std::endl;
- if (_analyzer->usesInPredicate()) {
- writeStateMap(stream);
- stream << std::endl;
- }
- if (_historyMembers.size() > 0) {
- writeHistoryArrays(stream);
- stream << std::endl;
- }
- writeTypeDefs(stream);
- stream << std::endl;
- writeDeclarations(stream);
- stream << std::endl;
-
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator nestedIter = _machines.begin(); nestedIter != _machines.end(); nestedIter++) {
- nestedIter->second->writeDeclarations(stream);
- stream << std::endl;
- }
-
- stream << std::endl << "/* global inline functions */" << std::endl;
-
- if (_analyzer->usesComplexEventStruct()) {
- stream << "hidden _event_t tmpE;" << std::endl;
- } else {
- stream << "hidden int tmpE;" << std::endl;
- }
- stream << "hidden int tmpIndex;" << std::endl;
-
-
-#if NEW_DELAY_RESHUFFLE
- if (_analyzer->usesEventField("delay")) {
- writeInsertWithDelay(stream);
- stream << std::endl;
- }
-#endif
-
- if (_analyzer->usesEventField("delay") && _machines.size() > 0) {
- writeDetermineShortestDelay(stream);
- stream << std::endl;
- writeAdvanceTime(stream);
- stream << std::endl;
- writeRescheduleProcess(stream);
- stream << std::endl;
- writeScheduleMachines(stream);
- stream << std::endl;
- }
-
- {
- NodeSet<std::string> cancels = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "cancel", _scxml, true);
- if (cancels.size() > 0) {
- writeCancelEvents(stream);
- stream << std::endl;
- }
- }
- {
- NodeSet<std::string> invokes = DOMUtils::filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _scxml, true);
- if (invokes.size() > 0 && _analyzer->usesEventField("delay")) {
- writeRemovePendingEventsFromInvoker(stream);
- stream << std::endl;
- }
-
- }
- stream << std::endl;
- writeEventSources(stream);
- stream << std::endl;
- writeFSM(stream);
- stream << std::endl;
- writeMain(stream);
- stream << std::endl;
-
- for (std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator nestedIter = _machines.begin(); nestedIter != _machines.end(); nestedIter++) {
- nestedIter->second->writeFSM(stream);
- stream << std::endl;
- }
-
- // write ltl expression for success
- std::stringstream acceptingStates;
- std::string seperator;
-
- for (std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin(); stateIter != _activeConf.end(); stateIter++) {
- FlatStateIdentifier flatId(stateIter->first);
- if (std::find(flatId.getActive().begin(), flatId.getActive().end(), "pass") != flatId.getActive().end()) {
- acceptingStates << seperator << _prefix << "s == s" << stateIter->second->activeIndex;
- seperator = " || ";
- }
- }
- if (acceptingStates.str().size() > 0) {
- stream << "ltl { eventually (" << acceptingStates.str() << ") }" << std::endl;
- }
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/transform/ChartToPromela.h b/src/uscxml/transform/ChartToPromela.h
deleted file mode 100644
index 82c4e5d..0000000
--- a/src/uscxml/transform/ChartToPromela.h
+++ /dev/null
@@ -1,447 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CHARTTOPROMELA_H_RP48RFDJ
-#define CHARTTOPROMELA_H_RP48RFDJ
-
-#include "Transformer.h"
-#include "ChartToFSM.h"
-#include "uscxml/interpreter/InterpreterDraft6.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/util/Trie.h"
-
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
-#include <ostream>
-
-namespace uscxml {
-
-class PromelaCodeAnalyzer;
-class ChartToPromela;
-class PromelaParserNode;
-
-class USCXML_API PromelaInline {
-public:
- enum PromelaInlineType {
- PROMELA_NIL = 0x0000,
- PROMELA_LTL = 0x0001,
- PROMELA_CODE = 0x0002,
- PROMELA_EVENT_ALL_BUT = 0x0004,
- PROMELA_EVENT_ONLY = 0x0008,
- PROMELA_PROGRESS_LABEL = 0x0010,
- PROMELA_ACCEPT_LABEL = 0x0020,
- PROMELA_END_LABEL = 0x0040
- };
-
- PromelaInline(const Arabica::DOM::Node<std::string>& node);
- virtual ~PromelaInline() {}
-
- operator bool() {
- return (type != PROMELA_NIL);
- }
-
- std::list<PromelaInline*> children;
- PromelaInline* prevSibling;
- PromelaInline* nextSibling;
-
- virtual void dump();
-
- virtual bool relatesTo(const Arabica::DOM::Node<std::string>& node) {
- return container == node;
- }
-
- size_t level;
- std::string content;
- Arabica::DOM::Element<std::string> container;
- PromelaInlineType type;
-
-protected:
- PromelaInline() : prevSibling(NULL), nextSibling(NULL), type(PROMELA_NIL) {};
-};
-
-class USCXML_API PromelaInlines {
-public:
-
- PromelaInlines(const Arabica::DOM::Node<std::string>& node);
- PromelaInlines() {}
-
- virtual ~PromelaInlines();
-
- std::list<PromelaInline*> getRelatedTo(const Arabica::DOM::Node<std::string>& node, PromelaInline::PromelaInlineType type);
- std::list<PromelaInline*> getAllOfType(uint32_t type);
-
- std::map<Arabica::DOM::Node<std::string>, std::list<PromelaInline*> > inlines;
- std::list<PromelaInline*> allInlines;
-
- static std::list<std::string> getStringLiterals(const Data& data);
- static std::list<std::string> getEventNames(const Data& data);
-
-
-};
-
-class USCXML_API PromelaEventSource : public PromelaInline {
-public:
- PromelaEventSource(const PromelaInline& pmlInline) {
- type = pmlInline.type;
- container = pmlInline.container;
- content = pmlInline.content;
- events = Data::fromJSON(pmlInline.content);
- }
-
- virtual bool relatesTo(const Arabica::DOM::Node<std::string>& node) {
- return container == node || InterpreterImpl::isDescendant(node, container);
- }
-
- Data events;
-};
-
-#if 0
-
-
-class USCXML_API PromelaInlinesAutoEvents : public PromelaInline {
-public:
- virtual ~PromelaInlinesAutoEvents() {}
- virtual bool relatesTo(const Arabica::DOM::Node<std::string>&);
- virtual void setContent(const std::string& content);
- virtual void dump();
-
- std::map<std::string, Data> states;
-};
-
-
-class USCXML_API PromelaEventSource {
-public:
-
- enum PromelaEventSourceType {
- PROMELA_EVENT_SOURCE_INVALID,
- PROMELA_EVENT_SOURCE_INVOKER,
- PROMELA_EVENT_SOURCE_GLOBAL,
- };
-
- PromelaEventSource();
- PromelaEventSource(const PromelaInline& source, PromelaCodeAnalyzer* analyzer = NULL, uint32_t externalQueueLength = 0);
-
- void writeStart(std::ostream& stream, int indent = 0);
- void writeStop(std::ostream& stream, int indent = 0);
- void writeDeclarations(std::ostream& stream, int indent = 0);
- void writeBody(std::ostream& stream);
-
- operator bool() {
- return type != PROMELA_EVENT_SOURCE_INVALID;
- }
-
- PromelaInline source;
- std::string name;
- uint32_t externalQueueLength;
- uint32_t longestSequence;
-
- Arabica::DOM::Node<std::string> container;
- std::list<std::list<std::string> > sequences;
- PromelaEventSourceType type;
- PromelaCodeAnalyzer* analyzer;
-};
-
-#endif
-
-class USCXML_API PromelaCodeAnalyzer {
-public:
- class PromelaTypedef {
- public:
- PromelaTypedef() : arraySize(0), minValue(0), maxValue(0) {}
- std::string name;
- std::string type;
- size_t arraySize;
- size_t minValue;
- size_t maxValue;
- std::map<std::string, PromelaTypedef> types;
- std::set<ChartToPromela*> occurrences;
-
- bool operator==(const PromelaTypedef& other) const {
- return name == other.name;
- }
-
- };
-
- PromelaCodeAnalyzer() : _eventTrie("."), _lastStrIndex(1), _lastStateIndex(0), _lastEventIndex(1), _usesInPredicate(false), _usesPlatformVars(false) {
- }
-
- void addCode(const std::string& code, ChartToPromela* interpreter);
- void addEvent(const std::string& eventName);
- void addState(const std::string& stateName);
- void addOrigState(const std::string& stateName);
- void addLiteral(const std::string& stateName, int forceIndex = -1);
-
- bool usesComplexEventStruct() {
- return _typeDefs.types.find("_event") != _typeDefs.types.end() && _typeDefs.types["_event"].types.size() > 0;
- }
- bool usesEventField(const std::string& fieldName) {
- if (usesComplexEventStruct() && _typeDefs.types["_event"].types.find(fieldName) != _typeDefs.types["_event"].types.end())
- return true;
- return false;
- }
-
- bool usesEventDataField(const std::string& fieldName) {
- if (usesComplexEventStruct() &&
- _typeDefs.types["_event"].types.find("data") != _typeDefs.types["_event"].types.end() &&
- _typeDefs.types["_event"].types["data"].types.find(fieldName) != _typeDefs.types["_event"].types["data"].types.end())
- return true;
- return false;
- }
-
- std::string getTypeAssignment(const std::string& varTo, const std::string& varFrom, const PromelaTypedef& type, const std::string padding = "");
- std::string getTypeReset(const std::string& var, const PromelaTypedef& type, const std::string padding = "");
-
- bool usesInPredicate() {
- return _usesInPredicate;
- }
- void usesInPredicate(bool value) {
- _usesInPredicate = value;
- }
- bool usesPlatformVars() {
- return _usesPlatformVars;
- }
-
- std::string macroForLiteral(const std::string& literal);
- int indexForLiteral(const std::string& literal);
-
- std::set<std::string> getLiterals() {
- return _strLiterals;
- }
- std::set<std::string> getEventsWithPrefix(const std::string& prefix);
- std::map<std::string, int>& getEvents() {
- return _events;
- }
-
- std::map<std::string, int>& getStates() {
- return _states;
- }
-
- std::map<std::string, int>& getOrigStates() {
- return _origStateIndex;
- }
-
-
- Trie& getTrie() {
- return _eventTrie;
- }
-
- std::string adaptCode(const std::string& code, const std::string& prefix);
-
- static std::string prefixIdentifiers(const std::string& expr, const std::string& prefix);
- static std::list<std::pair<size_t, size_t> > getTokenPositions(const std::string& expr, int type, PromelaParserNode* ast);
-
- PromelaTypedef& getTypes() {
- return _typeDefs;
- }
-
- PromelaTypedef& getType(const std::string& typeName) {
- return _typeDefs.types.at(typeName);
- }
-
-protected:
- std::string createMacroName(const std::string& literal);
- int enumerateLiteral(const std::string& literal, int forceIndex = -1);
-
- std::set<std::string> _strLiterals; // all string literals
- std::map<std::string, std::string> _strMacroNames; // macronames for string literals
- std::map<std::string, int> _strIndex; // integer enumeration for string
- std::map<std::string, int> _origStateIndex; // state enumeration for original states
-
- std::map<std::string, int> _states;
- std::map<std::string, int> _events;
-
- PromelaTypedef _typeDefs;
- Trie _eventTrie;
-
-private:
- std::set<std::string> _macroNameSet; // helper set for uniqueness of macros
- int _lastStrIndex;
- int _lastStateIndex;
- int _lastEventIndex;
- bool _usesInPredicate;
- bool _usesPlatformVars;
-};
-
-class ExecContentSeqItem {
-public:
- enum ExecContentType {
- EXEC_CONTENT_ALL_BUT,
- EXEC_CONTENT_ONLY_FOR,
- EXEC_CONTENT_EVERY
- };
-
- ExecContentSeqItem(ExecContentType type, const std::set<GlobalTransition*>& transitions, const GlobalTransition::Action& action)
- : type(type), transitions(transitions), action(action) {}
- ExecContentSeqItem(ExecContentType type, GlobalTransition* transition, const GlobalTransition::Action& action)
- : type(type), action(action) {
- transitions.insert(transition);
- }
-
- ExecContentType type;
- std::set<GlobalTransition*> transitions;
- GlobalTransition::Action action;
-};
-
-class HistoryTransitionClass {
-public:
- HistoryTransitionClass(GlobalTransition* transition);
- HistoryTransitionClass(const std::string& from, const std::string& to);
-
- void init(const std::string& from, const std::string& to);
-
- std::map<std::string, std::set<std::string> > toRemember;
- std::map<std::string, std::set<std::string> > toKeep;
- std::map<std::string, std::set<std::string> > toForget;
-
- std::set<GlobalTransition*> members;
-
-
- void merge(const HistoryTransitionClass& other);
- bool matches(const HistoryTransitionClass& other);
-};
-
-class USCXML_API ChartToPromela : public TransformerImpl, public ChartToFSM {
-public:
-
- virtual ~ChartToPromela();
- static Transformer transform(const Interpreter& other);
-
- void writeTo(std::ostream& stream);
-
-protected:
- ChartToPromela(const Interpreter& other)
- : TransformerImpl(),
- ChartToFSM(other),
- _analyzer(NULL),
- _allowEventInterleaving(false),
- _hasIndexLessLoops(false),
- _writeTransitionPrintfs(false),
- _traceTransitions(false),
- _machinesAll(NULL),
- _parent(NULL),
- _parentTopMost(NULL),
- _machinesAllPerId(NULL),
- _perfTransProcessed(0),
- _perfTransTotal(0),
- _perfHistoryProcessed(0),
- _perfHistoryTotal(0),
- _perfStatesProcessed(0),
- _perfStatesTotal(0),
- _lastTimeStamp(0) {}
-
- void initNodes();
-
- static std::string beautifyIndentation(const std::string& code, int indent = 0);
-
- void writeProgram(std::ostream& stream);
-
- void writeEvents(std::ostream& stream);
- void writeStates(std::ostream& stream);
- void writeStateMap(std::ostream& stream);
- void writeHistoryArrays(std::ostream& stream);
- void writeTypeDefs(std::ostream& stream);
- void writeStrings(std::ostream& stream);
- void writeDeclarations(std::ostream& stream);
- void writeEventSources(std::ostream& stream);
- void writeTransition(std::ostream& stream, GlobalTransition* transition, int indent = 0);
- std::string conditionalizeForHist(const std::set<GlobalTransition*>& transitions, int indent = 0);
- std::string conditionalizeForHist(GlobalTransition* transition, int indent = 0);
- void writeHistoryAssignments(std::ostream& stream, GlobalTransition* transition, int indent = 0);
- void writeTransitionClosure(std::ostream& stream, GlobalTransition* transition, GlobalState* state, int indent = 0);
-
- void writeExecutableContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent = 0);
- void writeInlineComment(std::ostream& stream, const Arabica::DOM::Node<std::string>& node);
- void writeFSM(std::ostream& stream);
- void writeEventDispatching(std::ostream& stream);
- void writeMain(std::ostream& stream);
-
- void writeIfBlock(std::ostream& stream, const Arabica::XPath::NodeSet<std::string>& condChain, int indent = 0);
- void writeDispatchingBlock(std::ostream& stream, std::list<GlobalTransition*>, int indent = 0);
-
- void writeStartInvoker(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, ChartToPromela* invoker, int indent = 0);
- //void writeRemovePendingEventsFromInvoker(std::ostream& stream, ChartToPromela* invoker, int indent = 0, bool atomic = true);
-
- void writeDetermineShortestDelay(std::ostream& stream, int indent = 0);
- void writeInsertWithDelay(std::ostream& stream, int indent = 0);
- void writeAdvanceTime(std::ostream& stream, int indent = 0);
- void writeRescheduleProcess(std::ostream& stream, int indent = 0);
- void writeScheduleMachines(std::ostream& stream, int indent = 0);
- void writeCancelEvents(std::ostream& stream, int indent = 0);
- void writeRemovePendingEventsFromInvoker(std::ostream& stream, int indent = 0);
-
- std::list<GlobalTransition::Action> getTransientContent(GlobalTransition* transition);
- //Arabica::DOM::Node<std::string> getUltimateTarget(const Arabica::DOM::Element<std::string>& transition);
-
- static std::string declForRange(const std::string& identifier, long minValue, long maxValue, bool nativeOnly = false);
- static std::string conditionForHistoryTransition(const GlobalTransition* transition);
-
-// std::string replaceStringsInExpression(const std::string& expr);
-
- std::string sanitizeCode(const std::string& code);
- std::string dataToAssignments(const std::string& prefix, const Data& data);
-
-// Arabica::XPath::NodeSet<std::string> _globalStates;
-// Arabica::DOM::Node<std::string> _startState;
-// std::map<std::string, Arabica::DOM::Element<std::string> > _states;
-// std::map<Arabica::DOM::Element<std::string>, int> _transitions;
-
- std::list<std::string> _varInitializers; // pending initializations for arrays
-
- PromelaCodeAnalyzer* _analyzer;
- bool _allowEventInterleaving;
- bool _hasIndexLessLoops;
- bool _writeTransitionPrintfs;
- bool _traceTransitions;
-
- uint32_t _externalQueueLength;
- uint32_t _internalQueueLength;
-
- PromelaInlines pmlInlines;
-// std::map<std::string, PromelaEventSource> _invokers;
-// PromelaEventSource _globalEventSource;
-
- std::map<std::string, std::map<std::string, size_t> > _historyMembers; // ids of all history states
- std::set<std::string> _dataModelVars;
-
- Arabica::DOM::Node<std::string> _finalize;
- std::map<Arabica::DOM::Node<std::string>, ChartToPromela*> _machines;
- std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>* _machinesAll;
- ChartToPromela* _parent; // our invoking interpreter
- ChartToPromela* _parentTopMost;
-
- std::map<std::string, Arabica::DOM::Node<std::string> > _machinesPerId;
- std::map<std::string, Arabica::DOM::Node<std::string> >* _machinesAllPerId;
- std::string _prefix; // our prefix in case of nested SCXML documents
- std::string _invokerid;
-
- uint64_t _perfTransProcessed;
- uint64_t _perfTransTotal;
- uint64_t _perfHistoryProcessed;
- uint64_t _perfHistoryTotal;
- uint64_t _perfStatesProcessed;
- uint64_t _perfStatesTotal;
- uint64_t _lastTimeStamp;
-
- friend class PromelaEventSource;
-};
-
-}
-
-#endif /* end of include guard: CHARTTOPROMELA_H_RP48RFDJ */
diff --git a/src/uscxml/transform/ChartToTex.cpp b/src/uscxml/transform/ChartToTex.cpp
deleted file mode 100644
index 9d30be5..0000000
--- a/src/uscxml/transform/ChartToTex.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "uscxml/transform/ChartToFSM.h"
-#include "uscxml/transform/ChartToTex.h"
-#include "uscxml/transform/FlatStateIdentifier.h"
-
-#include <DOM/io/Stream.hpp>
-#include <iostream>
-#include "uscxml/UUID.h"
-#include <math.h>
-#include <boost/algorithm/string.hpp>
-#include <glog/logging.h>
-
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-ChartToTex::~ChartToTex() {
-}
-
-Transformer ChartToTex::transform(const Interpreter& other) {
- return boost::shared_ptr<TransformerImpl>(new ChartToTex(other));
-}
-
-void ChartToTex::writeTo(std::ostream& stream) {
- writeTex(stream);
-}
-
-void ChartToTex::writeTex(std::ostream& stream) {
- _keepInvalidTransitions = true;
- if (_start == NULL) {
- interpret();
- }
-
- bool wroteRowStart = false;
- std::string seperator;
-
- for (std::map<std::string, GlobalState*>::iterator stateIter = _globalConf.begin(); stateIter != _globalConf.end(); stateIter++) {
- assert(_indexToState.find(stateIter->second->index) == _indexToState.end());
- _indexToState[stateIter->second->index] = stateIter->second;
- }
-
- stream << "% " << _sourceURL.asString() << std::endl;
-
- stream << "%<*provideCommand>" << std::endl;
- stream << "\\providecommand{\\globalStateListCell}[2][c]{%" << std::endl;
- stream << " \\begin{tabular}[#1]{@{}l@{}}#2\\end{tabular}}" << std::endl;
- stream << "%</provideCommand>" << std::endl;
-
-
- stream << std::endl;
-
-// stream << "\\begin{table}[H]" << std::endl;
-// stream << "\\centering" << std::endl;
-// stream << "\\begin{tabular}{r | l | L{12em} | l}" << std::endl;
-
- stream << "\\begin{longtable}{| r | l | l | l |}" << std::endl;
-
- for (std::map<unsigned long, GlobalState*>::iterator stateIter = _indexToState.begin(); stateIter != _indexToState.end(); stateIter++) {
- GlobalState* currState = stateIter->second;
-
- stream << "\\hline" << std::endl;
-
- if (!wroteRowStart) {
- stream << "%<*tableRows>" << std::endl;
- wroteRowStart = true;
- }
-
- stream << "%<*globalState" << currState->index << ">" << std::endl;
-
- // state index
- stream << "\\tikzmark{statename_" << currState->index << "}" << "$\\widetilde{s}(" << currState->index << ")$ & ";
-
- // members in active configuration
- FlatStateIdentifier flatId(currState->stateId);
- stream << "\\globalStateListCell[t]{";
- stream << "\\tikzmark{active_" << currState->index << "}";
- stream << "$\\widetilde{s}_a(" << currState->index << ")$: " << stateListToTex(flatId.getFlatActive(), flatId.getActive().size() == 0) << "\\\\";
-
- // already visited states
- stream << "\\tikzmark{visited_" << currState->index << "}";
- stream << "$\\widetilde{s}_d(" << currState->index << ")$: " << stateListToTex(flatId.getFlatVisited(), flatId.getVisited().size() == 0) << "\\\\";
-
- // history assignments
- stream << "\\tikzmark{history_" << currState->index << "}";
- stream << "$\\widetilde{s}_h(" << currState->index << ")$: " << stateListToTex(flatId.getFlatHistory(), flatId.getHistory().size() == 0) << "} & ";
-
- // all transitions
- std::set<std::string> origTransitions;
- for (std::list<GlobalTransition*>::iterator transIter = stateIter->second->sortedOutgoing.begin(); transIter != stateIter->second->sortedOutgoing.end(); transIter++) {
- GlobalTransition* currTrans = *transIter;
- Arabica::XPath::NodeSet<std::string> members = currTrans->getTransitions();
- for (size_t i = 0; i < members.size(); i++) {
- Element<std::string> transElem(members[i]);
- if (HAS_ATTR(transElem, "priority")) {
- origTransitions.insert(ATTR(transElem, "priority"));
- } else {
- origTransitions.insert("initial");
- }
- }
- }
-
- if (origTransitions.size() > 0) {
- stream << "$\\{ ";
- seperator = "";
- for (std::set<std::string>::reverse_iterator transIter = origTransitions.rbegin(); transIter != origTransitions.rend(); transIter++) {
- stream << seperator << "t_{" << *transIter << "}";
- seperator = ", ";
- }
- stream << " \\}$";
- } else {
- stream << "$\\emptyset$";
- }
- stream << "\\tikzmark{transitions_" << currState->index << "}";
- stream << " & \\\\ \\hline" << std::endl;
-
- if (stateIter->second->sortedOutgoing.size() > 0) {
- stream << "$\\widetilde{\\mathcal{T}}(" << currState->index << ")$" << std::endl;
-
- size_t ecIndex = 0;
- for (std::list<GlobalTransition*>::iterator transIter = stateIter->second->sortedOutgoing.begin(); transIter != stateIter->second->sortedOutgoing.end(); transIter++, ecIndex++) {
- GlobalTransition* currTrans = *transIter;
- stream << "& ";
- stream << "\\tikzmark{trans_set" << currState->index << "_" << ecIndex << "}";
-
- if (!currTrans->isValid)
- stream << "\\sout{";
-
- Arabica::XPath::NodeSet<std::string> members = currTrans->getTransitions();
- if (members.size() > 0) {
- stream << "$\\{ ";
- seperator = "";
- for (size_t i = 0; i < members.size(); i++) {
- Element<std::string> transElem(members[i]);
- if (HAS_ATTR(transElem, "priority")) {
- stream << seperator << "t_{" << ATTR(transElem, "priority") << "}";
- } else {
- stream << seperator << "t_{initial}";
- }
- seperator = ", ";
- }
- stream << " \\}$";
- } else {
- stream << "$\\emptyset$";
- }
- // stream << "& \\sout{$\\{ t_2, t_0 \\}$}, & \\emph{$Inv_4$: nested source states} \\\\" << std::endl;
- // stream << "& $\\{ t_2 \\}$ & & $\\widetilde{s}(2)$ \\\\" << std::endl;
- // stream << "& $\\{ t_0 \\}$ & & $\\widetilde{s}(4)$ \\\\" << std::endl;
-
- if (!currTrans->isValid) {
-#if 1
- stream << " } & \\emph{";
- switch(currTrans->invalidReason) {
- case GlobalTransition::NO_COMMON_EVENT:
- stream << "$Inv_1$: ";
- break;
- case GlobalTransition::MIXES_EVENT_SPONTANEOUS:
- stream << "$Inv_2$: ";
- break;
- case GlobalTransition::SAME_SOURCE_STATE:
- stream << "$Inv_3$: ";
- break;
- case GlobalTransition::CHILD_ENABLED:
- stream << "$Inv_4$: ";
- break;
- case GlobalTransition::PREEMPTING_MEMBERS:
- stream << "$Inv_5$: ";
- break;
- case GlobalTransition::UNCONDITIONAL_MATCH:
- stream << "$Opt_1$: ";
- break;
- case GlobalTransition::UNCONDITIONAL_SUPERSET:
- stream << "$Opt_2$: ";
- break;
- }
- stream << currTrans->invalidMsg << "} ";
-#endif
- stream << "\\tikzmark{exec_content" << currState->index << "_" << ecIndex << "}";
- stream << " & ";
- } else {
- stream << " & ";
- std::stringstream execContentSS;
-
- seperator = "";
- for (std::list<GlobalTransition::Action>::iterator actionIter = currTrans->actions.begin(); actionIter != currTrans->actions.end(); actionIter++) {
- Element<std::string> execContent;
-
- if (actionIter->onEntry)
- execContent = actionIter->onEntry;
-
- if (actionIter->raiseDone)
- execContent = actionIter->raiseDone;
-
- if (actionIter->onExit)
- execContent = actionIter->onExit;
-
- if (actionIter->transition)
- execContent = actionIter->transition;
-
- if (execContent) {
- if (HAS_ATTR(execContent, "line_start") && HAS_ATTR(execContent, "line_end")) {
- size_t lineStart = strTo<size_t>(ATTR(execContent, "line_start"));
- size_t lineEnd = strTo<size_t>(ATTR(execContent, "line_end"));
- lineStart++;
- lineEnd--;
- if (lineStart == lineEnd) {
- execContentSS << seperator << "l_{" << lineStart << "}";
- } else {
- execContentSS << seperator << "l_{" << lineStart << "-" << lineEnd << "}";
- }
- }
- seperator = ", ";
- }
- }
-
- if (execContentSS.str().size() > 0) {
- stream << "$\\mathcal{X} := (" << execContentSS.str() << ")$";
- } else {
- stream << "$\\emptyset$";
- }
- stream << "\\tikzmark{exec_content" << currState->index << "_" << ecIndex << "}";
-
- stream << " & $\\widetilde{s}(" << _globalConf[currTrans->destination]->index << ")$ ";
- stream << "\\tikzmark{target" << currState->index << "_" << ecIndex << "}";
- }
-
- stream << "\\\\" << std::endl;
- }
- if (stateIter->second->sortedOutgoing.size() == 0) {
- stream << " & & & \\\\" << std::endl;
- }
-
- stream << "\\hline" << std::endl;
- }
- stream << "%</globalState" << currState->index << ">" << std::endl;
-
- }
- if (wroteRowStart) {
- stream << "%</tableRows>" << std::endl;
- }
-
-// stream << "\\end{tabular}" << std::endl;
-// stream << "\\end{table}" << std::endl << std::endl;
- stream << "\\end{longtable}" << std::endl << std::endl;
-
-}
-
-std::string ChartToTex::stateListToTex(const std::string& input, bool isEmpty) {
- std::string statesTex;
- if (!isEmpty) {
- statesTex = input;
- boost::replace_all(statesTex, "active:", "");
- boost::replace_all(statesTex, "history:", "");
- boost::replace_all(statesTex, "visited:", "");
- statesTex = "\\texttt{" + texEscape(statesTex) + "}";
- } else {
- statesTex = "$\\emptyset$";
- }
- return statesTex;
-}
-
-std::string ChartToTex::texEscape(const std::string& input) {
- std::string texString(input);
- boost::replace_all(texString, "\\", "\\\\");
- boost::replace_all(texString, "{", "\\{");
- boost::replace_all(texString, "}", "\\}");
- boost::replace_all(texString, ",", ", ");
- return texString;
-}
-
-
-} \ No newline at end of file
diff --git a/src/uscxml/transform/ChartToTex.h b/src/uscxml/transform/ChartToTex.h
deleted file mode 100644
index de3743e..0000000
--- a/src/uscxml/transform/ChartToTex.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef CHARTTOTEX_H_2B7D5889
-#define CHARTTOTEX_H_2B7D5889
-
-
-#include "Transformer.h"
-#include "ChartToFSM.h"
-#include "uscxml/Interpreter.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/util/Trie.h"
-
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
-#include <ostream>
-
-namespace uscxml {
-
-class USCXML_API ChartToTex : public TransformerImpl, public ChartToFSM {
-public:
-
- virtual ~ChartToTex();
- static Transformer transform(const Interpreter& other);
-
- void writeTo(std::ostream& stream);
-
-protected:
- ChartToTex(const Interpreter& other)
- : TransformerImpl(),
- ChartToFSM(other) {}
-
- void writeTex(std::ostream& stream);
-
- std::map<unsigned long, GlobalState*> _indexToState;
-
-private:
- static std::string stateListToTex(const std::string& input, bool isEmpty);
- static std::string texEscape(const std::string& input);
-};
-
-}
-
-#endif /* end of include guard: CHARTTOTEX_H_2B7D5889 */
diff --git a/src/uscxml/transform/ChartToVHDL.cpp b/src/uscxml/transform/ChartToVHDL.cpp
index 127dc91..e80b543 100644
--- a/src/uscxml/transform/ChartToVHDL.cpp
+++ b/src/uscxml/transform/ChartToVHDL.cpp
@@ -16,16 +16,15 @@
* program. If not, see <http://www.opensource.org/licenses/bsd-license>.
* @endcond
*/
+#if 0
#include "uscxml/transform/ChartToVHDL.h"
-#include "uscxml/debug/Complexity.h"
-#include <DOM/io/Stream.hpp>
#include <iostream>
-#include "uscxml/UUID.h"
-#include "uscxml/dom/DOMUtils.h"
+#include "uscxml/util/UUID.h"
+#include "uscxml/util/DOM.h"
#include <math.h>
#include <boost/algorithm/string.hpp>
-#include <glog/logging.h>
+#include <easylogging++.h>
#include <algorithm>
#include <iomanip>
@@ -1450,4 +1449,6 @@ void ChartToVHDL::writeSystemSignalMapping(std::ostream & stream) {
stream << std::endl;
}
-} \ No newline at end of file
+}
+
+#endif \ No newline at end of file
diff --git a/src/uscxml/transform/ChartToVHDL.h b/src/uscxml/transform/ChartToVHDL.h
index 8e5a3ef..3d8b00d 100644
--- a/src/uscxml/transform/ChartToVHDL.h
+++ b/src/uscxml/transform/ChartToVHDL.h
@@ -20,15 +20,12 @@
#ifndef CHARTOVHDL_H
#define CHARTOVHDL_H
-#include "uscxml/interpreter/InterpreterDraft6.h"
-#include "uscxml/dom/DOMUtils.h"
-#include "uscxml/util/Trie.h"
+#include "uscxml/util/DOM.h"
+#include "uscxml/transform/Trie.h"
#include "Transformer.h"
#include "ChartToC.h"
-#include <DOM/Document.hpp>
-#include <DOM/Node.hpp>
-#include <XPath/XPath.hpp>
+#include <xercesc/dom/DOM.hpp>
#include <ostream>
#include <vector>
@@ -194,15 +191,15 @@ protected:
// event generation
void writeExContentBlock(std::ostream & stream, std::string index,
- std::list< Arabica::DOM::Element<std::string> > commandSequence);
+ std::list<xercesc::DOMElement*> commandSequence);
Trie _eventTrie;
- Arabica::XPath::NodeSet<std::string> _execContent;
+ std::list<xercesc::DOMElement*> _execContent;
private:
std::string eventNameEscape(const std::string& eventName);
- std::string getLineForExecContent(const Arabica::DOM::Node<std::string>& elem);
+ std::string getLineForExecContent(const xercesc::DOMElement* elem);
};
diff --git a/src/uscxml/transform/FlatStateIdentifier.h b/src/uscxml/transform/FlatStateIdentifier.h
deleted file mode 100644
index 2d62651..0000000
--- a/src/uscxml/transform/FlatStateIdentifier.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * @file
- * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef FLATSTATEIDENTIFIER_H_E9534AF9
-#define FLATSTATEIDENTIFIER_H_E9534AF9
-
-#include "uscxml/Common.h"
-#include "uscxml/Convenience.h"
-#include "uscxml/dom/DOMUtils.h"
-
-#include <XPath/XPath.hpp>
-
-#include <sstream>
-#include <string>
-#include <list>
-#include <map>
-
-#include <boost/algorithm/string.hpp>
-
-namespace uscxml {
-
-class USCXML_API FlatStateIdentifier {
-public:
-
- operator bool() const {
- return stateId.length() > 0;
- }
-
- bool operator<( const FlatStateIdentifier& other) const {
- return stateId < other.stateId;
- }
-
- FlatStateIdentifier(const Arabica::XPath::NodeSet<std::string>& activeStates,
- const Arabica::XPath::NodeSet<std::string>& alreadyEnteredStates,
- const std::map<std::string, Arabica::XPath::NodeSet<std::string> >& historyStates) {
- for (size_t i = 0; i < activeStates.size(); i++) {
- active.push_back(ATTR_CAST(activeStates[i], "id"));
- }
-
- for (size_t i = 0; i < alreadyEnteredStates.size(); i++) {
- const Arabica::DOM::NodeList<std::string>& children = alreadyEnteredStates[i].getChildNodes();
- bool isRelevant = false;
- for (size_t j = 0; j < children.getLength(); j++) {
- if (children.item(j).getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE)
- continue;
- if (iequals(LOCALNAME_CAST(children.item(j)), "data") || iequals(LOCALNAME_CAST(children.item(j)), "datamodel")) {
- isRelevant = true;
- break;
- }
- }
- if (isRelevant)
- visited.push_back(ATTR_CAST(alreadyEnteredStates[i], "id"));
- }
-
- std::map<std::string, Arabica::XPath::NodeSet<std::string> >::const_iterator histIter;
- for (histIter = historyStates.begin(); histIter != historyStates.end(); histIter++) {
- for (size_t i = 0; i < histIter->second.size(); i++) {
- histories[histIter->first].push_back(ATTR_CAST(histIter->second[i], "id"));
- }
- }
-
- initStateId();
- }
-
-
- FlatStateIdentifier(const std::list<std::string>& active,
- const std::list<std::string>& visited,
- const std::map<std::string, std::list<std::string> >& histories) : active(active), visited(visited), histories(histories) {
- initStateId();
- }
-
- static std::string toStateId(const std::list<std::string> active,
- const std::list<std::string> visited = std::list<std::string>(),
- const std::map<std::string, std::list<std::string> > histories = std::map<std::string, std::list<std::string> >()) {
- FlatStateIdentifier tmp(active, visited, histories);
- return tmp.getStateId();
- }
-
- static std::string toStateId(const Arabica::XPath::NodeSet<std::string> activeStates,
- const Arabica::XPath::NodeSet<std::string> alreadyEnteredStates = Arabica::XPath::NodeSet<std::string>(),
- const std::map<std::string, Arabica::XPath::NodeSet<std::string> > historyStates = std::map<std::string, Arabica::XPath::NodeSet<std::string> >()) {
- FlatStateIdentifier tmp(activeStates, alreadyEnteredStates, historyStates);
- return tmp.getStateId();
- }
-
- FlatStateIdentifier(const std::string& identifier) : stateId(identifier) {
- std::string parsedName;
- // parse unique state identifier
- std::stringstream elemNameSS(identifier);
- std::string section;
- while(std::getline(elemNameSS, section, ';')) {
- if (boost::starts_with(section, "active:{")) {
- // active:{s0,s1,s2}
- std::stringstream stateSS(section.substr(8, section.size() - 9));
- std::string state;
- while(std::getline(stateSS, state, ',')) {
- size_t closingBracketPos = state.find("}");
- if (closingBracketPos != std::string::npos) {
- state = state.substr(0, closingBracketPos);
- }
- boost::trim(state);
- if (state.length() > 0) {
- active.push_back(state);
- }
- }
- } else if (boost::starts_with(section, "visited:{")) {
- // entered:{s0,s1,s2}
- std::stringstream stateSS(section.substr(9, section.size() - 10));
- std::string state;
- while(std::getline(stateSS, state, ',')) {
- size_t closingBracketPos = state.find("}");
- if (closingBracketPos != std::string::npos) {
- state = state.substr(0, closingBracketPos);
- }
- boost::trim(state);
- if (state.length() > 0) {
- visited.push_back(state);
- }
- }
- } else if (boost::starts_with(section, "history:{")) {
- // history:{h0:{s1,s2},h1:{s2,s3}}
- std::string histEntries(section.substr(9, section.length() - 10));
-
- std::string state;
- size_t start = 0;
- size_t history = 0;
-
- while((history = histEntries.find(":", start)) != std::string::npos) {
- std::string histName = histEntries.substr(start, history - start);
- history++;
-
- size_t end = histEntries.find("}", start);
- if (end == std::string::npos)
- continue;
-
- std::stringstream stateSS(histEntries.substr(history + 1, end - history - 1));
- std::string state;
- while(std::getline(stateSS, state, ',')) {
- size_t closingBracketPos = state.find("}");
- if (closingBracketPos != std::string::npos) {
- state = state.substr(0, closingBracketPos);
- }
- boost::trim(state);
- if (state.length() > 0) {
- histories[histName].push_back(state);
- }
-
- }
-
- start = end + 2;
- }
- }
- }
- initStateId();
- }
-
- const std::string& getStateId() const {
- return stateId;
- }
-
- const std::list<std::string>& getActive() const {
- return active;
- }
- const std::string& getFlatActive() const {
- return flatActive;
- }
-
-
- const std::string& getFlatHistory() const {
- return flatHistories;
- }
-
- const std::list<std::string>& getVisited() const {
- return visited;
- }
- const std::string& getFlatVisited() const {
- return flatVisited;
- }
-
-
- const std::map<std::string, std::list<std::string> > & getHistory() const {
- return histories;
- }
-
- const std::map<std::string, std::set<std::string> > getHistorySets() {
- std::map<std::string, std::set<std::string> > histSet;
- std::map<std::string, std::list<std::string> >::const_iterator histIter = histories.begin();
- while(histIter != histories.end()) {
- histSet[histIter->first].insert(histIter->second.begin(), histIter->second.end());
- histIter++;
- }
- return histSet;
- }
-
-protected:
- std::list<std::string> active;
- std::list<std::string> visited;
- std::map<std::string, std::list<std::string> > histories;
-
- std::string flatActive;
- std::string flatVisited;
- std::string flatHistories;
-
- std::string stateId;
-
- void initStateId() {
- std::stringstream stateIdSS;
- std::string seperator;
-
- std::stringstream flatActiveSS;
- flatActiveSS << "active:{";
- for (std::list<std::string>::const_iterator actIter = active.begin(); actIter != active.end(); actIter++) {
- flatActiveSS << seperator << *actIter;
- seperator = ",";
- }
- flatActiveSS << "}";
- flatActive = flatActiveSS.str();
- stateIdSS << flatActive;
-
- if (visited.size() > 0) {
- std::stringstream flatVisitedSS;
- seperator = "";
- flatVisitedSS << "visited:{";
- for (std::list<std::string>::const_iterator visitIter = visited.begin(); visitIter != visited.end(); visitIter++) {
- flatVisitedSS << seperator << *visitIter;
- seperator = ",";
- }
- flatVisitedSS << "}";
- flatVisited = flatVisitedSS.str();
- stateIdSS << ";" << flatVisited;
- }
-
- if (histories.size() > 0) {
- std::stringstream flatHistorySS;
- seperator = "";
- flatHistorySS << "history:{";
- for (std::map<std::string, std::list<std::string> >::const_iterator histIter = histories.begin(); histIter != histories.end(); histIter++) {
- flatHistorySS << seperator << histIter->first << ":{";
- seperator = ",";
- std::string itemSeperator;
- for (std::list<std::string>::const_iterator histItemIter = histIter->second.begin(); histItemIter != histIter->second.end(); histItemIter++) {
- flatHistorySS << itemSeperator << *histItemIter;
- itemSeperator = ",";
- }
- flatHistorySS << "}";
- }
- flatHistorySS << "}";
- flatHistories = flatHistorySS.str();
- stateIdSS << ";" << flatHistories;
- }
-
- stateId = stateIdSS.str();
- }
-
-#if 0
- std::string activeId() {
- std::stringstream activeSS;
- activeSS << "active-";
- for (std::list<std::string>::const_iterator activeIter = active.begin(); activeIter != active.end(); activeIter++) {
- activeSS << *activeIter << "-";
- }
- return activeSS.str();
- }
-
-#endif
-
-};
-
-}
-
-#endif /* end of include guard: FLATSTATEIDENTIFIER_H_E9534AF9 */
diff --git a/src/uscxml/transform/Transformer.h b/src/uscxml/transform/Transformer.h
index c8498ff..a490533 100644
--- a/src/uscxml/transform/Transformer.h
+++ b/src/uscxml/transform/Transformer.h
@@ -28,7 +28,15 @@ namespace uscxml {
class USCXML_API TransformerImpl {
public:
- TransformerImpl() {}
+ TransformerImpl(const Interpreter& other) {
+ interpreter = other; // we need to keep a reference to retain the document!
+ other.getImpl()->init();
+ _document = other.getImpl()->_document;
+ _baseURL = other.getImpl()->_baseURL;
+ _scxml = other.getImpl()->_scxml;
+ _name = other.getImpl()->_name;
+ _binding = other.getImpl()->_binding;
+ }
virtual void writeTo(std::ostream& stream) = 0;
virtual operator Interpreter() {
@@ -39,10 +47,18 @@ protected:
std::multimap<std::string, std::string> _extensions;
std::list<std::string> _options;
+ xercesc::DOMDocument* _document;
+ xercesc::DOMElement* _scxml;
+
+ Interpreter interpreter;
+ InterpreterImpl::Binding _binding;
+ URL _baseURL;
+ std::string _name;
+
friend class Transformer;
};
-class USCXML_API Transformer : public boost::enable_shared_from_this<Transformer> {
+class USCXML_API Transformer {
public:
// Transformer(const Interpreter& source) { _impl = new (source) }
diff --git a/src/uscxml/util/Trie.cpp b/src/uscxml/transform/Trie.cpp
index 8e3aff3..8e3aff3 100644
--- a/src/uscxml/util/Trie.cpp
+++ b/src/uscxml/transform/Trie.cpp
diff --git a/src/uscxml/util/Trie.h b/src/uscxml/transform/Trie.h
index 73d75e7..73d75e7 100644
--- a/src/uscxml/util/Trie.h
+++ b/src/uscxml/transform/Trie.h
diff --git a/src/uscxml/Convenience.cpp b/src/uscxml/util/Convenience.cpp
index 6534636..7ceb875 100644
--- a/src/uscxml/Convenience.cpp
+++ b/src/uscxml/util/Convenience.cpp
@@ -19,10 +19,10 @@
#include <inttypes.h>
#include <stdlib.h>
-#include <boost/detail/endian.hpp>
-#include <boost/lexical_cast.hpp>
+#include "Convenience.h"
namespace uscxml {
+
bool isnan(double x) {
return x != x;
}
diff --git a/src/uscxml/util/Convenience.h b/src/uscxml/util/Convenience.h
new file mode 100644
index 0000000..532bcc0
--- /dev/null
+++ b/src/uscxml/util/Convenience.h
@@ -0,0 +1,83 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef CONVENIENCE_H_LU7GZ6CB
+#define CONVENIENCE_H_LU7GZ6CB
+
+#include "uscxml/Common.h"
+#include <string>
+#include <limits>
+#include <sstream>
+
+namespace uscxml {
+inline bool isnan(double x);
+
+// see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c
+template <typename T> std::string toStr(T tmp) {
+ std::ostringstream outSS;
+ outSS.precision(std::numeric_limits<double>::digits10 + 1);
+ outSS << tmp;
+ return outSS.str();
+}
+
+template <typename T> T strTo(std::string tmp) {
+ T output;
+ std::istringstream in(tmp);
+ in >> output;
+ return output;
+}
+
+class USCXML_API NumAttr {
+public:
+ NumAttr(const std::string& str) {
+ size_t valueStart = str.find_first_of("0123456789.");
+ if (valueStart != std::string::npos) {
+ size_t valueEnd = str.find_last_of("0123456789.");
+ if (valueEnd != std::string::npos) {
+ value = str.substr(valueStart, (valueEnd - valueStart) + 1);
+ size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1);
+ if (unitStart != std::string::npos) {
+ size_t unitEnd = str.find_last_of(" \t");
+ if (unitEnd != std::string::npos && unitEnd > unitStart) {
+ unit = str.substr(unitStart, unitEnd - unitStart);
+ } else {
+ unit = str.substr(unitStart, str.length() - unitStart);
+ }
+ }
+ }
+ }
+ }
+
+ std::string value;
+ std::string unit;
+};
+
+bool isNumeric(const char* pszInput, int nNumberBase);
+bool isInteger( const char* pszInput, int nNumberBase);
+bool iequals(const std::string& a, const std::string& b);
+bool equals(const std::string& a, const std::string& b);
+bool stringIsTrue(const std::string& value);
+bool envVarIsTrue(const char* name);
+bool envVarIEquals(const char* name, const char* value);
+
+std::string escape(const std::string& a);
+std::string unescape(const std::string& a);
+
+}
+#endif /* end of include guard: CONVENIENCE_H_LU7GZ6CB */
diff --git a/src/uscxml/util/DOM.cpp b/src/uscxml/util/DOM.cpp
new file mode 100644
index 0000000..c7ed1e9
--- /dev/null
+++ b/src/uscxml/util/DOM.cpp
@@ -0,0 +1,402 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include <algorithm>
+
+#include "uscxml/Common.h"
+#include "uscxml/util/Convenience.h"
+//#include "uscxml/util/UUID.h"
+#include "uscxml/util/DOM.h"
+//#include "uscxml/util/Convenience.h"
+
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/framework/StdOutFormatTarget.hpp>
+
+#include "easylogging++.h"
+
+//#include <glog/logging.h>
+//#include <boost/algorithm/string.hpp>
+
+namespace uscxml {
+
+using namespace xercesc;
+
+std::ostream& operator<< (std::ostream& os, const DOMNode& node) {
+
+ DOMImplementation *implementation = DOMImplementationRegistry::getDOMImplementation(X("LS"));
+ DOMLSSerializer *serializer = ((DOMImplementationLS*)implementation)->createLSSerializer();
+ if (serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
+ serializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
+ serializer->setNewLine(XMLString::transcode("\r\n"));
+
+ X output = serializer->writeToString(&node);
+ os << output;
+ return os;
+}
+
+std::ostream& operator<< (std::ostream& os, const X& xmlString) {
+ os << xmlString._localForm;
+ return os;
+}
+
+std::string DOMUtils::idForNode(const DOMNode* node) {
+ std::string nodeId;
+ std::string seperator;
+ const DOMNode* curr = node;
+ while(curr) {
+ switch (curr->getNodeType()) {
+ case DOMNode::ELEMENT_NODE: {
+ const DOMElement* elem = dynamic_cast<const DOMElement*>(curr);
+ if (HAS_ATTR(elem, "id")) {
+ std::string elementId = ATTR(elem, "id");
+ std::replace( elementId.begin(), elementId.end(), '.', '_');
+ std::replace( elementId.begin(), elementId.end(), ',', '_');
+
+ nodeId.insert(0, elementId + seperator);
+ seperator = "_";
+ return nodeId;
+ } else {
+ DOMNode* sibling = curr->getPreviousSibling();
+ int index = 0;
+ while(sibling) {
+ if (sibling->getNodeType() == DOMNode::ELEMENT_NODE) {
+ if (iequals(TAGNAME_CAST(sibling), TAGNAME(elem))) {
+ index++;
+ }
+ }
+ sibling = sibling->getPreviousSibling();
+ }
+ nodeId.insert(0, TAGNAME(elem) + toStr(index) + seperator);
+ seperator = "_";
+ }
+ break;
+ }
+ case DOMNode::DOCUMENT_NODE:
+ return nodeId;
+ default:
+ break;
+ }
+
+ curr = curr->getParentNode();
+ }
+ return nodeId;
+}
+
+std::string DOMUtils::xPathForNode(const DOMNode* node, const std::string& ns) {
+ std::string xPath;
+ std::string nsPrefix;
+
+ if (ns.size() > 0) {
+ nsPrefix = ns + ":";
+ }
+
+ if (!node || node->getNodeType() != DOMNode::ELEMENT_NODE)
+ return xPath;
+
+ const DOMNode* curr = node;
+ while(curr) {
+ switch (curr->getNodeType()) {
+ case DOMNode::ELEMENT_NODE: {
+ const DOMElement* elem = dynamic_cast<const DOMElement*>(curr);
+ if (HAS_ATTR(elem, "id")) {
+ // we assume ids to be unique and return immediately
+ if (ns == "*") {
+ xPath.insert(0, "//*[local-name() = \"" + TAGNAME(elem) + "\"][@id=\"" + ATTR(elem, "id") + "\"]");
+ } else {
+ xPath.insert(0, "//" + nsPrefix + TAGNAME(elem) + "[@id=\"" + ATTR(elem, "id") + "\"]");
+ }
+ return xPath;
+ } else {
+ // check previous siblings to count our index
+ DOMNode* sibling = curr->getPreviousSibling();
+ int index = 1; // xpath indices start at 1
+ while(sibling) {
+ if (sibling->getNodeType() == DOMNode::ELEMENT_NODE) {
+ if (iequals(TAGNAME_CAST(sibling), TAGNAME(elem))) {
+ index++;
+ }
+ }
+ sibling = sibling->getPreviousSibling();
+ }
+ if (ns == "*") {
+ xPath.insert(0, "/*[local-name() = \"" + TAGNAME(elem) + "\"][" + toStr(index) + "]");
+ } else {
+ xPath.insert(0, "/" + nsPrefix + TAGNAME(elem) + "[" + toStr(index) + "]");
+ }
+ }
+ break;
+ }
+ case DOMNode::DOCUMENT_NODE:
+ return xPath;
+ default:
+ LOG(ERROR) << "Only nodes of type element supported for now";
+ return "";
+ break;
+ }
+ curr = curr->getParentNode();
+ }
+ return xPath;
+}
+
+bool DOMUtils::hasIntersection(const std::list<DOMElement*>& l1, const std::list<DOMElement*>& l2) {
+ for (auto i = l1.begin(); i != l1.end(); i++) {
+ for (auto j = l2.begin(); j != l2.end(); j++) {
+ if (*i == *j)
+ return true;
+ }
+ }
+ return false;
+}
+
+bool DOMUtils::isMember(const DOMNode* node,
+ const DOMNodeList* list) {
+ for (size_t i = 0; i < list->getLength(); i++) {
+ if (list->item(i) == node)
+ return true;
+ }
+ return false;
+}
+
+bool DOMUtils::isMember(const DOMNode* node,
+ const std::list<DOMNode*>& list) {
+
+ for (auto listIter = list.begin(); listIter != list.end(); listIter++) {
+ if ((*listIter) == node)
+ return true;
+ }
+ return false;
+}
+
+bool DOMUtils::isMember(const DOMElement* node,
+ const std::list<DOMElement*>& list) {
+
+ for (auto listIter = list.begin(); listIter != list.end(); listIter++) {
+ if ((*listIter) == node)
+ return true;
+ }
+ return false;
+}
+
+const DOMNode* DOMUtils::getNearestAncestor(const DOMNode* node, const std::string tagName) {
+ const DOMNode* parent = node->getParentNode();
+ while(parent) {
+ if (parent->getNodeType() == DOMNode::ELEMENT_NODE &&
+ iequals(TAGNAME_CAST(parent), tagName)) {
+ return parent;
+ }
+ parent = parent->getParentNode();
+ }
+ return NULL;
+}
+
+bool DOMUtils::isDescendant(const DOMNode* s1,
+ const DOMNode* s2) {
+ if (!s1 || !s2)
+ return false;
+
+ const DOMNode* parent = s1->getParentNode();
+ while(parent) {
+ if (s2 == parent)
+ return true;
+ parent = parent->getParentNode();
+ }
+ return false;
+}
+
+std::list<DOMElement*> DOMUtils::inPostFixOrder(const std::set<std::string>& elements,
+ const DOMElement* root,
+ const bool includeEmbeddedDoc) {
+ std::list<DOMElement*> nodes;
+ inPostFixOrder(elements, root, includeEmbeddedDoc, nodes);
+ return nodes;
+}
+
+void DOMUtils::inPostFixOrder(const std::set<std::string>& elements,
+ const DOMElement* root,
+ const bool includeEmbeddedDoc,
+ std::list<DOMElement*>& nodes) {
+
+ DOMNodeList* children = root->getChildNodes();
+ for (size_t i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ const DOMElement* childElem = dynamic_cast<const DOMElement*>(children->item(i));
+ if (!includeEmbeddedDoc && LOCALNAME(childElem) == "scxml")
+ continue;
+ inPostFixOrder(elements, childElem, includeEmbeddedDoc, nodes);
+
+ }
+ for (size_t i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ const DOMElement* childElem = dynamic_cast<const DOMElement*>(children->item(i));
+ if (!includeEmbeddedDoc && TAGNAME(childElem) == XML_PREFIX(root).str() + "scxml")
+ continue;
+
+ if (elements.find(TAGNAME(childElem)) != elements.end()) {
+ nodes.push_back((DOMElement*)childElem);
+ }
+ }
+}
+
+std::list<DOMElement*> DOMUtils::inDocumentOrder(const std::set<std::string>& elements,
+ const DOMElement* root,
+ const bool includeEmbeddedDoc) {
+ std::list<DOMElement*> nodes;
+ inDocumentOrder(elements, root, includeEmbeddedDoc, nodes);
+ return nodes;
+}
+
+void DOMUtils::inDocumentOrder(const std::set<std::string>& elements,
+ const DOMElement* root,
+ const bool includeEmbeddedDoc,
+ std::list<DOMElement*>& nodes) {
+ if (elements.find(TAGNAME(root)) != elements.end()) {
+ nodes.push_back((DOMElement*)root);
+ }
+
+ DOMNodeList* children = root->getChildNodes();
+ for (size_t i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ const DOMElement* childElem = dynamic_cast<const DOMElement*>(children->item(i));
+ if (!includeEmbeddedDoc && TAGNAME(childElem) == XML_PREFIX(root).str() + "scxml")
+ continue;
+ inDocumentOrder(elements, childElem, includeEmbeddedDoc, nodes);
+ }
+}
+
+std::list<DOMNode*> DOMUtils::getElementsByType(const DOMNode* root,
+ DOMNode::NodeType type) {
+ std::list<DOMNode*> result;
+ std::list<DOMNode*> stack;
+ std::list<DOMNode*>::iterator stackIter;
+
+ if (!root)
+ return result;
+
+ stack.push_back((DOMNode*)root);
+ while(stack.size() > 0) {
+// for(stackIter = stack.begin(); stackIter != stack.end(); stackIter++) {
+// std::cout << stackIter->getNodeType() << " " << stackIter->getLocalName() << " " << stackIter->getNodeValue() << std::endl;
+// }
+// std::cout << std::endl;
+
+ DOMNode* currNode = stack.back();
+ if (currNode->hasChildNodes()) {
+ stack.push_back(currNode->getFirstChild());
+ continue;
+ }
+
+ // roll back stack and pop everyone without next sibling
+ do {
+ currNode = stack.back();
+ if (currNode->getNodeType() == type)
+ result.push_back(currNode);
+ stack.pop_back();
+ if (currNode->getNextSibling()) {
+ stack.push_back(currNode->getNextSibling());
+ break;
+ }
+ } while(stack.size() > 0);
+ }
+ return result;
+}
+
+
+std::list<DOMElement*> DOMUtils::filterChildElements(const std::string& tagName,
+ const std::list<DOMElement*>& nodeSet,
+ bool recurse) {
+
+ std::list<DOMElement*> filteredChildElems;
+ std::list<DOMElement*>::const_iterator nodeIter = nodeSet.begin();
+ while(nodeIter != nodeSet.end()) {
+ std::list<DOMElement*> filtered = filterChildElements(tagName, *nodeIter, recurse);
+ filteredChildElems.merge(filtered); // TODO: guess we want insert?
+ nodeIter++;
+ }
+ return filteredChildElems;
+}
+
+std::list<DOMElement*> DOMUtils::filterChildElements(const std::string& tagName,
+ const DOMElement* node,
+ bool recurse) {
+
+ std::list<DOMElement*> filteredChildElems;
+
+ if (!node)
+ return filteredChildElems;
+
+ DOMNodeList* children = node->getChildNodes();
+ for (unsigned int i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ const DOMElement* childElem = dynamic_cast<const DOMElement*>(children->item(i));
+
+ // std::cerr << TAGNAME(childs.item(i)) << std::endl;
+ if(iequals(TAGNAME(childElem), tagName)) {
+ filteredChildElems.push_back((DOMElement*)childElem);
+ }
+ if (recurse) {
+ std::list<DOMElement*> nested = filterChildElements(tagName, childElem, recurse);
+ filteredChildElems.merge(nested);
+ }
+ }
+ return filteredChildElems;
+}
+
+
+std::list<DOMNode*> DOMUtils::filterChildType(const DOMNode::NodeType type,
+ const std::list<DOMNode*>& nodeSet,
+ bool recurse) {
+ std::list<DOMNode*> filteredChildType;
+ std::list<DOMNode*>::const_iterator nodeIter = nodeSet.begin();
+ while(nodeIter != nodeSet.end()) {
+ std::list<DOMNode*> filtered = filterChildType(type, *nodeIter, recurse);
+ filteredChildType.merge(filtered);
+ nodeIter++;
+ }
+ return filteredChildType;
+}
+
+std::list<DOMNode*> DOMUtils::filterChildType(const DOMNode::NodeType type,
+ const DOMNode* node,
+ bool recurse) {
+
+ std::list<DOMNode*> filteredChildTypes;
+
+ if (!node)
+ return filteredChildTypes;
+
+ DOMNodeList* children = node->getChildNodes();
+ for (unsigned int i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() == type)
+ filteredChildTypes.push_back(children->item(i));
+ if (recurse) {
+ std::list<DOMNode*> nested = filterChildType(type, children->item(i), recurse);
+ filteredChildTypes.merge(nested);
+
+ }
+ }
+ return filteredChildTypes;
+}
+
+
+} \ No newline at end of file
diff --git a/src/uscxml/util/DOM.h b/src/uscxml/util/DOM.h
new file mode 100644
index 0000000..4eb0e36
--- /dev/null
+++ b/src/uscxml/util/DOM.h
@@ -0,0 +1,224 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef DOMUTILS_H_WK0WAEA7
+#define DOMUTILS_H_WK0WAEA7
+
+#include <set>
+#include <list>
+#include <iostream>
+
+#include "uscxml/Common.h"
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/dom/DOM.hpp>
+
+
+/*
+#define TAGNAME_CAST(elem) ((Arabica::DOM::Element<std::string>)elem).getTagName()
+#define LOCALNAME_CAST(elem) ((Arabica::DOM::Element<std::string>)elem).getLocalName()
+#define ATTR_CAST(elem, attr) ((Arabica::DOM::Element<std::string>)elem).getAttribute(attr)
+#define ATTR_NODE_CAST(elem, attr) ((Arabica::DOM::Element<std::string>)elem).getAttributeNode(attr)
+#define HAS_ATTR_CAST(elem, attr) ((Arabica::DOM::Element<std::string>)elem).hasAttribute(attr)
+
+#define TAGNAME(elem) elem.getTagName()
+#define LOCALNAME(elem) elem.getLocalName()
+#define ATTR(elem, attr) elem.getAttribute(attr)
+#define ATTR_NODE(elem, attr) elem.getAttributeNode(attr)
+*/
+
+#define HAS_ATTR(elem, attr) (elem)->hasAttribute(X(attr))
+#define HAS_ATTR_CAST(elem, attr) HAS_ATTR(static_cast<const DOMElement*>(elem), attr)
+#define ATTR(elem, attr) std::string(X((elem)->getAttribute(X(attr))))
+#define ATTR_CAST(elem, attr) ATTR(static_cast<const DOMElement*>(elem), attr)
+#define TAGNAME(elem) std::string(X((elem)->getTagName()))
+#define TAGNAME_CAST(elem) TAGNAME(static_cast<const DOMElement*>(elem))
+#define LOCALNAME(elem) std::string(X((elem)->getLocalName()))
+#define LOCALNAME_CAST(elem) LOCALNAME(static_cast<const DOMElement*>(elem))
+
+
+
+namespace uscxml {
+
+class USCXML_API DOMUtils {
+public:
+
+ static const xercesc::DOMNode* getNearestAncestor(const xercesc::DOMNode* node, const std::string tagName);
+ static bool isDescendant(const xercesc::DOMNode* s1, const xercesc::DOMNode* s2);
+
+
+ static bool hasIntersection(const std::list<xercesc::DOMElement*>& l1,
+ const std::list<xercesc::DOMElement*>& l2);
+ static bool isMember(const xercesc::DOMElement* node, const std::list<xercesc::DOMElement*>& list);
+ static bool isMember(const xercesc::DOMNode* node, const std::list<xercesc::DOMNode*>& list);
+ static bool isMember(const xercesc::DOMNode* node, const xercesc::DOMNodeList* list);
+
+ static std::string xPathForNode(const xercesc::DOMNode* node,
+ const std::string& ns = "");
+ static std::string idForNode(const xercesc::DOMNode* node);
+
+ static std::list<xercesc::DOMNode*> getElementsByType(const xercesc::DOMNode* root,
+ xercesc::DOMNode::NodeType type);
+
+ static std::list<xercesc::DOMElement*> inPostFixOrder(const std::string& element,
+ const xercesc::DOMElement* root,
+ const bool includeEmbeddedDoc = false) {
+ std::set<std::string> elements;
+ elements.insert(element);
+ return inPostFixOrder(elements, root, includeEmbeddedDoc);
+ }
+
+ static std::list<xercesc::DOMElement*> inPostFixOrder(const std::set<std::string>& elements,
+ const xercesc::DOMElement* root,
+ const bool includeEmbeddedDoc = false);
+
+
+ static std::list<xercesc::DOMElement*> inDocumentOrder(const std::string& element,
+ const xercesc::DOMElement* root,
+ const bool includeEmbeddedDoc = false) {
+ std::set<std::string> elements;
+ elements.insert(element);
+ return inDocumentOrder(elements, root, includeEmbeddedDoc);
+ }
+
+ static std::list<xercesc::DOMElement*> inDocumentOrder(const std::set<std::string>& elements,
+ const xercesc::DOMElement* root,
+ const bool includeEmbeddedDoc = false);
+
+ static std::list<xercesc::DOMElement*> filterChildElements(const std::string& tagName,
+ const xercesc::DOMElement* node,
+ bool recurse = false);
+
+ static std::list<xercesc::DOMElement*> filterChildElements(const std::string& tagName,
+ const std::list<xercesc::DOMElement*>& nodeSet,
+ bool recurse = false);
+
+ static std::list<xercesc::DOMNode*> filterChildType(const xercesc::DOMNode::NodeType type,
+ const xercesc::DOMNode* node,
+ bool recurse = false);
+
+ static std::list<xercesc::DOMNode*> filterChildType(const xercesc::DOMNode::NodeType type,
+ const std::list<xercesc::DOMNode*>& nodeSet,
+ bool recurse = false);
+
+protected:
+ static void inPostFixOrder(const std::set<std::string>& elements,
+ const xercesc::DOMElement* root,
+ const bool includeEmbeddedDoc,
+ std::list<xercesc::DOMElement*>& nodes);
+
+ static void inDocumentOrder(const std::set<std::string>& elements,
+ const xercesc::DOMElement* root,
+ const bool includeEmbeddedDoc,
+ std::list<xercesc::DOMElement*>& nodes);
+
+
+};
+
+// create a prefix from a given element - useful for copying namespace information
+#define XML_PREFIX(element) X(element->getPrefix() ? X(element->getPrefix()).str() + ":" : "")
+
+class USCXML_API X {
+public :
+
+ X(X const &other) {
+ _localForm = other._localForm;
+ _otherForm = xercesc::XMLString::replicate(other._otherForm);
+ _deallocOther = true;
+ }
+ void operator=(X const &other) { // did we maybe leak before?
+ _localForm = other._localForm;
+ _otherForm = xercesc::XMLString::replicate(other._otherForm);
+ _deallocOther = true;
+ }
+
+ X(const XMLCh* const toTranscode) {
+ if (toTranscode != NULL) {
+ // Call the private transcoding method
+ char* tmp = xercesc::XMLString::transcode(toTranscode);
+ _localForm = std::string(tmp);
+ xercesc::XMLString::release(&tmp);
+ }
+ _otherForm = NULL;
+ _deallocOther = false;
+ }
+
+ X(const std::string& fromTranscode) {
+ // Call the private transcoding method
+ _localForm = fromTranscode;
+ _otherForm = xercesc::XMLString::transcode(fromTranscode.c_str());
+ _deallocOther = true;
+ }
+
+ X(const char* const fromTranscode) {
+ // Call the private transcoding method
+ _localForm = fromTranscode;
+ _otherForm = xercesc::XMLString::transcode(fromTranscode);
+ _deallocOther = true;
+ }
+
+ X(char* fromTranscode) {
+ // Call the private transcoding method
+ _localForm = fromTranscode;
+ _otherForm = xercesc::XMLString::transcode(fromTranscode);
+ _deallocOther = true;
+ }
+
+ X() {
+ _otherForm = NULL;
+ _deallocOther = false;
+ }
+
+ ~X() {
+ if (_deallocOther)
+ xercesc::XMLString::release(&_otherForm);
+ }
+
+ const std::string& str() const {
+ return _localForm;
+ }
+
+ operator const XMLCh* () {
+ assert(_otherForm != NULL); // constructor with XMLCh
+ return _otherForm;
+ }
+
+ operator bool () {
+ return _localForm.size() > 0;
+ }
+
+ operator std::string () {
+ return _localForm;
+ }
+
+protected:
+ friend USCXML_API std::ostream& operator<< (std::ostream& os, const X& data);
+
+private:
+ bool _deallocOther;
+ std::string _localForm;
+ XMLCh* _otherForm;
+};
+
+USCXML_API std::ostream& operator<< (std::ostream& os, const X& xmlString);
+USCXML_API std::ostream& operator<< (std::ostream& os, const xercesc::DOMNode& node);
+
+}
+
+
+#endif /* end of include guard: DOMUTILS_H_WK0WAEA7 */
diff --git a/src/uscxml/util/Predicates.cpp b/src/uscxml/util/Predicates.cpp
new file mode 100644
index 0000000..6ac092f
--- /dev/null
+++ b/src/uscxml/util/Predicates.cpp
@@ -0,0 +1,468 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include "Predicates.h"
+#include "uscxml/util/String.h"
+
+namespace uscxml {
+
+using namespace xercesc;
+
+std::list<DOMElement*> getChildStates(const DOMElement* state, bool properOnly) {
+ std::list<DOMElement*> children;
+
+ DOMNodeList* childElems = state->getChildNodes();
+ for (size_t i = 0; i < childElems->getLength(); i++) {
+ if (childElems->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ DOMElement* childElem = dynamic_cast<DOMElement*>(childElems->item(i));
+ if (isState(childElem, properOnly)) {
+ children.push_back(childElem);
+ }
+ }
+ return children;
+}
+
+std::list<xercesc::DOMElement*> getChildStates(const std::list<xercesc::DOMElement*>& states, bool properOnly) {
+ std::list<xercesc::DOMElement*> children;
+ for (auto stateIter = states.begin(); stateIter != states.end(); stateIter++) {
+ std::list<DOMElement*> tmp = getChildStates(*stateIter, properOnly);
+ children.merge(tmp);
+ }
+ return children;
+}
+
+
+DOMElement* getParentState(const DOMElement* element) {
+ DOMNode* parent = element->getParentNode();
+ while(parent && !isState(dynamic_cast<DOMElement*>(parent))) {
+ parent = parent->getParentNode();
+ }
+ return dynamic_cast<DOMElement*>(parent);
+}
+
+DOMElement* getSourceState(const DOMElement* transition) {
+ if (iequals(TAGNAME_CAST(transition->getParentNode()), XML_PREFIX(transition).str() + "initial"))
+ return dynamic_cast<DOMElement*>(transition->getParentNode()->getParentNode());
+ return dynamic_cast<DOMElement*>(transition->getParentNode());
+}
+
+
+/**
+ See: http://www.w3.org/TR/scxml/#LCCA
+ The Least Common Compound Ancestor is the <state> or <scxml> element s such that s is a proper ancestor
+ of all states on stateList and no descendant of s has this property. Note that there is guaranteed to be
+ such an element since the <scxml> wrapper element is a common ancestor of all states. Note also that since
+ we are speaking of proper ancestor (parent or parent of a parent, etc.) the LCCA is never a member of stateList.
+ */
+
+#define VERBOSE_FIND_LCCA 0
+DOMElement* findLCCA(const std::list<DOMElement*>& states) {
+
+ std::list<DOMElement*> ancestors = getProperAncestors(states.front(), NULL);
+ DOMElement* ancestor = NULL;
+
+ for (auto ancIter = ancestors.begin(); ancIter != ancestors.end(); ancIter++) {
+ if (!isCompound(dynamic_cast<DOMElement*>(*ancIter)))
+ continue;
+ for (auto stateIter = states.begin(); stateIter != states.end(); stateIter++) {
+
+#if VERBOSE_FIND_LCCA
+ std::cerr << "Checking " << ATTR_CAST(states[j], "id") << " and " << ATTR_CAST(ancestors[i], "id") << std::endl;
+#endif
+
+ if (!DOMUtils::isDescendant(*stateIter, *ancIter))
+ goto NEXT_ANCESTOR;
+ }
+ ancestor = *ancIter;
+ break;
+NEXT_ANCESTOR:
+ ;
+ }
+
+ // take uppermost root as ancestor
+ if (!ancestor)
+ ancestor = ancestors.back();
+
+#if VERBOSE_FIND_LCCA
+ std::cerr << " -> " << ATTR_CAST(ancestor, "id") << " " << ancestor.getLocalName() << std::endl;
+#endif
+ return ancestor;
+}
+
+/*
+ * If state2 is null, returns the set of all ancestors of state1 in ancestry order
+ * (state1's parent followed by the parent's parent, etc. up to an including the <scxml>
+ * element). If state2 is non-null, returns in ancestry order the set of all ancestors
+ * of state1, up to but not including state2. (A "proper ancestor" of a state is its
+ * parent, or the parent's parent, or the parent's parent's parent, etc.))If state2 is
+ * state1's parent, or equal to state1, or a descendant of state1, this returns the empty set.
+ */
+
+std::list<DOMElement*> getProperAncestors(const DOMElement* s1, const DOMElement* s2) {
+
+ std::list<DOMElement*> ancestors;
+ if (isState(s1)) {
+ DOMNode* node = (DOMNode*)s1;
+ while((node = node->getParentNode())) {
+ if (node->getNodeType() != DOMNode::ELEMENT_NODE)
+ break;
+
+ const DOMElement* nodeElem = dynamic_cast<const DOMElement*>(node);
+ if (!isState(nodeElem))
+ break;
+ if (!iequals(LOCALNAME(nodeElem), "parallel") &&
+ !iequals(LOCALNAME(nodeElem), "state") &&
+ !iequals(LOCALNAME(nodeElem), "scxml"))
+ break;
+ if (node == s2)
+ break;
+ ancestors.push_back(dynamic_cast<DOMElement*>(node));
+ }
+ }
+ return ancestors;
+}
+
+std::list<DOMElement*> getExitSet(const DOMElement* transition, const DOMElement* root) {
+ std::list<DOMElement*> statesToExit;
+ if (HAS_ATTR(transition, "target")) {
+ DOMElement* domain = getTransitionDomain(transition, root);
+ if (!domain)
+ return statesToExit;
+
+ // std::cout << DOMUtils::xPathForNode(domain) << std::endl;
+
+ std::set<std::string> elements;
+ elements.insert(XML_PREFIX(transition).str() + "parallel");
+ elements.insert(XML_PREFIX(transition).str() + "state");
+ elements.insert(XML_PREFIX(transition).str() + "final");
+ statesToExit = DOMUtils::inDocumentOrder(elements, domain);
+
+ if (statesToExit.front() == domain) {
+ statesToExit.pop_front(); // do not include domain itself
+ }
+ }
+
+ return statesToExit;
+}
+
+bool conflicts(const DOMElement* t1, const DOMElement* t2, const DOMElement* root) {
+ return (DOMUtils::hasIntersection(getExitSet(t1, root), getExitSet(t2, root)) ||
+ (getSourceState(t1) == getSourceState(t2)) ||
+ (DOMUtils::isDescendant(getSourceState(t1), getSourceState(t2))) ||
+ (DOMUtils::isDescendant(getSourceState(t2), getSourceState(t1))));
+}
+
+bool isState(const DOMElement* state, bool properOnly) {
+ if (!state)
+ return false;
+
+ std::string localName = LOCALNAME(state);
+ if (iequals("state", localName))
+ return true;
+ if (iequals("scxml", localName))
+ return true;
+ if (iequals("parallel", localName))
+ return true;
+ if (iequals("final", localName))
+ return true;
+ if (properOnly)
+ return false;
+
+ if (iequals("history", localName))
+ return true;
+ if (iequals("initial", localName))
+ return true;
+
+ return false;
+}
+
+bool isFinal(const DOMElement* state) {
+ std::string localName = LOCALNAME(state);
+ if (iequals("final", localName))
+ return true;
+ if (HAS_ATTR(state, "final") && iequals("true", ATTR(state, "final")))
+ return true;
+ return false;
+}
+
+bool isAtomic(const DOMElement* state) {
+ if (!isState(state))
+ return false;
+
+ if (iequals("final", LOCALNAME(state)))
+ return true;
+
+ if (iequals("parallel", LOCALNAME(state)))
+ return false;
+
+ if (getChildStates(state).size() > 0)
+ return false;
+
+ return true;
+}
+
+bool isHistory(const DOMElement* state) {
+ if (iequals("history", LOCALNAME(state)))
+ return true;
+ return false;
+}
+
+bool isParallel(const DOMElement* state) {
+ if (!isState(state))
+ return false;
+ if (iequals("parallel", LOCALNAME(state)))
+ return true;
+ return false;
+}
+
+
+bool isCompound(const DOMElement* state) {
+ if (!isState(state))
+ return false;
+
+ if (iequals(LOCALNAME(state), "parallel")) // parallel is no compound state
+ return false;
+
+ if (getChildStates(state).size() > 0)
+ return true;
+
+ return false;
+}
+
+std::list<DOMElement*> getTargetStates(const DOMElement* transition, const DOMElement* root) {
+ std::list<DOMElement*> targetStates;
+
+ std::string targetId = ATTR(transition, "target");
+ std::list<std::string> targetIds = tokenize(ATTR(transition, "target"));
+
+ for (auto targetIter = targetIds.begin(); targetIter != targetIds.end(); targetIter++) {
+ DOMElement* state = getState(*targetIter, root);
+ if (state) {
+ targetStates.push_back(state);
+ }
+ }
+ return targetStates;
+}
+
+
+DOMElement* getTransitionDomain(const DOMElement* transition, const DOMElement* root) {
+ std::list<DOMElement*> tStates = getTargetStates(transition, root);
+ if (tStates.size() == 0) {
+ return NULL;
+ }
+ std::string transitionType = (HAS_ATTR(transition, "type") ? ATTR(transition, "type") : "external");
+ DOMElement* source = getSourceState(transition);
+
+ if (iequals(transitionType, "internal") && isCompound(source)) {
+ for (auto tIter = tStates.begin(); tIter != tStates.end(); tIter++) {
+ if (!DOMUtils::isDescendant(*tIter, source))
+ goto BREAK_LOOP;
+ }
+ return source;
+ }
+
+BREAK_LOOP:
+ tStates.push_front(source);
+ return findLCCA(tStates);
+}
+
+std::list<DOMElement*> getStates(const std::list<std::string>& stateIds, const DOMElement* root) {
+ std::list<DOMElement*> states;
+ std::list<std::string>::const_iterator tokenIter = stateIds.begin();
+ while(tokenIter != stateIds.end()) {
+ states.push_back(getState(*tokenIter, root));
+ tokenIter++;
+ }
+ return states;
+}
+
+DOMElement* getState(const std::string& stateId, const DOMElement* root) {
+
+ std::list<const DOMElement*> stateStack;
+ stateStack.push_back(root);
+
+ while(stateStack.size() > 0) {
+ const DOMElement* curr = stateStack.front();
+ stateStack.pop_front();
+
+ if (!isState(curr, false))
+ assert(false);
+
+// std::cout << *curr;
+
+ if (HAS_ATTR(curr, "id") && ATTR(curr, "id") == stateId)
+ return (DOMElement*)curr;
+
+ std::list<DOMElement*> children = getChildStates(curr, false);
+ stateStack.insert(stateStack.end(), children.begin(), children.end());
+ }
+
+ return NULL;
+}
+
+/**
+ * In a conformant SCXML document, a compound state may specify either an "initial"
+ * attribute or an <initial> element, but not both. See 3.6 <initial> for a
+ * discussion of the difference between the two notations. If neither the "initial"
+ * attribute nor an <initial> element is specified, the SCXML Processor must use
+ * the first child state in document order as the default initial state.
+ */
+std::list<DOMElement*> getInitialStates(const DOMElement* state, const DOMElement* root) {
+ if (!state) {
+ state = root;
+ }
+
+#if VERBOSE
+ std::cerr << "Getting initial state of " << TAGNAME(state) << " " << ATTR(state, "id") << std::endl;
+#endif
+
+ if (isAtomic(state)) {
+ return std::list<DOMElement*>();
+ }
+
+ if (isParallel(state)) {
+ return getChildStates(state);
+ }
+
+ if (isCompound(state)) {
+ // initial attribute at element
+ if (HAS_ATTR(state, "initial")) {
+ return getStates(tokenize(ATTR(state, "initial")), root);
+ }
+
+ // initial element as child
+ std::list<DOMElement*> initElems = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "initial", state);
+ if(initElems.size() > 0 ) {
+ std::list<DOMElement*> initTrans = DOMUtils::filterChildElements(XML_PREFIX(initElems.front()).str() + "transition", initElems.front());
+ if (initTrans.size() > 0 && HAS_ATTR(initTrans.front(),"target")) {
+ return getTargetStates(initTrans.front(), root);
+ }
+ return std::list<DOMElement*>();
+ }
+
+ // first child state
+ std::list<DOMElement*> initStates;
+ DOMNodeList* children = state->getChildNodes();
+ for (size_t i = 0; i < children->getLength(); i++) {
+ if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE)
+ continue;
+ DOMElement* childElem = dynamic_cast<DOMElement*>(children->item(i));
+ if (isState(childElem)) {
+ initStates.push_back(childElem);
+ return initStates;
+ }
+ }
+ }
+
+ // nothing found
+ return std::list<DOMElement*>();
+}
+
+std::list<DOMElement*> getReachableStates(const DOMElement* root) {
+ /** Check which states are reachable */
+
+ std::list<DOMElement*> reachable; // total transitive hull
+ std::list<DOMElement*> additions; // nodes added in last iteration
+ std::list<DOMElement*> current; // new nodes caused by nodes added
+ additions.push_back((DOMElement*)root);
+
+ while (additions.size() > 0) {
+
+#if 0
+ for (auto stateIter = additions.begin(); stateIter != additions.end(); stateIter++) {
+ DOMElement* state = *stateIter;
+ std::cout << (HAS_ATTR(state, "id") ? ATTR(state, "id") : (std::string)X(state->getLocalName())) << ", " << std::endl;
+ }
+#endif
+ // reachable per initial attribute or document order - size will increase as we append new states
+ for (auto stateIter = additions.begin(); stateIter != additions.end(); stateIter++) {
+ // get the state's initial states
+ DOMElement* state = *stateIter;
+ std::list<DOMElement*> initials = getInitialStates(state, root);
+ for (auto initIter = initials.begin(); initIter != initials.end(); initIter++) {
+ DOMElement* initial = *initIter;
+ if (!DOMUtils::isMember(initial, additions) && !DOMUtils::isMember(initial, reachable)) {
+ current.push_back(initial);
+ }
+ }
+ }
+
+ // reachable per target attribute in transitions
+ for (auto stateIter = additions.begin(); stateIter != additions.end(); stateIter++) {
+ DOMElement* state = *stateIter;
+ std::list<DOMElement*> transitions = DOMUtils::filterChildElements(XML_PREFIX(state).str() + "transition", state, false);
+ for (auto transIter = transitions.begin(); transIter != transitions.end(); transIter++) {
+ DOMElement* transition = *transIter;
+ std::list<DOMElement*> targets = getTargetStates(transition, root);
+ for (auto targetIter = targets.begin(); targetIter != targets.end(); targetIter++) {
+ DOMElement* target = *targetIter;
+ if (!DOMUtils::isMember(target, additions) && !DOMUtils::isMember(target, reachable)) {
+ current.push_back(target);
+ }
+ }
+ }
+ }
+
+ // reachable via a reachable child state
+ for (auto stateIter = additions.begin(); stateIter != additions.end(); stateIter++) {
+ DOMElement* state = *stateIter;
+ if (isAtomic(state)) {
+ // iterate the states parents
+ DOMNode* parent = state->getParentNode();
+ while(parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) {
+ DOMElement* parentElem = static_cast<DOMElement*>(parent);
+ if (!isState(parentElem)) {
+ break;
+ }
+ if (!DOMUtils::isMember(parentElem, additions) && !DOMUtils::isMember(parentElem, reachable)) {
+ current.push_back(parentElem);
+ }
+ parent = parent->getParentNode();
+ }
+ }
+ }
+
+ // add all additions from last iterations to reachable set
+ reachable.insert(reachable.end(), additions.begin(), additions.end());
+
+ // set current additions as new additions
+ additions = current;
+
+ // clear current set for next iteration
+ current.clear();
+ }
+
+ return reachable;
+}
+
+
+bool isInEmbeddedDocument(const DOMNode* node) {
+ // a node is in an embedded document if there is a content element in its parents
+ const DOMNode* parent = node;
+ while(parent) {
+ if(iequals(LOCALNAME(parent), "content")) {
+ return true;
+ }
+ parent = parent->getParentNode();
+ }
+ return false;
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/util/Predicates.h b/src/uscxml/util/Predicates.h
new file mode 100644
index 0000000..50c69b6
--- /dev/null
+++ b/src/uscxml/util/Predicates.h
@@ -0,0 +1,61 @@
+/**
+ * @file
+ * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef PREDICATES_H_D3A20484
+#define PREDICATES_H_D3A20484
+
+#include <string>
+#include <list>
+#include <xercesc/dom/DOM.hpp>
+#include "uscxml/util/DOM.h"
+#include "uscxml/util/Convenience.h"
+
+namespace uscxml {
+
+std::list<xercesc::DOMElement*> getChildStates(const xercesc::DOMElement* state, bool properOnly = true);
+std::list<xercesc::DOMElement*> getChildStates(const std::list<xercesc::DOMElement*>& states, bool properOnly = true);
+xercesc::DOMElement* getParentState(const xercesc::DOMElement* element);
+xercesc::DOMElement* getSourceState(const xercesc::DOMElement* transition);
+xercesc::DOMElement* findLCCA(const std::list<xercesc::DOMElement*>& states);
+std::list<xercesc::DOMElement*> getProperAncestors(const xercesc::DOMElement* s1, const xercesc::DOMElement* s2);
+
+std::list<xercesc::DOMElement*> getTargetStates(const xercesc::DOMElement* transition, const xercesc::DOMElement* root);
+std::list<xercesc::DOMElement*> getEffectiveTargetStates(const xercesc::DOMElement* transition);
+xercesc::DOMElement* getTransitionDomain(const xercesc::DOMElement* transition, const xercesc::DOMElement* root);
+
+bool isInEmbeddedDocument(const xercesc::DOMNode* node);
+
+std::list<xercesc::DOMElement*> getStates(const std::list<std::string>& stateIds, const xercesc::DOMElement* root);
+xercesc::DOMElement* getState(const std::string& stateId, const xercesc::DOMElement* root);
+std::list<xercesc::DOMElement*> getInitialStates(const xercesc::DOMElement* state, const xercesc::DOMElement* root);
+std::list<xercesc::DOMElement*> getReachableStates(const xercesc::DOMElement* root);
+std::list<xercesc::DOMElement*> getExitSet(const xercesc::DOMElement* transition, const xercesc::DOMElement* root);
+bool conflicts(const xercesc::DOMElement* transition1, const xercesc::DOMElement* transition2, const xercesc::DOMElement* root);
+
+bool isState(const xercesc::DOMElement* state, bool properOnly = true);
+bool isCompound(const xercesc::DOMElement* state);
+bool isAtomic(const xercesc::DOMElement* state);
+bool isParallel(const xercesc::DOMElement* state);
+bool isFinal(const xercesc::DOMElement* state);
+bool isHistory(const xercesc::DOMElement* state);
+
+
+}
+
+#endif /* end of include guard: PREDICATES_H_D3A20484 */
diff --git a/src/uscxml/URL.cpp b/src/uscxml/util/URL.cpp
index 8b02d53..ad271d5 100644
--- a/src/uscxml/URL.cpp
+++ b/src/uscxml/util/URL.cpp
@@ -17,203 +17,213 @@
* @endcond
*/
-#include <glog/logging.h>
#include "URL.h"
-#include "UUID.h"
+#include "uscxml/messages/Event.h"
-#include <sys/stat.h>
+#include <string>
+#include <cassert>
+#include <easylogging++.h>
#include "uscxml/config.h"
-#include <fstream>
-#include <boost/lexical_cast.hpp>
-#include <stdio.h> /* defines FILENAME_MAX */
+
#ifdef _WIN32
-#include <fcntl.h>
-#include <sys/types.h>
-#include <io.h>
-#include <direct.h>
-#include <Shlobj.h>
#define getcwd _getcwd
#else
-#include <unistd.h>
-#include <sys/types.h>
-#include <pwd.h>
+#include <unistd.h> // getcwd
+//#include <pwd.h>
#endif
-#include "uscxml/messages/Event.h"
+namespace uscxml {
-#include <cstdlib> // mkstemp
-#ifdef HAS_UNISTD_H
-#include <unistd.h> // mkstemp legacy
-#endif
+void URLImpl::prepareException(ErrorEvent& exception, int errorCode, const std::string& origUri, UriParserStateA* parser) {
+ exception.data.compound["uri"].atom = origUri;
-#include <boost/algorithm/string.hpp>
+ if (parser != NULL && parser->errorPos != NULL) {
+ const char* startPtr = origUri.c_str();
+ while(startPtr != parser->errorPos && *startPtr != '\0') {
+ exception.data.compound["urk"].atom += " ";
+ startPtr++;
+ }
+ exception.data.compound["urk"].atom += "^";
+ }
-namespace uscxml {
+ switch (errorCode) {
+ case URI_ERROR_SYNTAX:
+ exception.data.compound["cause"].atom = "Parsed text violates expected format";
+ break;
+ case URI_ERROR_NULL:
+ exception.data.compound["cause"].atom = "One of the params passed was NULL although it mustn't be";
+ break;
+ case URI_ERROR_MALLOC:
+ exception.data.compound["cause"].atom = "Requested memory could not be allocated";
+ break;
+ case URI_ERROR_OUTPUT_TOO_LARGE:
+ exception.data.compound["cause"].atom = "Some output is to large for the receiving buffer";
+ break;
+ case URI_ERROR_NOT_IMPLEMENTED:
+ exception.data.compound["cause"].atom = "The called function is not implemented yet";
+ break;
+ case URI_ERROR_RANGE_INVALID:
+ exception.data.compound["cause"].atom = "The parameters passed contained invalid ranges";
+ break;
+ case URI_ERROR_ADDBASE_REL_BASE:
+ exception.data.compound["cause"].atom = "Given base is not absolute";
+ break;
+ case URI_ERROR_REMOVEBASE_REL_SOURCE:
+ exception.data.compound["cause"].atom = "Given base is not absolute";
+ break;
-void URL::dump() {
- std::cout << ">>>" << asString() << "<<< ";
- std::cout << (isAbsolute() ? "absolute" : "relative") << std::endl;
- std::cout << "[scheme]" << scheme();
- std::cout << "[host]" << host();
- std::cout << "[port]" << port();
- std::cout << "[path]" << path();
- std::cout << "[file]" << file() << std::endl;
- std::cout << "[segmts " << pathComponents().size() << "]: ";
- for (size_t i = 0; i < pathComponents().size(); i++) {
- std::cout << pathComponents()[i] << ", ";
- }
- std::cout << std::endl << std::endl;
+ default:
+ break;
+ }
}
-std::string URL::tmpDir() {
- // 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/";
-
-#if 0
- char* tmpl = (char*)malloc(strlen(tmpDir) + 11);
- char* writePtr = tmpl;
- memcpy(writePtr, tmpDir, strlen(tmpDir));
- writePtr += strlen(tmpDir);
- memcpy(writePtr, "scxmlXXXXXX", 11);
- writePtr += 11;
- tmpl[writePtr - tmpl] = 0;
- return tmpl;
-#endif
- return tmpDir;
+URLImpl::URLImpl() : _handle(NULL), _isDownloaded(false), _hasFailed(false) {
}
-std::map<std::string, std::string> URL::mimeTypes;
-std::string URL::getMimeType(const std::string extension, std::string magic) {
- if (mimeTypes.empty()) {
- mimeTypes["txt"] = "text/plain";
- mimeTypes["c"] = "text/plain";
- mimeTypes["h"] = "text/plain";
- mimeTypes["html"] = "text/html";
- mimeTypes["htm"] = "text/htm";
- mimeTypes["css"] = "text/css";
- mimeTypes["bmp"] = "image/bmp";
- mimeTypes["gif"] = "image/gif";
- mimeTypes["jpg"] = "image/jpeg";
- mimeTypes["jpeg"] = "image/jpeg";
- mimeTypes["mpg"] = "video/mpeg";
- mimeTypes["mov"] = "video/quicktime";
- mimeTypes["png"] = "image/png";
- mimeTypes["pdf"] = "application/pdf";
- mimeTypes["ps"] = "application/postscript";
- mimeTypes["tif"] = "image/tiff";
- mimeTypes["tiff"] = "image/tiff";
- }
-
- if (mimeTypes.find(extension) != mimeTypes.end()) {
- return mimeTypes[extension];
- }
- return "application/octet-stream";
-}
+URLImpl::URLImpl(const std::string& url) : _orig(url), _handle(NULL), _isDownloaded(false), _hasFailed(false) {
+ UriParserStateA state;
+ state.uri = &_uri;
+
+ int err = uriParseUriA(&state, _orig.c_str());
+ if (err != URI_SUCCESS) {
+ UriParserStateA state2;
+ state2.uri = &_uri;
+ char* tmp = (char*)malloc(8 + 3 * _orig.size() + 1);
+ uriWindowsFilenameToUriStringA(_orig.c_str(), tmp);
+ _orig = std::string(tmp);
+ err = uriParseUriA(&state2, _orig.c_str());
+ free(tmp);
+ }
-std::string URL::getTmpFilename(const std::string& suffix) {
- std::string tmpFilename = tmpDir();
- if (tmpFilename.find_last_of(PATH_SEPERATOR) != tmpFilename.length() - 1)
- tmpFilename += PATH_SEPERATOR;
+ if (err != URI_SUCCESS) {
+ UriParserStateA state2;
+ state2.uri = &_uri;
- tmpFilename += UUID::getUUID();
- if (suffix.length() > 0) {
- tmpFilename += ".";
- tmpFilename += suffix;
+ char* tmp = (char*)malloc(7 + 3 * _orig.size() + 1 );
+ uriUnixFilenameToUriStringA(_orig.c_str(), tmp);
+ _orig = std::string(tmp);
+ err = uriParseUriA(&state2, _orig.c_str());
+ free(tmp);
}
- return tmpFilename;
-}
-#if (!defined APPLE && !defined IOS)
-std::string URL::getResourceDir() {
-#ifdef _WIN32
- TCHAR szPath[MAX_PATH];
- if (SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath)) {
- return szPath;
- } else {
- return getenv("APPDATA");
+ if (err != URI_SUCCESS) {
+ ErrorEvent exc;
+ prepareException(exc, err, _orig, &state);
+ throw exc;
}
-#else
- struct passwd* pw = getpwuid(getuid());
- std::string homedir(pw->pw_dir);
- struct stat dirStat;
- int err = 0;
+}
+
+URLImpl::~URLImpl() {
+ uriFreeUriMembersA(&_uri);
+}
- err = stat(std::string(homedir + PATH_SEPERATOR + ".config").c_str(), &dirStat);
- if (err == ENOENT) {
- err = mkdir(std::string(homedir + PATH_SEPERATOR + ".config").c_str(), S_IWUSR | S_IRUSR | S_IROTH);
+URL URLImpl::resolve(URLImpl* relative, URLImpl* absolute) {
+ std::shared_ptr<URLImpl> dest(new URLImpl());
+ int err = uriAddBaseUriExA(&(dest->_uri), &(relative->_uri), &(absolute->_uri), URI_RESOLVE_IDENTICAL_SCHEME_COMPAT);
+ if (err != URI_SUCCESS) {
+ ErrorEvent exc("Cannot resolve " + (std::string)(*relative) + " with " + (std::string)(*absolute));
+ prepareException(exc, err, "", NULL);
+ throw exc;
}
- err = stat(std::string(homedir + PATH_SEPERATOR + ".config" + PATH_SEPERATOR + "uscxml").c_str(), &dirStat);
- if (err != 0) {
- std::cout << std::string(homedir + PATH_SEPERATOR + ".config" + PATH_SEPERATOR + "uscxml") << std::endl;
- err = mkdir(std::string(homedir + PATH_SEPERATOR + ".config" + PATH_SEPERATOR + "uscxml").c_str(),
- S_IWUSR | S_IRUSR | S_IROTH | S_IRGRP | S_IXUSR | S_IXOTH | S_IXGRP);
+ // serialize as string and reparse to mantain string in _orig
+ return URL((std::string)(*dest.get()));
+}
+
+URL URLImpl::resolveWithCWD(URLImpl* relative) {
+ char currPath[FILENAME_MAX];
+ if (!getcwd(currPath, sizeof(currPath))) {
+ ERROR_PLATFORM_THROW("Cannot get current working directory");
}
+ currPath[sizeof(currPath) - 1] = '\0'; /* not really required */
+
+
+ std::shared_ptr<URLImpl> cwdURL(new URLImpl(std::string("file://") + currPath));
+
+ return resolve(relative, cwdURL.get());
+}
- err = stat(std::string(homedir + PATH_SEPERATOR + ".config" + PATH_SEPERATOR + "uscxml").c_str(), &dirStat);
- if (err == 0) {
- return homedir + PATH_SEPERATOR + ".config" + PATH_SEPERATOR + "uscxml";
+URL URLImpl::refer(URLImpl* absoluteSource, URLImpl* absoluteBase) {
+ std::shared_ptr<URLImpl> dest(new URLImpl());
+ int err = uriRemoveBaseUriA(&(dest->_uri), &(absoluteSource->_uri), &(absoluteBase->_uri), URI_FALSE);
+ if (err != URI_SUCCESS) {
+ ErrorEvent exc("Cannot make a relative reference for " + (std::string)(*absoluteSource) + " with " + (std::string)(*absoluteBase));
+ prepareException(exc, err, "", NULL);
+ throw exc;
}
- return "";
-#endif
+
+ // serialize as string and reparse to mantain string in _orig
+ return URL((std::string)(*dest.get()));
}
-#endif
-URLImpl::URLImpl(const std::string& url) : _handle(NULL), _isDownloaded(false), _hasFailed(false) {
- if (url[0] == '/') {
- _uri = Arabica::io::URI("file://" + url);
- } else {
- _uri = Arabica::io::URI(url);
+void URLImpl::normalize() {
+ int err = uriNormalizeSyntaxA(&_uri);
+ if (err != URI_SUCCESS) {
+ ErrorEvent exc("Cannot normalize URL " + (std::string)*this);
+ prepareException(exc, err, _orig, NULL);
+ throw exc;
}
- std::stringstream ss(_uri.path());
- std::string item;
- while(std::getline(ss, item, '/')) {
- if (item.length() == 0)
- continue;
- _pathComponents.push_back(item);
+}
+
+std::string URLImpl::path() const {
+ UriPathSegmentA* firstSeg = _uri.pathHead;
+ UriPathSegmentA* lastSeg = firstSeg;
+ while(lastSeg->next) {
+ lastSeg = lastSeg->next;
}
+ std::string path;
+
+ // what a mess!
+ if (_uri.absolutePath ||
+ (_uri.pathHead != NULL &&
+ (_uri.hostText.first != NULL ||
+ _uri.hostData.ip4 != NULL ||
+ _uri.hostData.ip6 != NULL ||
+ _uri.hostData.ipFuture.first != NULL))) {
+ path += "/";
+ }
+ path += std::string(firstSeg->text.first, lastSeg->text.afterLast - firstSeg->text.first);
+ return path;
}
-URLImpl::~URLImpl() {
- if (_handle != NULL)
- curl_easy_cleanup(_handle);
+std::list<std::string> URLImpl::pathComponents() const {
+ std::list<std::string> pathList;
+
+ UriPathSegmentA* currSeg = _uri.pathHead;
+ while(currSeg != NULL) {
+ pathList.push_back(USCXML_URI_STRING((*currSeg), text));
+ currSeg = currSeg->next;
+ }
+
+ return pathList;
}
-URLImpl::operator Data() const {
- Data data;
- data.compound["url"] = Data(asString(), Data::VERBATIM);
- data.compound["host"] = Data(_uri.host(), Data::VERBATIM);
- data.compound["scheme"] = Data(_uri.scheme(), Data::VERBATIM);
- data.compound["path"] = Data(_uri.path(), Data::VERBATIM);
- data.compound["port"] = Data(_uri.port(), Data::INTERPRETED);
- data.compound["isAbsolute"] = Data(_uri.is_absolute());
- if (_statusCode.length() > 0)
- data.compound["statusCode"] = Data(_statusCode, Data::VERBATIM);
- if (_statusMsg.length() > 0)
- data.compound["statusMsg"] = Data(_statusMsg, Data::VERBATIM);
+std::map<std::string, std::string> URLImpl::query() const {
+ UriQueryListA * queryList;
+ UriQueryListA * currList;
+ std::map<std::string, std::string> queryMap;
+ int itemCount;
+ int err = uriDissectQueryMallocA(&queryList, &itemCount, _uri.query.first, _uri.query.afterLast);
+ if (err != URI_SUCCESS) {
+ ErrorEvent exc("Cannot get query from URL " + (std::string)*this);
+ prepareException(exc, err, _orig, NULL);
+ throw exc;
+ }
- std::vector<std::string>::const_iterator pathIter = _pathComponents.begin();
- while(pathIter != _pathComponents.end()) {
- data.compound["pathComponent"].array.push_back(Data(*pathIter, Data::VERBATIM));
- pathIter++;
+ currList = queryList;
+ while(currList != NULL) {
+ queryMap[currList->key] = currList->value != NULL ? currList->value : "";
+ currList = currList->next;
}
- return data;
+ uriFreeQueryListA(queryList);
+
+ return queryMap;
}
CURL* URLImpl::getCurlHandle() {
@@ -229,7 +239,7 @@ size_t URLImpl::writeHandler(void *ptr, size_t size, size_t nmemb, void *userdat
URLImpl* url = (URLImpl*)userdata;
url->_rawInContent.write((char*)ptr, size * nmemb);
- monIter_t monIter = url->_monitors.begin();
+ std::set<URLMonitor*>::iterator monIter = url->_monitors.begin();
while(monIter != url->_monitors.end()) {
(*monIter)->contentChunkReceived(URL(url->shared_from_this()), std::string((char*)ptr, size * nmemb));
monIter++;
@@ -242,7 +252,7 @@ size_t URLImpl::headerHandler(void *ptr, size_t size, size_t nmemb, void *userda
URLImpl* url = (URLImpl*)userdata;
url->_rawInHeader.write((char*)ptr, size * nmemb);
- monIter_t monIter = url->_monitors.begin();
+ std::set<URLMonitor*>::iterator monIter = url->_monitors.begin();
while(monIter != url->_monitors.end()) {
(*monIter)->headerChunkReceived(URL(url->shared_from_this()), std::string((char*)ptr, size * nmemb));
monIter++;
@@ -252,7 +262,7 @@ size_t URLImpl::headerHandler(void *ptr, size_t size, size_t nmemb, void *userda
}
void URLImpl::downloadStarted() {
-// LOG(INFO) << "Starting download of " << asString() << std::endl;
+ // LOG(INFO) << "Starting download of " << asString() << std::endl;
_rawInContent.str("");
_rawInContent.clear();
_rawInHeader.str("");
@@ -261,7 +271,7 @@ void URLImpl::downloadStarted() {
_statusMsg = "";
_statusCode = "";
- monIter_t monIter = _monitors.begin();
+ std::set<URLMonitor*>::iterator monIter = _monitors.begin();
while(monIter != _monitors.end()) {
(*monIter)->downloadStarted(URL(shared_from_this()));
monIter++;
@@ -269,7 +279,7 @@ void URLImpl::downloadStarted() {
}
void URLImpl::downloadCompleted() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
if (iequals(scheme(), "http")) {
// process header fields
@@ -302,7 +312,7 @@ void URLImpl::downloadCompleted() {
_isDownloaded = true;
_condVar.notify_all();
- monIter_t monIter = _monitors.begin();
+ std::set<URLMonitor*>::iterator monIter = _monitors.begin();
while(monIter != _monitors.end()) {
(*monIter)->downloadCompleted(URL(shared_from_this()));
monIter++;
@@ -310,16 +320,14 @@ void URLImpl::downloadCompleted() {
}
void URLImpl::downloadFailed(CURLcode errorCode) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
-
- LOG(ERROR) << "Downloading " << asString() << " failed: " << curl_easy_strerror(errorCode);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
_error = curl_easy_strerror(errorCode);
_hasFailed = true;
_isDownloaded = false;
_condVar.notify_all();
- monIter_t monIter = _monitors.begin();
+ std::set<URLMonitor*>::iterator monIter = _monitors.begin();
while(monIter != _monitors.end()) {
(*monIter)->downloadFailed(URL(shared_from_this()), errorCode);
monIter++;
@@ -327,59 +335,8 @@ void URLImpl::downloadFailed(CURLcode errorCode) {
}
-const std::string URLImpl::getInHeaderField(const std::string& key) {
- std::map<std::string, std::string> headerFields = getInHeaderFields();
- if (headerFields.find(key) != headerFields.end()) {
- return headerFields[key];
- }
- return "";
-}
-
-const std::string URLImpl::getStatusCode() {
- if (!_isDownloaded)
- download(true);
- return _statusCode;
-}
-
-const std::string URLImpl::getStatusMessage() {
- if (!_isDownloaded)
- download(true);
- return _statusMsg;
-}
-
-
-const std::map<std::string, std::string> URLImpl::getInHeaderFields() {
- if (!_isDownloaded)
- download(true);
-
- return _inHeaders;
-}
-
-void URLImpl::setRequestType(const std::string& requestType) {
- _requestType = requestType;
-}
-
-void URLImpl::setOutContent(const std::string& content) {
- _outContent = content;
- _requestType = "POST";
-}
-
-const std::string URLImpl::getInContent(bool forceReload) {
- if (!_isDownloaded) {
- download(true);
- }
- return _rawInContent.str();
-}
-
-const std::string URLImpl::file() const {
- if (_pathComponents.size() > 0 && !boost::ends_with(path(), "/")) {
- return _pathComponents[_pathComponents.size() - 1];
- }
- return "";
-}
-
const void URLImpl::download(bool blocking) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
if (_isDownloaded)
return;
@@ -393,15 +350,13 @@ const void URLImpl::download(bool blocking) {
}
if (_hasFailed) {
ERROR_COMMUNICATION(exc, _error);
- exc.data = URL(shared_from_this());
- if (_error.length() > 0)
- exc.data.compound["cause"] = Data(_error, Data::VERBATIM);
+// exc.data = URL(shared_from_this());
throw exc;
}
if (iequals(scheme(), "http")) {
- if (_statusCode.size() > 0 && boost::lexical_cast<int>(_statusCode) > 400) {
+ if (_statusCode.size() > 0 && strTo<int>(_statusCode) > 400) {
ERROR_COMMUNICATION(exc, _error);
- exc.data = URL(shared_from_this());
+// exc.data = URL(shared_from_this());
if (_error.length() > 0)
exc.data.compound["cause"] = Data(_error, Data::VERBATIM);
throw exc;
@@ -410,154 +365,52 @@ const void URLImpl::download(bool blocking) {
}
}
-const bool URLImpl::toAbsoluteCwd() {
- char currPath[FILENAME_MAX];
- if (!getcwd(currPath, sizeof(currPath))) {
- return false;
- }
- currPath[sizeof(currPath) - 1] = '\0'; /* not really required */
-#ifdef _WIN32
- return toAbsolute(std::string("file://" + std::string(currPath) + "/"));
-#else
- return toAbsolute(std::string("file://" + std::string(currPath) + "/"));
-#endif
-}
-
-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;
+URLImpl::operator Data() const {
+ Data data;
+ data.compound["url"] = Data(std::string(*this), Data::VERBATIM);
+ data.compound["host"] = Data(host(), Data::VERBATIM);
+ data.compound["scheme"] = Data(scheme(), Data::VERBATIM);
+ data.compound["path"] = Data(path(), Data::VERBATIM);
+ data.compound["port"] = Data(port(), Data::INTERPRETED);
+ data.compound["isAbsolute"] = Data(isAbsolute());
+ if (_statusCode.length() > 0)
+ data.compound["statusCode"] = Data(_statusCode, Data::VERBATIM);
+ if (_statusMsg.length() > 0)
+ data.compound["statusMsg"] = Data(_statusMsg, Data::VERBATIM);
-#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 "";
+ std::list<std::string> pathComps = pathComponents();
+ std::list<std::string>::const_iterator pathIter = pathComps.begin();
+ while(pathIter != pathComps.end()) {
+ data.compound["pathComponent"].array.push_back(Data(*pathIter, Data::VERBATIM));
+ pathIter++;
}
-#ifdef WIN32
- _close(fd);
-#else
- close(fd);
-#endif
- return std::string(tmpl);
-}
-
-void URL::toBaseURL(URL& uri) {
- uri = asBaseURL(uri);
-}
-URL URL::asBaseURL(const URL& uri) {
- std::string uriStr = uri.asString();
- std::string baseUriStr = uriStr.substr(0, uriStr.find_last_of("/\\") + 1);
-#ifdef _WIN32
- if (baseUriStr.find("file://") == 0) {
- baseUriStr = baseUriStr.substr(7);
- }
-#endif
- return URL(baseUriStr);
+ return data;
}
-const bool URLImpl::toAbsolute(const std::string& baseUrl) {
- if (_uri.is_absolute())
- return true;
-
- std::string uriStr = _uri.as_string();
-// std::cout << "## bas # " << baseUrl << std::endl;
-// std::cout << "## rel # " << _uri.as_string() << std::endl;
-
-#ifdef _WIN32
- if (baseUrl.find("file://") == 0 && false) {
- _uri = Arabica::io::URI("file:///" + baseUrl.substr(7), _uri.as_string());
- } else {
- _uri = Arabica::io::URI(baseUrl, _uri.as_string());
+URLImpl::operator std::string() const {
+ int charsRequired = 0;
+ if (uriToStringCharsRequiredA(&_uri, &charsRequired) != URI_SUCCESS) {
+ throw ErrorEvent("Cannot recompose URL");
}
-#else
- _uri = Arabica::io::URI(baseUrl, _uri.as_string());
-#endif
-// std::cout << "## abs # " << _uri.as_string() << std::endl;
-
- if (!_uri.is_absolute())
- return false;
- return true;
-}
+ charsRequired++;
-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);
-#ifdef _WIN32
- urlImpl->_uri = std::string("file://") + urlImpl->_localFile;
-#else
- urlImpl->_uri = std::string("file://") + urlImpl->_localFile;
-#endif
- 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>();
+ char * uriString;
+ uriString = (char*)malloc(charsRequired * sizeof(char));
+ if (uriString == NULL) {
+ throw ErrorEvent("Malloc failed");
}
- 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 = "";
+ if (uriToStringA(uriString, &_uri, charsRequired, NULL) != URI_SUCCESS) {
+ free(uriString);
+ throw ErrorEvent("Cannot recompose URL");
}
- return _localFile;
-}
+ std::string recomposed(uriString);
+ free(uriString);
+ return recomposed;
-std::ostream & operator<<(std::ostream & stream, const URL& url) {
- URL nonConstUrl = url; // this is a hack
- stream << nonConstUrl.getInContent();
- return stream;
}
URLFetcher::URLFetcher() {
@@ -566,19 +419,19 @@ URLFetcher::URLFetcher() {
_multiHandle = curl_multi_init();
// read proxy information from environment
-// CURLOPT_PROXY;
-// CURLOPT_PROXY_TRANSFER_MODE;
-// CURLOPT_PROXYAUTH;
-// CURLOPT_PROXYHEADER;
-// CURLOPT_PROXYPASSWORD;
-// CURLOPT_PROXYPORT;
-// CURLOPT_PROXYTYPE;
-// CURLOPT_PROXYUSERNAME;
-// CURLOPT_PROXYUSERPWD;
+ // CURLOPT_PROXY;
+ // CURLOPT_PROXY_TRANSFER_MODE;
+ // CURLOPT_PROXYAUTH;
+ // CURLOPT_PROXYHEADER;
+ // CURLOPT_PROXYPASSWORD;
+ // CURLOPT_PROXYPORT;
+ // CURLOPT_PROXYTYPE;
+ // CURLOPT_PROXYUSERNAME;
+ // CURLOPT_PROXYUSERPWD;
/*
- see http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html
- e.g. 'socks5://bob:marley@localhost:12345'
+ see http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html
+ e.g. 'socks5://bob:marley@localhost:12345'
*/
_envProxy = getenv("USCXML_PROXY");
@@ -589,10 +442,10 @@ URLFetcher::URLFetcher() {
// exposed just in case
char* envProxyTransferMode = getenv("USCXML_PROXY_TRANSFER_MODE");
char* envProxyAuth = getenv("USCXML_PROXYAUTH");
-// char* envProxyHeader = getenv("USCXML_PROXYHEADER"); // not available in older curl
+ // char* envProxyHeader = getenv("USCXML_PROXYHEADER"); // not available in older curl
char* envProxyPassword = getenv("USCXML_PROXYPASSWORD");
char* envProxyPort = getenv("USCXML_PROXYPORT");
-// char* envProxyType = getenv("USCXML_PROXYTYPE"); // takes an int, have another look if needed
+ // char* envProxyType = getenv("USCXML_PROXYTYPE"); // takes an int, have another look if needed
char* envProxyUsername = getenv("USCXML_PROXYUSERNAME");
char* envProxyUserPwd = getenv("USCXML_PROXYUSERPWD");
@@ -659,7 +512,7 @@ URLFetcher::~URLFetcher() {
void URLFetcher::fetchURL(URL& url) {
URLFetcher* instance = getInstance();
- tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(instance->_mutex);
CURL* handle = url._impl->getCurlHandle();
assert(handle != NULL);
@@ -669,17 +522,19 @@ void URLFetcher::fetchURL(URL& url) {
if (instance->_handlesToURLs.find(handle) == instance->_handlesToURLs.end()) {
CURLcode curlError;
- (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);
+ std::string fromURL(url);
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_URL, fromURL.c_str())) == CURLE_OK ||
+ LOG(ERROR) << "Cannot set url to " << std::string(url) << ": " << curl_easy_strerror(curlError);
-// (curlError = curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1)) == CURLE_OK ||
-// LOG(ERROR) << "Cannot set curl to ignore signals: " << curl_easy_strerror(curlError);
+ // (curlError = curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1)) == CURLE_OK ||
+ // LOG(ERROR) << "Cannot set curl to ignore signals: " << curl_easy_strerror(curlError);
-// (curlError = curl_easy_setopt(handle, CURLOPT_FORBID_REUSE, 1)) == CURLE_OK ||
-// LOG(ERROR) << "Cannot force noreuse: " << curl_easy_strerror(curlError);
+ // (curlError = curl_easy_setopt(handle, CURLOPT_FORBID_REUSE, 1)) == CURLE_OK ||
+ // LOG(ERROR) << "Cannot force noreuse: " << curl_easy_strerror(curlError);
-// (curlError = curl_easy_setopt(handle, CURLOPT_VERBOSE, 1)) == CURLE_OK ||
-// LOG(ERROR) << "Cannot set verbose: " << curl_easy_strerror(curlError);
+ // (curlError = curl_easy_setopt(handle, CURLOPT_VERBOSE, 1)) == CURLE_OK ||
+ // LOG(ERROR) << "Cannot set verbose: " << 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);
@@ -706,25 +561,25 @@ void URLFetcher::fetchURL(URL& url) {
(curlError = curl_easy_setopt(handle, CURLOPT_PROXY, instance->_envProxy)) == CURLE_OK ||
LOG(ERROR) << "Cannot set curl proxy: " << curl_easy_strerror(curlError);
- if (iequals(url._impl->_requestType, "post")) {
+ if (url._impl->_requestType == URLRequestType::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);
+ LOG(ERROR) << "Cannot set request type to post for " << std::string(url) << ": " << 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);
+ LOG(ERROR) << "Cannot set post data " << std::string(url) << ": " << curl_easy_strerror(curlError);
// Disable "Expect: 100-continue"
-// curl_slist* disallowed_headers = 0;
-// disallowed_headers = curl_slist_append(disallowed_headers, "Expect:");
-// (curlError = curl_easy_setopt(handle, CURLOPT_HTTPHEADER, disallowed_headers)) == CURLE_OK ||
-// LOG(ERROR) << "Cannot disable Expect 100 header: " << curl_easy_strerror(curlError);
+ // curl_slist* disallowed_headers = 0;
+ // disallowed_headers = curl_slist_append(disallowed_headers, "Expect:");
+ // (curlError = curl_easy_setopt(handle, CURLOPT_HTTPHEADER, disallowed_headers)) == CURLE_OK ||
+ // LOG(ERROR) << "Cannot disable Expect 100 header: " << 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* 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());
const char* value = paramIter->second.c_str();
@@ -732,8 +587,8 @@ void URLFetcher::fetchURL(URL& url) {
sprintf(header,"%s: %s", paramIter->first.c_str(), value);
headers = curl_slist_append(headers, header);
-// curl_free(key);
-// curl_free(value);
+ // curl_free(key);
+ // curl_free(value);
paramIter++;
}
@@ -741,17 +596,17 @@ void URLFetcher::fetchURL(URL& url) {
headers = curl_slist_append(headers, "Expect:");
(curlError = curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers)) == CURLE_OK ||
- LOG(ERROR) << "Cannot headers for " << url.asString() << ": " << curl_easy_strerror(curlError);
+ LOG(ERROR) << "Cannot headers for " << std::string(url) << ": " << curl_easy_strerror(curlError);
//curl_slist_free_all(headers);
- } else if (iequals(url._impl->_requestType, "get")) {
+ } else if (url._impl->_requestType == URLRequestType::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);
+ LOG(ERROR) << "Cannot set request type to get for " << std::string(url) << ": " << curl_easy_strerror(curlError);
}
- url.downloadStarted();
+ url._impl->downloadStarted();
instance->_handlesToURLs[handle] = url;
assert(instance->_handlesToURLs.size() > 0);
@@ -764,24 +619,24 @@ void URLFetcher::breakURL(URL& url) {
URLFetcher* instance = getInstance();
CURL* handle = url._impl->getCurlHandle();
- tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
+ std::lock_guard<std::recursive_mutex> lock(instance->_mutex);
if (instance->_handlesToURLs.find(handle) != instance->_handlesToURLs.end()) {
- url.downloadFailed(CURLE_OK);
+ url._impl->downloadFailed(CURLE_OK);
curl_multi_remove_handle(instance->_multiHandle, handle);
instance->_handlesToURLs.erase(handle);
}
}
void URLFetcher::start() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
if (!_isStarted) {
_isStarted = true;
- _thread = new tthread::thread(URLFetcher::run, this);
+ _thread = new std::thread(URLFetcher::run, this);
}
}
void URLFetcher::stop() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
if (_isStarted) {
_isStarted = false;
_thread->join();
@@ -805,7 +660,7 @@ void URLFetcher::perform() {
CURLMcode err;
{
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
if (_handlesToURLs.empty()) {
_condVar.wait(_mutex);
}
@@ -832,7 +687,7 @@ void URLFetcher::perform() {
timeout.tv_usec = 0;
{
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
err = curl_multi_timeout(_multiHandle, &curlTimeOut);
if (err != CURLM_OK) {
LOG(WARNING) << "curl_multi_timeout: " << curl_multi_strerror(err);
@@ -850,7 +705,7 @@ void URLFetcher::perform() {
/* get file descriptors from the transfers */
{
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
err = curl_multi_fdset(_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
if (err != CURLM_OK) {
LOG(WARNING) << "curl_multi_fdset: " << curl_multi_strerror(err);
@@ -865,7 +720,7 @@ void URLFetcher::perform() {
break;
case 0: /* timeout */
default: { /* action */
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
err = curl_multi_perform(_multiHandle, &stillRunning);
if (err != CURLM_OK) {
LOG(WARNING) << "curl_multi_perform: " << curl_multi_strerror(err);
@@ -875,12 +730,12 @@ void URLFetcher::perform() {
}
{
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::lock_guard<std::recursive_mutex> lock(_mutex);
while ((msg = curl_multi_info_read(_multiHandle, &msgsLeft))) {
if (msg->msg == CURLMSG_DONE) {
switch (msg->data.result) {
case CURLE_OK:
- _handlesToURLs[msg->easy_handle].downloadCompleted();
+ _handlesToURLs[msg->easy_handle]._impl->downloadCompleted();
err = curl_multi_remove_handle(_multiHandle, msg->easy_handle);
if (err != CURLM_OK) {
LOG(WARNING) << "curl_multi_remove_handle: " << curl_multi_strerror(err);
@@ -889,7 +744,7 @@ void URLFetcher::perform() {
_handlesToURLs.erase(msg->easy_handle);
break;
default:
- _handlesToURLs[msg->easy_handle].downloadFailed(msg->data.result);
+ _handlesToURLs[msg->easy_handle]._impl->downloadFailed(msg->data.result);
err = curl_multi_remove_handle(_multiHandle, msg->easy_handle);
if (err != CURLM_OK) {
LOG(WARNING) << "curl_multi_remove_handle: " << curl_multi_strerror(err);
@@ -914,4 +769,5 @@ URLFetcher* URLFetcher::getInstance() {
return _instance;
}
+
} \ No newline at end of file
diff --git a/src/uscxml/util/URL.h b/src/uscxml/util/URL.h
new file mode 100644
index 0000000..f545fe8
--- /dev/null
+++ b/src/uscxml/util/URL.h
@@ -0,0 +1,333 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef URL_H_9DAEGSMV
+#define URL_H_9DAEGSMV
+
+#include "uscxml/Common.h"
+#include "uscxml/messages/Event.h"
+
+#define DOWNLOAD_IF_NECESSARY if (!_isDownloaded) { download(true); }
+
+#include <string>
+#include <sstream>
+#include <map>
+#include <set>
+#include <list>
+#include <thread>
+#include <condition_variable>
+#include <curl/curl.h>
+#include <uriparser/Uri.h>
+
+#define USCXML_URI_STRING(obj, field) std::string(obj.field.first, obj.field.afterLast - obj.field.first)
+
+namespace uscxml {
+
+class URL;
+
+class USCXML_API 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) {};
+};
+
+enum URLRequestType {
+ POST,
+ GET
+};
+
+class USCXML_API URLImpl : public std::enable_shared_from_this<URLImpl> {
+public:
+ URLImpl(const std::string& url);
+ ~URLImpl();
+
+ bool isAbsolute() const {
+ // see https://sourceforge.net/p/uriparser/bugs/3/
+ return _uri.absolutePath || ((_uri.hostText.first != nullptr) && (_uri.pathHead != nullptr));
+ }
+
+ std::string scheme() const {
+ return USCXML_URI_STRING(_uri, scheme);
+ }
+
+ std::string userInfo() const {
+ return USCXML_URI_STRING(_uri, userInfo);
+ }
+
+ std::string host() const {
+ return USCXML_URI_STRING(_uri, hostText);
+ }
+
+ std::string port() const {
+ return USCXML_URI_STRING(_uri, portText);
+ }
+
+ std::string fragment() const {
+ return USCXML_URI_STRING(_uri, fragment);
+ }
+
+ std::map<std::string, std::string> query() const;
+ std::string path() const;
+ std::list<std::string> pathComponents() const;
+
+ void normalize();
+
+ static URL resolve(URLImpl* relativeURL, URLImpl* absoluteURL);
+ static URL resolveWithCWD(URLImpl* relativeURL);
+ static URL refer(URLImpl* absoluteSource, URLImpl* absoluteBase);
+
+ void addMonitor(URLMonitor* monitor) {
+ _monitors.insert(monitor);
+ }
+ void removeMonitor(URLMonitor* monitor) {
+ _monitors.erase(monitor);
+ }
+
+ // downloading / uploading
+ void addOutHeader(const std::string& key, const std::string& value) {
+ _outHeader[key] = value;
+ }
+ void setOutContent(const std::string& content) {
+ _outContent = content;
+ _requestType = URLRequestType::POST;
+ }
+ void setRequestType(URLRequestType requestType) {
+ _requestType = requestType;
+
+ }
+
+ const std::map<std::string, std::string> getInHeaderFields() {
+ DOWNLOAD_IF_NECESSARY
+ return _inHeaders;
+ }
+
+ const std::string getInHeaderField(const std::string& key) {
+ DOWNLOAD_IF_NECESSARY
+ if (_inHeaders.find(key) != _inHeaders.end()) {
+ return _inHeaders[key];
+ }
+ return "";
+ }
+
+ const std::string getStatusCode() const {
+// DOWNLOAD_IF_NECESSARY
+ return _statusCode;
+ }
+
+ const std::string getStatusMessage() const {
+// DOWNLOAD_IF_NECESSARY
+ return _statusMsg;
+ }
+
+ const std::string getInContent(bool forceReload = false) {
+ if (forceReload)
+ _isDownloaded = false;
+ DOWNLOAD_IF_NECESSARY
+ return _rawInContent.str();
+ }
+
+ const void download(bool blocking = false);
+
+ operator Data() const;
+ operator std::string() const;
+
+protected:
+ URLImpl();
+ UriUriA _uri;
+ std::string _orig;
+
+ CURL* getCurlHandle();
+ 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 downloadStarted();
+ void downloadCompleted();
+ void downloadFailed(CURLcode errorCode);
+
+ static void prepareException(ErrorEvent& exception, int errorCode, const std::string& origUri, UriParserStateA* parser);
+
+ CURL* _handle;
+ std::stringstream _rawInContent;
+ std::stringstream _rawInHeader;
+ std::map<std::string, std::string> _inHeaders;
+
+ std::string _outContent;
+ std::map<std::string, std::string> _outHeader;
+ URLRequestType _requestType;
+
+ std::string _statusCode;
+ std::string _statusMsg;
+ bool _isDownloaded;
+ bool _hasFailed;
+ std::string _error;
+
+ std::condition_variable_any _condVar;
+ std::recursive_mutex _mutex;
+
+ std::set<URLMonitor*> _monitors;
+
+ friend class URLFetcher;
+};
+
+class USCXML_API URL {
+public:
+ PIMPL_OPERATORS(URL)
+ URL(const std::string url) : _impl(new URLImpl(url)) {}
+
+ bool isAbsolute() {
+ return _impl->isAbsolute();
+ }
+
+ std::string scheme() {
+ return _impl->scheme();
+ }
+
+ std::string userInfo() {
+ return _impl->userInfo();
+ }
+
+ std::string host() {
+ return _impl->host();
+ }
+
+ std::string port() {
+ return _impl->port();
+ }
+
+ std::string fragment() {
+ return _impl->fragment();
+ }
+
+ std::map<std::string, std::string> query() {
+ return _impl->query();
+ }
+
+ std::string path() {
+ return _impl->path();
+ }
+
+ std::list<std::string> pathComponents() {
+ return _impl->pathComponents();
+ }
+
+ void normalize() {
+ return _impl->normalize();
+ }
+
+ static URL resolve(URL relativeURL, URL absoluteURL) {
+ return URLImpl::resolve(relativeURL._impl.get(), absoluteURL._impl.get());
+ }
+
+ static URL resolveWithCWD(URL relativeURL) {
+ return URLImpl::resolveWithCWD(relativeURL._impl.get());
+ }
+
+ static URL refer(URL absoluteSource, URL absoluteBase) {
+ return URLImpl::refer(absoluteSource._impl.get(), absoluteBase._impl.get());
+ }
+
+ void addOutHeader(const std::string& key, const std::string& value) {
+ return _impl->addOutHeader(key, value);
+ }
+
+ void setOutContent(const std::string& content) {
+ return _impl->setOutContent(content);
+ }
+ void setRequestType(URLRequestType requestType) {
+ return _impl->setRequestType(requestType);
+ }
+
+ const std::map<std::string, std::string> getInHeaderFields() {
+ return _impl->getInHeaderFields();
+ }
+
+ const std::string getInHeaderField(const std::string& key) {
+ return _impl->getInHeaderField(key);
+ }
+
+ const std::string getStatusCode() const {
+ return _impl->getStatusCode();
+ }
+
+ const std::string getStatusMessage() const {
+ return _impl->getStatusMessage();
+ }
+
+ const std::string getInContent(bool forceReload = false) {
+ return _impl->getInContent(forceReload);
+ }
+
+ const void download(bool blocking = false) const {
+ return _impl->download(blocking);
+ }
+
+ void addMonitor(URLMonitor* monitor) {
+ return _impl->addMonitor(monitor);
+ }
+ void removeMonitor(URLMonitor* monitor) {
+ return _impl->removeMonitor(monitor);
+ }
+
+ operator Data() const {
+ return _impl->operator Data();
+ }
+
+ operator std::string() {
+ return (*_impl.get());
+ }
+
+protected:
+ std::shared_ptr<URLImpl> _impl;
+ friend class URLFetcher;
+};
+
+class USCXML_API URLFetcher {
+public:
+ static void fetchURL(URL& url);
+ static void breakURL(URL& url);
+
+ void start();
+ void stop();
+
+protected:
+ URLFetcher();
+ ~URLFetcher();
+
+ static URLFetcher* _instance;
+ static URLFetcher* getInstance();
+
+ static void run(void* instance);
+ void perform();
+
+ std::thread* _thread;
+ std::condition_variable_any _condVar;
+ std::recursive_mutex _mutex;
+ bool _isStarted;
+
+ std::map<CURL*, URL> _handlesToURLs;
+ CURLM* _multiHandle;
+ char* _envProxy;
+};
+
+}
+
+#endif /* end of include guard: URL_H_9DAEGSMV */
diff --git a/src/uscxml/UUID.cpp b/src/uscxml/util/UUID.cpp
index 34e3e75..34e3e75 100644
--- a/src/uscxml/UUID.cpp
+++ b/src/uscxml/util/UUID.cpp
diff --git a/src/uscxml/UUID.h b/src/uscxml/util/UUID.h
index 873d963..873d963 100644
--- a/src/uscxml/UUID.h
+++ b/src/uscxml/util/UUID.h